Skip to content

Commit

Permalink
Added example for Let's Encrypt + Traeffik to help out #6.
Browse files Browse the repository at this point in the history
Simplified default Docker Compose example.
  • Loading branch information
ckulka committed Apr 18, 2018
1 parent 80e3344 commit eec9fe3
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ charset = utf-8
indent_style = tab
indent_size = 4

[*.{yml,md}]
[*.{yaml,md}]
indent_style = space
indent_size = 2
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ The following command will run Baikal over HTTP & HTTPS:
docker run --rm -it -p 80:80 -p 443:443 ckulka/baikal
```

Alternatively, use the provided [docker-compose.yml](https://github.com/ckulka/baikal-docker/blob/master/docker-compose.yml) from the Git repository:
Alternatively, use the provided [examples/docker-compose.yaml](https://github.com/ckulka/baikal-docker/blob/master/examples/docker-compose.yaml) from the Git repository:

```bash
docker-compose up baikal
docker-compose up
```

## Environment Variables
Expand All @@ -50,7 +50,7 @@ I also included a [Systemd service file](https://github.com/ckulka/baikal-docker

```bash
sudo curl -o /etc/systemd/system/baikal.service https://github.com/ckulka/baikal-docker/blob/master/baikal.service
# Adjust the location of the docker-compose.yml
# Adjust the WorkingDirectory variable

sudo systemctl enable baikal.service
```
Expand All @@ -59,26 +59,37 @@ This automatically starts the service.

## Persistent Data

The image exposes the ```/var/www/baikal/Specific``` folder, which contains the persistent data. This folder should be part of a regular backup.
The image exposes the `/var/www/baikal/Specific` folder, which contains the persistent data. This folder should be part of a regular backup.

## SSL Certificates

If you want to use your own certificates, either hide this container behind your own HTTPS proxy (e.g. nginx) or you mount your certificates into the container:
### Let's Encrypt

[Traefik](https://traefik.io/) is a modern HTTP reverse proxy that supports Docker + [Let's Encrypt](https://letsencrypt.org) and manages its configuration automatically and dynamically.

An example for Docker Compose can be found under [examples/docker-compose.letsencrypt.yaml](https://github.com/ckulka/baikal-docker/blob/master/examples/docker-compose.letsencrypt.yaml).

### Static Certificates

If you want to use your own certificates, either hide this container behind your own HTTPS proxy (e.g. [nginx](https://hub.docker.com/_/nginx/)) or you mount your certificates into the container:

```bash
# The folder /etc/ssl/private/baikal contains the files baikal.public.pem and baikal.private.pem
docker run --rm -it -p 80:80 -p 443:443 -v /etc/my-certs/baikal:/etc/ssl/private/:ro ckulka/rpi-baikal
docker run --rm -it -p 80:80 -p 443:443 -v /etc/ssl/private/baikal:/etc/ssl/private/:ro ckulka/baikal
```

Alternatively, you can also provide your own Apache configuration and specify different certificates (see [baikal-docker/files/baikal.conf](https://github.com/ckulka/baikal-docker/blob/master/files/baikal.conf)).
Alternatively, you can also provide your own Apache configuration and specify different certificates (see [files/baikal.conf](https://github.com/ckulka/baikal-docker/blob/master/files/baikal.conf)).

## Backup to AWS S3

I backup my persistent data to AWS S3 (<https://aws.amazon.com/de/s3>).

Docker-compose file: <https://github.com/ckulka/baikal-docker/blob/master/docker-compose.yml>
Docker-compose file: [examples/docker-compose.awss3.yaml]<https://github.com/ckulka/baikal-docker/blob/master/examples/docker-compose.awss3.yaml>

```bash
# Important: only start the baikal container
docker-compose up baikal

# On a regular basis, perform the backup
docker-compose run --rm backup
```
7 changes: 3 additions & 4 deletions baikal.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ After=docker

[Service]
WorkingDirectory=/etc/baikal
#Environment=COMPOSE_FILE=/etc/baikal/docker-compose.yml
ExecStart=/usr/local/bin/docker-compose up baikal
ExecReload=/usr/local/bin/docker-compose restart --force-recreate baikal
ExecStop=/usr/local/bin/docker-compose stop baikal
ExecStart=/usr/local/bin/docker-compose up
ExecReload=/usr/local/bin/docker-compose restart --force-recreate
ExecStop=/usr/local/bin/docker-compose stop

[Install]
WantedBy=multi-user.target
3 changes: 2 additions & 1 deletion docker-compose.yml → examples/docker-compose.awss3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'

services:
baikal:
image: ckulka/baikal
image: ckulka/baikal:0.4.6
# environment:
# BAIKAL_SERVERNAME: dav.example.io
# BAIKAL_SERVERALIAS: dav.example.org dav.example.com
Expand All @@ -11,6 +11,7 @@ services:
- "443:443"
volumes:
- baikal:/var/www/baikal/Specific
# - /etc/ssl/private/baikal:/etc/ssl/private

backup:
image: ckulka/awscli:alpine
Expand Down
41 changes: 41 additions & 0 deletions examples/docker-compose.letsencrypt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '2'

services:
baikal:
image: ckulka/baikal:0.4.6
labels:
traefik.enable: "true"
traefik.frontend.rule: "Host: dav.example.com"
traefik.port: 80
environment:
BAIKAL_SERVERNAME: dav.example.com
volumes:
- baikal:/var/www/baikal/Specific

# See https://docs.traefik.io/
traefik:
image: traefik:1.5-alpine
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- /etc/ssl/private/acme.json:/acme.json
- /var/run/docker.sock:/var/run/docker.sock
command: |
--defaultentrypoints='http,https'
--entrypoints='Name:http Address::80 Redirect.EntryPoint:https'
--entrypoints='Name:https Address::443 TLS'
--docker
--docker.exposedbydefault
--acme
--acme.acmelogging=true
--acme.email=admin@example.com
--acme.entrypoint=https
--acme.httpchallenge
--acme.httpchallenge.entrypoint=http
--acme.onhostrule=true
--acme.storage=/acme.json
volumes:
baikal:
17 changes: 17 additions & 0 deletions examples/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '2'

services:
baikal:
image: ckulka/baikal:0.4.6
# environment:
# BAIKAL_SERVERNAME: dav.example.io
# BAIKAL_SERVERALIAS: dav.example.org dav.example.com
ports:
- "80:80"
- "443:443"
volumes:
- baikal:/var/www/baikal/Specific
# - /etc/ssl/private/baikal:/etc/ssl/private

volumes:
baikal:

0 comments on commit eec9fe3

Please sign in to comment.