package abra
This commit is contained in:
commit
afe80ca3af
|
@ -0,0 +1,7 @@
|
||||||
|
TYPE=monica
|
||||||
|
|
||||||
|
DOMAIN=monica.example.com
|
||||||
|
## Domain aliases
|
||||||
|
#EXTRA_DOMAINS=', `www.monica.example.com`'
|
||||||
|
LETS_ENCRYPT_ENV=production
|
||||||
|
SECRET_APP_KEY_VERSION=v1
|
|
@ -0,0 +1 @@
|
||||||
|
/.envrc
|
|
@ -0,0 +1,28 @@
|
||||||
|
# monica
|
||||||
|
|
||||||
|
Monica is a great open source personal relationship management system.
|
||||||
|
|
||||||
|
<!-- metadata -->
|
||||||
|
* **Category**:
|
||||||
|
* **Status**:
|
||||||
|
* **Image**: [`monica`](https://hub.docker.com/r/monica/monica)
|
||||||
|
* **Healthcheck**:
|
||||||
|
* **Backups**:
|
||||||
|
* **Email**:
|
||||||
|
* **Tests**:
|
||||||
|
* **SSO**:
|
||||||
|
<!-- endmetadata -->
|
||||||
|
|
||||||
|
## Basic usage
|
||||||
|
|
||||||
|
1. Set up Docker Swarm and [`abra`]
|
||||||
|
2. Deploy [`coop-cloud/traefik`]
|
||||||
|
3. `abra app new monica --secrets` (optionally with `--pass` if you'd like
|
||||||
|
to save secrets in `pass`)
|
||||||
|
4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
|
||||||
|
your Docker swarm box
|
||||||
|
5. `abra app YOURAPPDOMAIN deploy`
|
||||||
|
6. Open the configured domain in your browser to finish set-up
|
||||||
|
|
||||||
|
[`abra`]: https://git.autonomic.zone/autonomic-cooperative/abra
|
||||||
|
[`coop-cloud/traefik`]: https://git.autonomic.zone/coop-cloud/traefik
|
|
@ -0,0 +1,81 @@
|
||||||
|
|
||||||
|
---
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: monica
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
- internal
|
||||||
|
volumes:
|
||||||
|
- data:/var/www/html/storage
|
||||||
|
environment:
|
||||||
|
- APP_KEY_FILE=/run/secrets/app_key
|
||||||
|
- APP_URL=https://$DOMAIN
|
||||||
|
- APP_TRUSTED_PROXIES=*
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_USERNAME=monica
|
||||||
|
- DB_PASSWORD=secret
|
||||||
|
secrets:
|
||||||
|
- app_key
|
||||||
|
configs:
|
||||||
|
- source: entrypoint_conf
|
||||||
|
target: /docker-entrypoint.sh
|
||||||
|
mode: 0555
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||||
|
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||||
|
## Redirect from EXTRA_DOMAINS to DOMAIN
|
||||||
|
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
|
||||||
|
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
|
||||||
|
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
||||||
|
# healthcheck:
|
||||||
|
# test: ["CMD", "curl", "-f", "http://localhost:8080"]
|
||||||
|
# interval: 30s
|
||||||
|
# timeout: 10s
|
||||||
|
# retries: 10
|
||||||
|
# start_period: 1m
|
||||||
|
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
- MYSQL_RANDOM_ROOT_PASSWORD=true
|
||||||
|
- MYSQL_DATABASE=monica
|
||||||
|
- MYSQL_USER=monica
|
||||||
|
- MYSQL_PASSWORD=secret
|
||||||
|
volumes:
|
||||||
|
- mysql:/var/lib/mysql
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
deploy:
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
app_key:
|
||||||
|
external: true
|
||||||
|
name: ${STACK_NAME}_app_key_${SECRET_APP_KEY_VERSION}
|
||||||
|
|
||||||
|
configs:
|
||||||
|
entrypoint_conf:
|
||||||
|
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
|
||||||
|
file: entrypoint.sh.tmpl
|
||||||
|
template_driver: golang
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data:
|
||||||
|
mysql:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
|
internal:
|
||||||
|
internal: true
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
file_env() {
|
||||||
|
# 3wc: Load $VAR_FILE into $VAR - useful for secrets. See
|
||||||
|
# https://medium.com/@adrian.gheorghe.dev/using-docker-secrets-in-your-environment-variables-7a0609659aab
|
||||||
|
local var="$1"
|
||||||
|
local fileVar="${var}_FILE"
|
||||||
|
local def="${2:-}"
|
||||||
|
|
||||||
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||||
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
local val="$def"
|
||||||
|
if [ "${!var:-}" ]; then
|
||||||
|
val="${!var}"
|
||||||
|
elif [ "${!fileVar:-}" ]; then
|
||||||
|
val="$(< "${!fileVar}")"
|
||||||
|
fi
|
||||||
|
export "$var"="$val"
|
||||||
|
unset "$fileVar"
|
||||||
|
}
|
||||||
|
|
||||||
|
load_vars() {
|
||||||
|
file_env "APP_KEY"
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
load_vars
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
|
|
||||||
|
# 3wc: upstream ENTRYPOINT
|
||||||
|
/usr/local/bin/entrypoint.sh
|
Loading…
Reference in New Issue