Initial checkin (mostly works)
This commit is contained in:
parent
d2f4fab740
commit
ac941a1c0c
21
.env.sample
21
.env.sample
@ -6,3 +6,24 @@ DOMAIN=phpbb.example.com
|
|||||||
#EXTRA_DOMAINS=', `www.phpbb.example.com`'
|
#EXTRA_DOMAINS=', `www.phpbb.example.com`'
|
||||||
|
|
||||||
LETS_ENCRYPT_ENV=production
|
LETS_ENCRYPT_ENV=production
|
||||||
|
|
||||||
|
PHPBB_USERNAME=admin
|
||||||
|
PHPBB_EMAIL=forum@example.com
|
||||||
|
PHPBB_FORUM_NAME=My Forum
|
||||||
|
PHPBB_FORUM_DESCRIPTION=A very nice forum
|
||||||
|
|
||||||
|
# PHPBB_COOKIE_SECURE=yes
|
||||||
|
|
||||||
|
# Can be enabled after initial startup?
|
||||||
|
# PHPBB_SKIP_BOOTSTRAP=yes
|
||||||
|
|
||||||
|
# Email setup
|
||||||
|
# PHPBB_SMTP_HOST=
|
||||||
|
# PHPBB_SMTP_PORT=
|
||||||
|
# PHPBB_SMTP_USER=
|
||||||
|
# Set SMTP password as the 'smtp_password' secret on the 'app' container.
|
||||||
|
|
||||||
|
|
||||||
|
SECRET_ADMIN_PASSWORD_VERSION=v1
|
||||||
|
SECRET_DB_PASSWORD_VERSION=v1
|
||||||
|
SECRET_DB_ROOT_PASSWORD_VERSION=v1
|
@ -1,12 +1,12 @@
|
|||||||
# phpbb
|
# phpbb
|
||||||
|
|
||||||
> One line description of the recipe
|
> The venerable, ancient php forum system, now in coöp cloud!
|
||||||
|
|
||||||
<!-- metadata -->
|
<!-- metadata -->
|
||||||
|
|
||||||
* **Category**: Apps
|
* **Category**: Apps
|
||||||
* **Status**: 0
|
* **Status**: 0
|
||||||
* **Image**: [`phpbb`](https://hub.docker.com/r/phpbb), 4, upstream
|
* **Image**: [`phpbb`](https://hub.docker.com/r/bitnami/phpbb/), 4, upstream
|
||||||
* **Healthcheck**: No
|
* **Healthcheck**: No
|
||||||
* **Backups**: No
|
* **Backups**: No
|
||||||
* **Email**: No
|
* **Email**: No
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
* `abra app new phpbb --secrets`
|
* `abra app new phpbb`
|
||||||
* `abra app config <app-name>`
|
* `abra app config <app-name>`
|
||||||
* `abra app deploy <app-name>`
|
* `abra app deploy <app-name>`
|
||||||
|
|
||||||
|
2
abra.sh
Normal file
2
abra.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export APP_ENTRYPOINT_VERSION=v0
|
||||||
|
export DB_ENTRYPOINT_VERSION=v0
|
89
compose.yml
89
compose.yml
@ -1,17 +1,41 @@
|
|||||||
---
|
---
|
||||||
|
# Heavily cribbed from https://raw.githubusercontent.com/bitnami/containers/main/bitnami/phpbb/docker-compose.yml
|
||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: nginx:1.20.0
|
image: bitnami/phpbb:3.3.10
|
||||||
networks:
|
networks:
|
||||||
- proxy
|
- proxy
|
||||||
|
- internal
|
||||||
|
environment:
|
||||||
|
- COOPCLOUD_ENTRYPOINT=/opt/bitnami/scripts/phpbb/entrypoint.sh
|
||||||
|
- COOPCLOUD_ENTRYPOINT_ORIGINAL=/opt/bitnami/scripts/phpbb/entrypoint.sh
|
||||||
|
- COOPCLOUD_LOAD_PHPBB_DATABASE_PASSWORD=/run/secrets/db_password
|
||||||
|
- COOPCLOUD_LOAD_PHPBB_PASSWORD=/run/secrets/admin_password
|
||||||
|
# - COOPCLOUD_LOAD_PHPBB_SMTP_PASSWORD=/run/secrets/smtp_password # you need to setup this secret fixme
|
||||||
|
- PHPBB_DATABASE_HOST=${STACK_NAME}_db
|
||||||
|
- PHPBB_DATABASE_USER=phpbb
|
||||||
|
- PHPBB_DATABASE_NAME=phpbb
|
||||||
|
- PHPBB_HOST=${DOBMAIN}
|
||||||
|
# User configurations
|
||||||
|
- PHPBB_USERNAME
|
||||||
|
- PHPBB_EMAIL
|
||||||
|
- PHPBB_FORUM_NAME
|
||||||
|
- PHPBB_FORUM_DESCRIPTION
|
||||||
|
- PHPBB_COOKIE_SECURE
|
||||||
|
- PHPBB_SKIP_BOOTSTRAP
|
||||||
|
- PHPBB_SMTP_HOST
|
||||||
|
- PHPBB_SMTP_PORT
|
||||||
|
- PHPBB_SMTP_USER
|
||||||
|
volumes:
|
||||||
|
- 'phpbb_data:/bitnami/phpbb'
|
||||||
deploy:
|
deploy:
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: on-failure
|
condition: on-failure
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8080"
|
||||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
||||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||||
@ -19,14 +43,71 @@ services:
|
|||||||
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
|
#- "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.SSLForceHost=true"
|
||||||
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
||||||
- "coop-cloud.${STACK_NAME}.version="
|
- "coop-cloud.${STACK_NAME}.version=0.1.0+3.3.10"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost"]
|
test: ["CMD", "curl", "-f", "http://localhost:8080"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 10
|
retries: 10
|
||||||
start_period: 1m
|
start_period: 1m
|
||||||
|
entrypoint: ["/coopcloud-entrypoint.sh", "/opt/bitnami/scripts/apache/run.sh"]
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
|
- admin_password
|
||||||
|
configs:
|
||||||
|
- source: app_entrypoint
|
||||||
|
target: /coopcloud-entrypoint.sh
|
||||||
|
mode: 0555
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: docker.io/bitnami/mariadb:10.6
|
||||||
|
networks:
|
||||||
|
- internal
|
||||||
|
environment:
|
||||||
|
- COOPCLOUD_ENTRYPOINT=/opt/bitnami/scripts/mariadb/entrypoint.sh
|
||||||
|
- COOPCLOUD_ENTRYPOINT_ORIGINAL=/opt/bitnami/scripts/mariadb/entrypoint.sh
|
||||||
|
- MARIADB_USER=phpbb
|
||||||
|
- MARIADB_DATABASE=phpbb
|
||||||
|
- COOPCLOUD_LOAD_MARIADB_ROOT_PASSWORD=/run/secrets/db_root_password
|
||||||
|
- COOPCLOUD_LOAD_MARIADB_PASSWORD=/run/secrets/db_password
|
||||||
|
entrypoint: ["/coopcloud-entrypoint.sh", "/opt/bitnami/scripts/mariadb/run.sh"]
|
||||||
|
configs:
|
||||||
|
- source: db_entrypoint
|
||||||
|
target: /coopcloud-entrypoint.sh
|
||||||
|
mode: 0555
|
||||||
|
secrets:
|
||||||
|
- db_password
|
||||||
|
- db_root_password
|
||||||
|
volumes:
|
||||||
|
- 'mariadb_data:/bitnami/mariadb'
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
db_password:
|
||||||
|
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||||
|
external: true
|
||||||
|
admin_password:
|
||||||
|
name: ${STACK_NAME}_admin_password_${SECRET_ADMIN_PASSWORD_VERSION}
|
||||||
|
external: true
|
||||||
|
db_root_password:
|
||||||
|
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
|
||||||
|
external: true
|
||||||
|
|
||||||
|
|
||||||
|
configs:
|
||||||
|
app_entrypoint:
|
||||||
|
name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION}
|
||||||
|
file: coopcloud-entrypoint.sh
|
||||||
|
db_entrypoint:
|
||||||
|
name: ${STACK_NAME}_db_entrypoint_${DB_ENTRYPOINT_VERSION}
|
||||||
|
file: coopcloud-entrypoint.sh
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mariadb_data:
|
||||||
|
phpbb_data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
proxy:
|
proxy:
|
||||||
external: true
|
external: true
|
||||||
|
internal:
|
||||||
|
107
coopcloud-entrypoint.sh
Executable file
107
coopcloud-entrypoint.sh
Executable file
@ -0,0 +1,107 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Configurations etc.
|
||||||
|
COOPCLOUD_MAX_LOAD_SIZE=1024
|
||||||
|
export COOPCLOUD_ENTRYPOINT_VERSION=0.1.0
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
logn () {
|
||||||
|
echo -n "[COOP]["$(date +%FT%T%Z)"]" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
log () {
|
||||||
|
logn "$@"
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
|
||||||
|
DOCS=$(cat <<-__DOCS__
|
||||||
|
|
||||||
|
EOF
|
||||||
|
Loading files into environment:
|
||||||
|
Max size is 1 kbyte, files larger than that will not be loaded.
|
||||||
|
|
||||||
|
Environment variables in the format COOPCLOUD_LOAD_<ENVIRONMENTNAME>=<FILENAME>; the contents of
|
||||||
|
<FILENAME> are loaded into <ENVIRONMENTNAME>
|
||||||
|
|
||||||
|
Startup Scripts:
|
||||||
|
Extra scripts included with the
|
||||||
|
|
||||||
|
Entrypoint:
|
||||||
|
The default entrypoint is communicated from the parent environment with COOPCLOUD_ENTRYPOINT; we expect
|
||||||
|
COOPCLOUD_ENTRYPOINT_ORIGINAL to be set also. If COOPCLOUD_ENTRYPOINT is being overriden for this execution,
|
||||||
|
this provides a fall-back and also can communicate to the child environment that the entrypoint has been
|
||||||
|
overriden.
|
||||||
|
|
||||||
|
__DOCS__
|
||||||
|
)
|
||||||
|
|
||||||
|
cat <<-__TURT__
|
||||||
|
.-=++++==-:
|
||||||
|
.=+***+*******+=.
|
||||||
|
=****++%+:+*******-
|
||||||
|
=#****:-+-.********+:
|
||||||
|
. .*****+.. .:*******+=.
|
||||||
|
=*-: .:****++=--=+*******=
|
||||||
|
=+*==+++-=#***++++++*******+=-
|
||||||
|
.+*++****==*****+++++++=++=++:
|
||||||
|
.-++++++-. :++******+=++**********++*+.
|
||||||
|
=**********: -=-+++******-+++++******++:
|
||||||
|
=#**++++****+ -===:=+++***-+%%#*+++++==+*++-.
|
||||||
|
.++*****-=****..====:*======**+*#%%%%%%#=******+=
|
||||||
|
=++***#--#**+::-==-+@=**#*+%%#**++*+**+-*******=
|
||||||
|
.=+++==-****=:-:==#@++%%%#+%##%%#%*=##*.:-----:
|
||||||
|
.-===+*****=:-:-%#+*%#%%*=#%%%##%=#%%-
|
||||||
|
-++++****+:-:=+=++##*+*#++**#%=+%%=
|
||||||
|
:=+++***=.=*****-=##%%%#**+-=*+-:
|
||||||
|
:-==+-+*******-*#####%%++*+=+#=
|
||||||
|
=********=-+++++=--==+***#-
|
||||||
|
.********+:.:::...-++******-
|
||||||
|
-********= :=+++***=-
|
||||||
|
.-**+**+: :===-:.
|
||||||
|
:. .=.
|
||||||
|
[HACK THE PLANET]
|
||||||
|
__TURT__
|
||||||
|
|
||||||
|
# echo that we're running the show
|
||||||
|
log "#### Coop Cloud Entrypoint $COOPCLOUD_ENTRYPOINT_VERSION ###"
|
||||||
|
|
||||||
|
# load specified files into environment variables
|
||||||
|
while read ENVIRON_VAR; do
|
||||||
|
file=${!ENVIRON_VAR}
|
||||||
|
logn "Loading $ENVIRON_VAR ($file)"
|
||||||
|
if test -e "$file"; then
|
||||||
|
# file exists!
|
||||||
|
fsize=$(wc -c < "$file")
|
||||||
|
if [ $fsize -lt $COOPCLOUD_MAX_LOAD_SIZE ]; then
|
||||||
|
target=$(echo $ENVIRON_VAR | cut -d_ -f3-)
|
||||||
|
val="$(cat $file)"
|
||||||
|
eval export $target=\"$val\"
|
||||||
|
echo " -> $target."
|
||||||
|
else
|
||||||
|
echo " File too big ($fsize bytes > $COOPCLOUD_MAX_LOAD_SIZE)."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " File Not Found."
|
||||||
|
fi
|
||||||
|
done < <(printenv |grep ^COOPCLOUD_LOAD_ | cut -d= -f1)
|
||||||
|
### fixme we should support some sort of startup script / 1st time script thing here
|
||||||
|
|
||||||
|
# warn about overridden entrypoint
|
||||||
|
if [ "$COOPCLOUD_ENTRYPOINT" != "$COOPCLOUD_ENTRYPOINT_ORIGINAL" ]; then
|
||||||
|
log "#### Warning: Entrypoint apparently overriden to $COOPCLOUD_ENTRYPOINT ####"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# call the specified entrypoint (if possible)
|
||||||
|
if [ ! -x "$COOPCLOUD_ENTRYPOINT" ]; then
|
||||||
|
log "$COOPCLOUD_ENTRYPOINT cannot be executed."
|
||||||
|
if [ -x "$COOPCLOUD_ENTRYPOINT_ORIGINAL" ]; then
|
||||||
|
log "Launching original entrypoint ..."
|
||||||
|
echo ""
|
||||||
|
exec $COOPCLOUD_ENTRYPOINT_ORIGINAL
|
||||||
|
else
|
||||||
|
log "$COOPCLOUD_ENTRYPOINT_ORIGINAL cannot be executed. Giving up."
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
log "Launching entrypoint ..."
|
||||||
|
exec $COOPCLOUD_ENTRYPOINT "$@"
|
Loading…
x
Reference in New Issue
Block a user