initial commit
This commit is contained in:
30
.env.sample
Normal file
30
.env.sample
Normal file
@ -0,0 +1,30 @@
|
||||
TYPE=szurubooru
|
||||
|
||||
# Database credentials
|
||||
POSTGRES_USER=szuru
|
||||
|
||||
# This shows up on the homescreen, indicating build information
|
||||
BUILD_INFO=latest
|
||||
|
||||
# Port to expose HTTP service
|
||||
# Set to 127.0.0.1:8080 if you wish to reverse-proxy the docker's port,
|
||||
# otherwise the port specified here will be publicly accessible
|
||||
PORT=8080
|
||||
|
||||
# How many waitress threads to start
|
||||
# 4 is the default amount of threads. If you experience performance
|
||||
# degradation with a large number of posts, increasing this may
|
||||
# improve performance, since waitress is most likely clogging up with Tasks.
|
||||
THREADS=4
|
||||
|
||||
# URL base to run szurubooru under
|
||||
# See "Additional Features" section in INSTALL.md
|
||||
BASE_URL=/
|
||||
|
||||
# Directory to store image data
|
||||
MOUNT_DATA=/var/local/szurubooru/data
|
||||
|
||||
# Directory to store database files
|
||||
MOUNT_SQL=/var/local/szurubooru/sql
|
||||
SECRET_DB_PASSWORD_VERSION: v1
|
||||
SECRET_SMTP_PASSWORD_VERSION: v1
|
2
abra.sh
Normal file
2
abra.sh
Normal file
@ -0,0 +1,2 @@
|
||||
export SERVER_CONFIG_VERSION=v1
|
||||
export SERVER_ENTRYPOINT_VERSION=v1
|
76
compose.yml
Normal file
76
compose.yml
Normal file
@ -0,0 +1,76 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
app:
|
||||
image: szurubooru/client:2.5
|
||||
depends_on:
|
||||
- server
|
||||
environment:
|
||||
- BACKEND_HOST=server
|
||||
- BASE_URL
|
||||
volumes:
|
||||
- app:/data:ro
|
||||
deploy:
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=proxy"
|
||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
|
||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||
- "coop-cloud.${STACK_NAME}.version=0.0.1+2.5"
|
||||
|
||||
server:
|
||||
image: szurubooru/server:2.5
|
||||
depends_on:
|
||||
- sql
|
||||
volumes:
|
||||
- server:/data
|
||||
- "./config.yaml:/opt/app/config.yaml"
|
||||
configs:
|
||||
- source: server_config
|
||||
target: /opt/app/config.yaml
|
||||
- source: server_entrypoint
|
||||
target: /docker-entrypoint.sh
|
||||
mode: 0555
|
||||
secrets:
|
||||
- db_password
|
||||
- smtp_password
|
||||
environment:
|
||||
- POSTGRES_HOST=sql
|
||||
- POSTGRES_USER=${DB_USER}
|
||||
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
|
||||
- THREADS
|
||||
|
||||
sql:
|
||||
image: postgres:11-alpine
|
||||
secrets:
|
||||
- db_password
|
||||
environment:
|
||||
- POSTGRES_USER=${DB_USER}
|
||||
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
|
||||
configs:
|
||||
server_config:
|
||||
name: ${STACK_NAME}_server_config_${SERVER_CONFIG_VERSION}
|
||||
file: server.conf.tml
|
||||
template_driver: golang
|
||||
server_entrypoint:
|
||||
name: ${STACK_NAME}_server_entrypoint_${SERVER_ENTRYPOINT_VERSION}
|
||||
file: entrypoint.sh.tmpl
|
||||
template_driver: golang
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||
smtp_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_smtp_password_${SECRET_SMTP_PASSWORD_VERSION}
|
||||
|
||||
volumes:
|
||||
app:
|
||||
server:
|
||||
postgres:
|
28
entrypoint.sh.tmpl
Normal file
28
entrypoint.sh.tmpl
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
file_env() {
|
||||
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"
|
||||
}
|
||||
|
||||
# for sidekiq service bundle exec env var threading
|
||||
file_env "SMTP_PASSWORD"
|
||||
file_env "DB_PASSWORD"
|
11
server.conf.tmpl
Normal file
11
server.conf.tmpl
Normal file
@ -0,0 +1,11 @@
|
||||
name: $NAME
|
||||
domain: $DOMAIN
|
||||
smtp:
|
||||
host: $SMTP_HOST
|
||||
port: $SMTP_PORT
|
||||
user: $SMTP_USER
|
||||
pass: {{ secret "smtp_password" }}
|
||||
from: $SMTP_FROM
|
||||
|
||||
contact_email: $CONTACT_EMAIL
|
||||
|
Reference in New Issue
Block a user