make database optional
This commit is contained in:
parent
0b36204061
commit
21ab89946a
|
@ -8,6 +8,8 @@ LETS_ENCRYPT_ENV=production
|
|||
## Extensions you do NOT need, out of this list of installed extensions: https://github.com/adhocore/docker-phpfpm#php80
|
||||
#PHP_EXTENSIONS_TO_DISABLE="calendar"
|
||||
|
||||
# Optional database
|
||||
#COMPOSE_FILE="compose.yml:compose.mariadb.yml"
|
||||
SECRET_DB_ROOT_PASSWORD_VERSION=v1
|
||||
SECRET_DB_PASSWORD_VERSION=v1
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# custom-php
|
||||
|
||||
|
||||
Coöp Cloud + [PHP](https://php.org) + MariaDB + Nginx = 🥳
|
||||
Coöp Cloud + [PHP](https://php.org) + MariaDB (optional) + Nginx = 🥳
|
||||
|
||||
<!-- metadata -->
|
||||
|
||||
|
@ -22,8 +22,10 @@ Coöp Cloud + [PHP](https://php.org) + MariaDB + Nginx = 🥳
|
|||
2. Deploy [`coop-cloud/traefik`][cc-traefik]
|
||||
3. `abra app new custom-php --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
|
||||
4. `abra app YOURAPPDOMAIN config`
|
||||
- be sure to change `$DOMAIN` to something that resolves to
|
||||
your Docker swarm box
|
||||
- if you need to enable the optional database, uncomment `COMPOSE_FILE="compose.yml:compose.mariadb.yml"`
|
||||
5. `abra app YOURAPPDOMAIN deploy`
|
||||
6. Copy your site files using something like: `abra app YOURAPPDOMAIN cp index.html app:/var/www/html/` or if you want to copy an entire directory: `tar cf - ./mysite | abra app YOURAPPDOMAIN cp - app:/var/www/html/`
|
||||
6. Use [restore functionality](https://docs.coopcloud.tech/backup-restore/) to import a SQL file into the db
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
version: "3.8"
|
||||
services:
|
||||
app:
|
||||
environment:
|
||||
- DB_HOST=db
|
||||
- DB_USER=site
|
||||
- DB_PASSWORD_FILE=/run/secrets/db_password
|
||||
- DB_NAME=site
|
||||
secrets:
|
||||
- db_password
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
image: "mariadb:10.6"
|
||||
volumes:
|
||||
- "mariadb:/var/lib/mysql"
|
||||
networks:
|
||||
- internal
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
|
||||
- MYSQL_DATABASE=site
|
||||
- MYSQL_USER=site
|
||||
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
||||
secrets:
|
||||
- db_password
|
||||
- db_root_password
|
||||
deploy:
|
||||
labels: ['coop-cloud.${STACK_NAME}.db.version=10.6-718cb856']
|
||||
volumes:
|
||||
mariadb:
|
||||
secrets:
|
||||
db_root_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
|
||||
db_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
32
compose.yml
32
compose.yml
|
@ -7,13 +7,7 @@ services:
|
|||
networks:
|
||||
- internal
|
||||
environment:
|
||||
- DB_HOST=db
|
||||
- DB_USER=site
|
||||
- DB_PASSWORD_FILE=/run/secrets/db_password
|
||||
- DB_NAME=site
|
||||
- PHP_EXTENSIONS_TO_DISABLE
|
||||
secrets:
|
||||
- db_password
|
||||
configs:
|
||||
- source: php_uploads_conf
|
||||
target: /usr/local/etc/php/conf.d/uploads.ini
|
||||
|
@ -21,8 +15,6 @@ services:
|
|||
# target: /docker-entrypoint.sh
|
||||
# mode: 0555
|
||||
# entrypoint: /docker-entrypoint.sh
|
||||
depends_on:
|
||||
- db
|
||||
deploy:
|
||||
update_config:
|
||||
failure_action: rollback
|
||||
|
@ -63,37 +55,13 @@ services:
|
|||
# timeout: 10s
|
||||
# retries: 10
|
||||
# start_period: 1m
|
||||
db:
|
||||
image: "mariadb:10.6"
|
||||
volumes:
|
||||
- "mariadb:/var/lib/mysql"
|
||||
networks:
|
||||
- internal
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
|
||||
- MYSQL_DATABASE=site
|
||||
- MYSQL_USER=site
|
||||
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
||||
secrets:
|
||||
- db_password
|
||||
- db_root_password
|
||||
deploy:
|
||||
labels: ['coop-cloud.${STACK_NAME}.db.version=10.6-718cb856']
|
||||
networks:
|
||||
internal:
|
||||
internal: true
|
||||
proxy:
|
||||
external: true
|
||||
volumes:
|
||||
mariadb:
|
||||
site_content:
|
||||
secrets:
|
||||
db_root_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
|
||||
db_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
||||
configs:
|
||||
entrypoint_conf:
|
||||
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
|
||||
|
|
Reference in New Issue