2021-07-12 21:34:55 +00:00
# Cwtch Server
2021-11-09 01:18:36 +00:00
## Building
Pretty straight forward:
- build the app in `app/` with `go build`
- build the docker container in `docker/` with `docker build . -t openpriv/server`
### Windows
The server package relies on sqlite which in turn requires the use of CGO. As per [this issue ](https://github.com/golang/go/issues/12029 ) that means [TDM-GCC ](https://jmeubank.github.io/tdm-gcc/download/ ) is required to be installed and used to compile on Windows
2021-07-12 21:34:55 +00:00
## Running
- cd app
- go build
- ./app
The app takes the following arguments
- -debug: enabled debug logging
2021-10-29 23:06:18 +00:00
- -exportServerBundle: Export the server bundle to a file called serverbundle
2021-11-27 00:54:26 +00:00
- -disableMetrics: Disable metrics reporting to serverMonitor.txt and associated tracking routines
- -dir [directory]: specify a directory to store server files (default is current directory)
2021-07-12 21:34:55 +00:00
The app takes the following environment variables
- CWTCH_HOME: sets the config dir for the app
2021-11-27 00:54:26 +00:00
- DISABLE_METRICS: if set to any value ('1') it disables metrics reporting to serverMonitor.txt and associated tracking routines
2021-07-12 21:34:55 +00:00
2021-10-04 23:21:41 +00:00
`env CONFIG_HOME=./conf ./app`
2021-07-12 21:34:55 +00:00
## Using the Server
2021-12-22 13:42:24 +00:00
When run the app will output standard log lines, one of which will contain the `serverbundle` in purple. This is the part you need to capture and import into a Cwtch client app so you can use the server for hosting groups
2021-07-12 21:34:55 +00:00
## Docker
2021-08-09 21:32:30 +00:00
Build by executing `docker build -f docker/Dockerfile .`
2021-08-31 15:10:24 +00:00
2021-09-14 02:15:46 +00:00
or run our prebuild ones with
2021-08-31 15:10:24 +00:00
2021-09-14 02:15:46 +00:00
`pull openpriv/cwtch-server`
2021-08-31 15:10:24 +00:00
2021-11-27 00:54:26 +00:00
and run it. It stores all Cwtch data in a Volume at `/var/lib/cwtch` so if you want the server data to persist you would run
2021-12-22 13:42:24 +00:00
`docker run -v /var/lib/cwtch/server01:/var/lib/cwtch openpriv/cwtch-server`
2021-11-27 00:54:26 +00:00
to create a persistent container you might try a command like:
2021-12-22 13:42:24 +00:00
`docker run --name cwtch -v /var/lib/cwtch/server01:/var/lib/cwtch --restart always openpriv/cwtch-server`