diff --git a/Dockerfile b/Dockerfile index 15920b6..6a4e686 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,7 +55,6 @@ RUN apk --no-cache add --update \ COPY --from=tor-build-stage /usr/local/ /usr/local/ # Create an unprivileged tor user -#RUN addgroup -g 19001 -S $TOR_USER && adduser -u 19001 -G $TOR_USER -S $TOR_USER RUN addgroup -S $TOR_USER && adduser -G $TOR_USER -S $TOR_USER && adduser -G _tor -S cwtchd && mkdir /run/tor # Copy Tor configuration file diff --git a/README.md b/README.md index d2ccdc6..330b4f3 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,27 @@ Development and Contributing information in [CONTRIBUTING.md](https://git.openpr #### Docker This repository contains a `Dockerfile` allowing you to build and run the server as a [docker](https://www.docker.com/) container. -To get started issue `docker build -t cwtch:latest`, this will create 2 temporary docker containers, one to build the Tor daemon and one to build Cwtch. The compiled binaries will then be bundled into a new image and tagged as `cwtch:latest`. +To get started issue `docker build -t openpriv/cwtch-server:latest`, this will create 2 temporary docker containers, one to build the Tor daemon and one to build Cwtch. The compiled binaries will then be bundled into a new image and tagged as `openpriv/cwtch-server:latest`. -To run Cwtch in the foreground execute `docker run cwtch:latest`, you will see a small amount of output from Tor and then Cwtch will output your server address. When you `Ctrl + C` the container will terminate. To run Cwtch in the background execute `docker run --name my-cwtch-server -d cwtch:latest`. To get your Cwtch server address issue `docker logs my-cwtch-server`. +To run Cwtch in the foreground execute `docker run openpriv/cwtch-server:latest`, you will see a small amount of output from Tor and then Cwtch will output your server address. When you `Ctrl + C` the container will terminate. To run Cwtch in the background execute `docker run --name my-cwtch-server -d openpriv/cwtch-server:latest`. To get your Cwtch server address issue `docker logs my-cwtch-server`. + +The image creates 3 volumes, for /etc/cwtch, /etc/tor, /var/lib/tor + +##### Upgrading + +To upgrade with continuity + +``` +# Stop current container/service +docker stop my-cwtch-server + +docker pull openpriv/cwtch-server + +# Create a new container and copy the volumes (cwtch/onion keys, message store) +docker create --name my-cwtch-server-2 --volumes-from my-cwtch-server openpriv/cwtch-server:latest + +# Resume service with the new container +docker start my-cwtch-server-2 +``` ![](https://git.openprivacy.ca/avatars/5?s=140) diff --git a/server/docker/docker-entrypoint b/server/docker/docker-entrypoint index fe8c7f1..1e55c91 100755 --- a/server/docker/docker-entrypoint +++ b/server/docker/docker-entrypoint @@ -30,5 +30,4 @@ if [ -z "${CWTCH_CONFIG_DIR}" ]; then fi #Run cwtch (or whatever the user passed) -exec "$@" -#$@ +CWTCH_CONFIG_DIR=$CWTCH_CONFIG_DIR exec "$@" diff --git a/server/serverConfig.go b/server/serverConfig.go index 6d55c9c..eaf63f6 100644 --- a/server/serverConfig.go +++ b/server/serverConfig.go @@ -40,7 +40,7 @@ func (config *Config) Save(dir, filename string) { // LoadConfig loads a Config from a json file specified by filename func LoadConfig(configDir, filename string) Config { - log.Printf("Loading config from %s\n", filename) + log.Printf("Loading config from %s\n", path.Join(configDir, filename)) config := Config{} config.ConfigDir = configDir config.MaxBufferLines = 100000