Add docker and docker-compose with instructions for people that want to deploy that way.

This commit is contained in:
Peter van der Meulen 2021-06-01 10:13:25 +02:00
parent 7c068f2df1
commit 93208fa1e3
7 changed files with 91 additions and 1 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
node_moduels
ssb-go-room-secrets
ssb-go-room-secrets/**/*
.git

4
.env_example Normal file
View File

@ -0,0 +1,4 @@
HTTPS_DOMAIN=yourhttpsdomainhere
ALIASES_AS_SUBDOMAINS=true
# uncomment variable if you want to store data in a custom directory (required for default docker-compose setup)
# REPO=/ssb-go-room-secrets

4
.gitignore vendored
View File

@ -17,3 +17,7 @@ node_modules
# goreleaser output
dist/
# secrets and config
ssb-go-room-secrets/
.env

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM golang:1.16-alpine
RUN apk add --no-cache \
build-base \
git \
sqlite \
sqlite-dev
RUN mkdir /app
WORKDIR /app
COPY . /app
RUN cd /app/cmd/server && go build && \
cd /app/cmd/insert-user && go build
EXPOSE 8008
EXPOSE 3000
RUN apk del \
build-base \
git
CMD ./start.sh

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: '3'
services:
room:
build: .
command: 'sh start.sh'
env_file: .env
ports:
- "3000:3000" # Proxypass this port through NGINX or Apache as your HTTP landing & dashboard page
- "0.0.0.0:8008:8008" # This is the port SSB clients connect to
volumes:
- ./ssb-go-room-secrets:/ssb-go-room-secrets

View File

@ -21,6 +21,46 @@ After running `sudo dpkg -i go-ssb-room_v1.2.3_Linux_x86_64.deb` pay special att
* You should now have a working go-ssb-room binary! Read the HTTP Hosting section below and admin
user sections below, for more instructions on the last mile.
# Docker & Docker-compose
This project includes a docker-compose.yml file as well as a Docker file. Using
it should be fairly straight forward.
Start off by making a copy of `.env_example` called `.env` and insert your
website domain there. With that done execute
```
docker-compose build room
```
Followed by
```
docker-compose up
```
Your database, secrets and other things will be synchronized to a folder in your
project called "docker-secrets".
After starting your server for the first time you need to enter your running
server to insert your first user (your docker-compose up should be active).
You can do this by:
```
docker-compose exec room sh
```
Then inside the virtual machine:
```
/app/cmd/insert-user/insert-user -repo /ssb-go-room-secrets @your-own-ssb-public-key
```
Fill in your password and then exit your instance by typing `exit`.
You should setup Nginx or HTTPS load-balancing outside the docker-compose
instance.
# HTTP Hosting
We currently assume a standard HTTPS server in front of go-ssb-room to facilitate TLS
@ -68,4 +108,4 @@ example (with custom repo location, only needed if you setup your with a custom
./insert-user -repo "/ssb-go-room-secrets" "@Bp5Z5TQKv6E/Y+QZn/3LiDWMPi63EP8MHsXZ4tiIb2w=.ed25519"
```
You can now login in the web-front-end using these credentials
You can now login in the web-front-end using these credentials

4
start.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
[[ -f ".env" ]] && source .env
./cmd/server/server -https-domain "${HTTPS_DOMAIN}" -repo "${REPO:-~/.ssb-go-room-secrets}" -aliases-as-subdomains "${ALIASES_AS_SUBDOMAINS}"