mirror of
https://memleak.eu/sn0w/pleroma-docker.git
synced 2024-12-22 00:38:48 -05:00
Use m4 to make the docker-compose file less ugly
This commit is contained in:
parent
39f841ad57
commit
5f59cfd9ae
71
docker-compose.m4
Normal file
71
docker-compose.m4
Normal file
@ -0,0 +1,71 @@
|
||||
divert(-1)
|
||||
define(`upcase', `translit($1, `a-z', `A-Z')')
|
||||
define(`env', `upcase($1):${upcase($1):?upcase($1)}')
|
||||
define(`env_fb', `upcase($1):-$2')
|
||||
define(`env_inline', `${upcase($1):?upcase($1)}')
|
||||
divert(1)dnl
|
||||
|
||||
version: "3"
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: env_inline(`docker_network')
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:10.3-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
env(`postgres_db')
|
||||
env(`postgres_user')
|
||||
env(`postgres_password')
|
||||
volumes:
|
||||
- env_inline(`docker_datadir')/db:/var/lib/postgresql/data
|
||||
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./pleroma.dockerfile
|
||||
restart: unless-stopped
|
||||
links:
|
||||
- db
|
||||
environment:
|
||||
env(`postgres_ip', `db')
|
||||
env(`postgres_db')
|
||||
env(`postgres_user')
|
||||
env(`postgres_password')
|
||||
|
||||
env(`pleroma_url')
|
||||
env(`pleroma_scheme')
|
||||
env(`pleroma_port')
|
||||
env(`pleroma_secret_key_base')
|
||||
env(`pleroma_name')
|
||||
env(`pleroma_admin_email')
|
||||
env(`pleroma_user_limit')
|
||||
env(`pleroma_registrations_open')
|
||||
env(`pleroma_media_proxy_enabled')
|
||||
env(`pleroma_media_proxy_redirect_on_failure')
|
||||
env(`pleroma_media_proxy_url')
|
||||
|
||||
env_fb(`pleroma_workspace', `/pleroma')
|
||||
env_fb(`mix_archives', `/mix/archives')
|
||||
env_fb(`mix_home', `/mix/home')
|
||||
env_fb(`mix_env', `prod')
|
||||
volumes:
|
||||
- ./pleroma:/pleroma
|
||||
- env_inline(`docker_datadir')/pleroma:/data
|
||||
- env_inline(`docker_datadir')/mix:/mix
|
||||
- env_inline(`docker_datadir')/misc/cache:/root/.cache
|
||||
- env_inline(`docker_datadir')/misc/meta:/meta
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.fe.port: "4000"
|
||||
traefik.fe.protocol: "http"
|
||||
traefik.fe.entryPoints: "http,https"
|
||||
traefik.fe.frontend.rule: "Host:env_inline(`pleroma_url')"
|
||||
traefik.cache.port: "80"
|
||||
traefik.cache.protocol: "http"
|
||||
traefik.cache.entryPoints: "http,https"
|
||||
traefik.cache.frontend.rule: "Host:env_inline(`pleroma_media_proxy_url')"
|
||||
|
@ -1,64 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: ${DOCKER_NETWORK:?DOCKER_NETWORK}
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:10.3-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:?POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER:?POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- ${DOCKER_DATADIR:?DOCKER_DATADIR}/db:/var/lib/postgresql/data
|
||||
|
||||
server:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./pleroma.dockerfile
|
||||
restart: unless-stopped
|
||||
links:
|
||||
- db
|
||||
environment:
|
||||
POSTGRES_IP: db
|
||||
POSTGRES_DB: ${POSTGRES_DB:?POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER:?POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD}
|
||||
|
||||
PLEROMA_URL: ${PLEROMA_URL:?PLEROMA_URL}
|
||||
PLEROMA_SCHEME: ${PLEROMA_SCHEME:?PLEROMA_SCHEME}
|
||||
PLEROMA_PORT: ${PLEROMA_PORT:?PLEROMA_PORT}
|
||||
PLEROMA_SECRET_KEY_BASE: ${PLEROMA_SECRET_KEY_BASE:?PLEROMA_SECRET_KEY_BASE}
|
||||
PLEROMA_NAME: ${PLEROMA_NAME:?PLEROMA_NAME}
|
||||
PLEROMA_ADMIN_EMAIL: ${PLEROMA_ADMIN_EMAIL:?PLEROMA_ADMIN_EMAIL}
|
||||
PLEROMA_USER_LIMIT: ${PLEROMA_USER_LIMIT:?PLEROMA_USER_LIMIT}
|
||||
PLEROMA_REGISTRATIONS_OPEN: ${PLEROMA_REGISTRATIONS_OPEN:?PLEROMA_REGISTRATIONS_OPEN}
|
||||
PLEROMA_MEDIA_PROXY_ENABLED: ${PLEROMA_MEDIA_PROXY_ENABLED:?PLEROMA_MEDIA_PROXY_ENABLED}
|
||||
PLEROMA_MEDIA_PROXY_REDIRECT_ON_FAILURE: ${PLEROMA_MEDIA_PROXY_REDIRECT_ON_FAILURE:?PLEROMA_MEDIA_PROXY_REDIRECT_ON_FAILURE}
|
||||
PLEROMA_MEDIA_PROXY_URL: ${PLEROMA_MEDIA_PROXY_URL:?PLEROMA_MEDIA_PROXY_URL}
|
||||
|
||||
PLEROMA_WORKSPACE: /pleroma
|
||||
MIX_ARCHIVES: /mix/archives
|
||||
MIX_HOME: /mix/home
|
||||
MIX_ENV: prod
|
||||
volumes:
|
||||
- ./pleroma:/pleroma
|
||||
- ${DOCKER_DATADIR:?DOCKER_DATADIR}/pleroma:/data
|
||||
- ${DOCKER_DATADIR:?DOCKER_DATADIR}/mix:/mix
|
||||
- ${DOCKER_DATADIR:?DOCKER_DATADIR}/misc/cache:/root/.cache
|
||||
- ${DOCKER_DATADIR:?DOCKER_DATADIR}/misc/meta:/meta
|
||||
labels:
|
||||
traefik.enable: "true"
|
||||
traefik.fe.port: "4000"
|
||||
traefik.fe.protocol: "http"
|
||||
traefik.fe.entryPoints: "http,https"
|
||||
traefik.fe.frontend.rule: "Host:${PLEROMA_URL:?PLEROMA_URL}"
|
||||
traefik.cache.port: "80"
|
||||
traefik.cache.protocol: "http"
|
||||
traefik.cache.entryPoints: "http,https"
|
||||
traefik.cache.frontend.rule: "Host:${PLEROMA_MEDIA_PROXY_URL:?PLEROMA_MEDIA_PROXY_URL}"
|
||||
|
16
pleroma.sh
16
pleroma.sh
@ -47,26 +47,42 @@ function run_dockerized {
|
||||
docker-compose down
|
||||
}
|
||||
|
||||
function action__pre {
|
||||
m4 docker-compose.m4 > docker-compose.yml
|
||||
}
|
||||
|
||||
function action__post {
|
||||
rm docker-compose.yml
|
||||
}
|
||||
|
||||
function action__build {
|
||||
action__pre
|
||||
run_dockerized "build"
|
||||
log_ok "Done"
|
||||
action__post
|
||||
}
|
||||
|
||||
function action__configure {
|
||||
action__pre
|
||||
run_dockerized "configure"
|
||||
log_ok "Done"
|
||||
action__post
|
||||
}
|
||||
|
||||
function action__run {
|
||||
action__pre
|
||||
log_info "Booting pleroma..."
|
||||
docker-compose up --remove-orphans -d
|
||||
log_ok "Done"
|
||||
action__post
|
||||
}
|
||||
|
||||
function action__stop {
|
||||
action__pre
|
||||
log_info "Stopping pleroma..."
|
||||
docker-compose down
|
||||
log_ok "Done"
|
||||
action__post
|
||||
}
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user