Browse Source

make docker-entrypoint actually pass env var -_-;; and update README about docker

Dan Ballard 4 months ago
parent
commit
09fdb05168
4 changed files with 23 additions and 6 deletions
  1. 0 1
      Dockerfile
  2. 21 2
      README.md
  3. 1 2
      server/docker/docker-entrypoint
  4. 1 1
      server/serverConfig.go

+ 0 - 1
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

+ 21 - 2
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)

+ 1 - 2
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 "$@"

+ 1 - 1
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