owntracks / docker-recorder

Docker image for OwnTracks Recorder
151 stars 68 forks source link

New Dockerfile for Recorder #20

Closed deisi closed 5 years ago

deisi commented 5 years ago

The problem with the current solution is that it provide a monolytic multiprogramm docker container. However the idiom of docker is to have one service per docker container. If multiple services are needed multiple docker container should be used. Docker-compose makes this easily possible.

Another isse is that the container automatically creates certificates and sets up encryption using a script. Also this violates docker idioms, because certificate handling can be done using specific containers like letsencrypt. It further makes it hard to include this image into an existing and possible complex infastructure.

A further goal of mine would be to generate a Hassio addon for the homeassistant project from this. The current dockerfile makes this kind of hard.

What I did:

What might be added at some point:

jpmens commented 5 years ago

Thank you, @deisi, for this work. What you write sounds sensible to me. FYI, the reason it was originally a multi-system container (recorder + mosquitto) was simply my ignorance. I have since learned (also from you) that it was a bad idea. As such, I greatly appreciate these changes.

I also approve of the simplification in removing certificate creation; this should, indeed, be left to "third party", i.e. Let's Encrypt & co.

@juzam Could you please, as our resident docker contributor :-), look at this and comment?

deisi commented 5 years ago

:-)

juzam commented 5 years ago

I'll give a proper look as soon as possible :)

jpmens commented 5 years ago

@deisi I'm trying this now, and get a linker error for -lssl:

...
cc -g -Wall -Werror -DGHASHPREC=7 -DWITH_MQTT=1 -I/usr/include -DWITH_PING=1 -DWITH_LUA=1 `pkg-config --cflags lua5.2` -DWITH_ENCRYPT=1 `pkg-config --cflags libsodium` -DWITH_HTTP=1 -DJSON_INDENT=NULL -DSTORAGEDEFAULT=\"/store\" -DDOCROOT=\"/htdocs\" -DCONFIGFILE=\"/config/recorder.conf\" -DGIT_VERSION=\"tarball\" -o ot-recorder recorder.o json.o gcache.o geo.o geohash.o mkpath.o base64.o misc.o util.o storage.o fences.o listsort.o hooks.o  mongoose.o http.o -lssl -lm -lcurl -lconfig -llmdb -lpthread -L/usr/lib -lmosquitto -lm `pkg-config --libs lua5.2` `pkg-config --libs libsodium`
/usr/lib/gcc/x86_64-alpine-linux-musl/6.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssl
collect2: error: ld returned 1 exit status
make: *** [Makefile:77: ot-recorder] Error 1
ERROR: Service 'recorder' failed to build: The command '/bin/sh -c apk add --no-cache --virtual .build-deps         curl-dev libconfig-dev make         gcc musl-dev mosquitto-dev wget     && apk add --no-cache         libcurl libconfig-dev mosquitto-dev lmdb-dev libsodium-dev lua5.2-dev     && mkdir -p /usr/local/source     && cd /usr/local/source     && wget https://github.com/owntracks/recorder/archive/$VERSION.tar.gz     && tar xzf $VERSION.tar.gz     && cd recorder-$VERSION     && mv /config.mk ./     && make     && make install     && cd /     && chmod 755 /entrypoint.sh     && rm -rf /usr/local/source     && apk del .build-deps' returned a non-zero code: 2

I fixed with

index 687325c..2996a59 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,7 +13,7 @@ RUN apk add --no-cache --virtual .build-deps \
         curl-dev libconfig-dev make \
         gcc musl-dev mosquitto-dev wget \
     && apk add --no-cache \
-        libcurl libconfig-dev mosquitto-dev lmdb-dev libsodium-dev lua5.2-dev \
+        libcurl libconfig-dev mosquitto-dev lmdb-dev libsodium-dev lua5.2-dev openssl-dev \
     && mkdir -p /usr/local/source \
     && cd /usr/local/source \
     && wget https://github.com/owntracks/recorder/archive/$VERSION.tar.gz \
jpmens commented 5 years ago

For the rest, it works like a charm, @deisi!

jmbp-4945

jpmens commented 5 years ago

Merged. Thank you very much!