generated from coop-cloud/example
Initial working config
This commit is contained in:
parent
5f9817901c
commit
240830d9c7
@ -4,3 +4,22 @@ export DOMAIN=statuspal.example.com
|
||||
## Domain aliases
|
||||
#export EXTRA_DOMAINS=', `www.statuspal.example.com`'
|
||||
export LETS_ENCRYPT_ENV=production
|
||||
|
||||
#### Must fill in:
|
||||
|
||||
export SECRET_KEY_BASE=<insert here>
|
||||
export NODE_COOKIE=<insert here>
|
||||
|
||||
# Mailgun configs for sending emails, setup at https://www.mailgun.com/.
|
||||
# If left blank email subscription to your status page will be disabled
|
||||
export MG_DOMAIN=
|
||||
export MG_API_KEY=
|
||||
|
||||
export LOG_LEVEL=info
|
||||
export SP_SUBDOMAINS=false
|
||||
export NODE_IP=127.0.0.1
|
||||
export C_TITLE=Statuspal CE
|
||||
export C_DESCRIPTION=
|
||||
|
||||
export SECRET_DB_PASSWORD_VERSION=v1
|
||||
export ENTRYPOINT_CONF_VERSION=v1
|
||||
|
76
compose.yml
76
compose.yml
@ -3,29 +3,81 @@ version: "3.8"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: nginx:1.19.2
|
||||
image: statuspal/statuspal:latest
|
||||
depends_on:
|
||||
- db
|
||||
volumes:
|
||||
- uploads:/statushq/uploads
|
||||
command: ["/statushq/docker/up.sh", "postgres"]
|
||||
#entrypoint: ["tail", "-f", "/dev/null"]
|
||||
networks:
|
||||
- proxy
|
||||
- internal
|
||||
environment:
|
||||
- SECRET_KEY_BASE
|
||||
- NODE_COOKIE
|
||||
- MG_DOMAIN
|
||||
- MG_API_KEY
|
||||
- URL_HOST=${DOMAIN}
|
||||
- URL_SCHEMA=https
|
||||
- URL_PORT=443
|
||||
- DB_NAME=statushq
|
||||
- DB_USERNAME=postgres
|
||||
- DB_HOSTNAME=db
|
||||
- DB_PASSWORD
|
||||
- LOG_LEVEL
|
||||
- SP_SUBDOMAINS
|
||||
- NODE_IP
|
||||
- C_TITLE
|
||||
- C_DESCRIPTION
|
||||
depends_on:
|
||||
- db
|
||||
configs:
|
||||
- source: entrypoint_conf
|
||||
target: /statushq/docker/up.sh
|
||||
mode: 0555
|
||||
secrets:
|
||||
- db_password
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
||||
- "traefik.docker.network=proxy"
|
||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=4000"
|
||||
- "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"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 1m
|
||||
|
||||
db:
|
||||
image: postgres:9.5
|
||||
environment:
|
||||
- POSTGRES_USER=postgres
|
||||
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
|
||||
- POSTGRES_DB=statushq
|
||||
networks:
|
||||
- internal
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
secrets:
|
||||
- db_password
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
internal:
|
||||
|
||||
volumes:
|
||||
uploads:
|
||||
postgres:
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||
|
||||
configs:
|
||||
entrypoint_conf:
|
||||
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION}
|
||||
file: entrypoint.sh.tmpl
|
||||
template_driver: golang
|
||||
|
26
entrypoint.sh.tmpl
Normal file
26
entrypoint.sh.tmpl
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
NO_FORMAT="\033[0m"
|
||||
C_FUCHSIA="\033[38;5;13m"
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
echo "DB_NAME: $DB_NAME, $REPLACE_OS_VARS"
|
||||
|
||||
# 3wc: use depends_on instead
|
||||
# ./wait_for_postgres.sh
|
||||
|
||||
cd ..
|
||||
|
||||
STATIC_DIR="$(find /statushq/rel/statushq/lib -name 'statushq-*' -type d)/priv/static"
|
||||
mkdir -p /statushq/rel/statushq/assets
|
||||
cp -rf $STATIC_DIR/* /statushq/rel/statushq/assets/
|
||||
|
||||
# Up
|
||||
# 3wc: the postgres container should handle this
|
||||
#psql -h "$DB_HOSTNAME" -U "$DB_USERNAME" -c "create database $DB_NAME;" || true
|
||||
/statushq/rel/statushq/bin/statushq command Elixir.Statushq.ReleaseTasks ce_setup
|
||||
printf "\n\n---> Starting Statuspal server at ${C_FUCHSIA}http://${URL_HOST}:${URL_PORT}${NO_FORMAT} <---\n"
|
||||
printf "(Ignore the port mentioned below and or above)\n\n\n"
|
||||
/statushq/rel/statushq/bin/statushq foreground
|
Loading…
x
Reference in New Issue
Block a user