forked from cwtch.im/cwtch
1
0
Fork 0

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

This commit is contained in:
Dan Ballard 2018-11-02 17:17:16 -07:00
parent b145420f21
commit 09fdb05168
4 changed files with 23 additions and 6 deletions

View File

@ -55,7 +55,6 @@ RUN apk --no-cache add --update \
COPY --from=tor-build-stage /usr/local/ /usr/local/ COPY --from=tor-build-stage /usr/local/ /usr/local/
# Create an unprivileged tor user # 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 RUN addgroup -S $TOR_USER && adduser -G $TOR_USER -S $TOR_USER && adduser -G _tor -S cwtchd && mkdir /run/tor
# Copy Tor configuration file # Copy Tor configuration file

View File

@ -32,8 +32,27 @@ Development and Contributing information in [CONTRIBUTING.md](https://git.openpr
#### Docker #### Docker
This repository contains a `Dockerfile` allowing you to build and run the server as a [docker](https://www.docker.com/) container. 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) ![](https://git.openprivacy.ca/avatars/5?s=140)

View File

@ -30,5 +30,4 @@ if [ -z "${CWTCH_CONFIG_DIR}" ]; then
fi fi
#Run cwtch (or whatever the user passed) #Run cwtch (or whatever the user passed)
exec "$@" CWTCH_CONFIG_DIR=$CWTCH_CONFIG_DIR exec "$@"
#$@

View File

@ -40,7 +40,7 @@ func (config *Config) Save(dir, filename string) {
// LoadConfig loads a Config from a json file specified by filename // LoadConfig loads a Config from a json file specified by filename
func LoadConfig(configDir, filename string) Config { 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 := Config{}
config.ConfigDir = configDir config.ConfigDir = configDir
config.MaxBufferLines = 100000 config.MaxBufferLines = 100000