Compare commits

..

No commits in common. "master" and "0b3620406107c942aa65044c0f3b4548f16203ee" have entirely different histories.

6 changed files with 43 additions and 64 deletions

View File

@ -5,16 +5,9 @@ DOMAIN=example.com
#EXTRA_DOMAINS=', `www.example.com`' #EXTRA_DOMAINS=', `www.example.com`'
LETS_ENCRYPT_ENV=production LETS_ENCRYPT_ENV=production
ROOT_PATH=/var/www/html ## Extensions you do NOT need, out of this list of installed extensions: https://github.com/adhocore/docker-phpfpm#php80
PHP_VERSION=7.4 #PHP_EXTENSIONS_TO_DISABLE="calendar"
# environment for PHP frameworks like laravel/symphony
APP_ENV=prod
## Extra extensions you need
#PHP_EXTENSIONS="calendar"
# Optional database
#COMPOSE_FILE="compose.yml:compose.mariadb.yml"
SECRET_DB_ROOT_PASSWORD_VERSION=v1 SECRET_DB_ROOT_PASSWORD_VERSION=v1
SECRET_DB_PASSWORD_VERSION=v1 SECRET_DB_PASSWORD_VERSION=v1

View File

@ -1,7 +1,7 @@
# custom-php # custom-php
Coöp Cloud + [PHP](https://php.org) + MariaDB (optional) + Nginx = 🥳 Coöp Cloud + [PHP](https://php.org) + MariaDB + Nginx = 🥳
<!-- metadata --> <!-- metadata -->
@ -22,16 +22,10 @@ Coöp Cloud + [PHP](https://php.org) + MariaDB (optional) + Nginx = 🥳
2. Deploy [`coop-cloud/traefik`][cc-traefik] 2. Deploy [`coop-cloud/traefik`][cc-traefik]
3. `abra app new custom-php --secrets` (optionally with `--pass` if you'd like 3. `abra app new custom-php --secrets` (optionally with `--pass` if you'd like
to save secrets in `pass`) to save secrets in `pass`)
4. `abra app YOURAPPDOMAIN config` 4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
- be sure to change `$DOMAIN` to something that resolves to
your Docker swarm box your Docker swarm box
- if you need to enable the optional database, uncomment `COMPOSE_FILE="compose.yml:compose.mariadb.yml"` in which case configure your site to load the DB credentials from env: 5. `abra app YOURAPPDOMAIN deploy`
- `getenv('DB_NAME');` 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/`
- `getenv('DB_HOST');`
- `getenv('DB_USER');`
- `@file_get_contents(getenv('DB_PASSWORD_FILE'));`
5. Deploy with `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 - -C my_site/path/here . | 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 6. Use [restore functionality](https://docs.coopcloud.tech/backup-restore/) to import a SQL file into the db
6. Open the configured domain in your browser to check all is good 6. Open the configured domain in your browser to check all is good

View File

@ -1,5 +1,4 @@
# export PHP_VERSION=7.4 export NGINX_DEFAULT_CONF_VERSION=v6
export NGINX_DEFAULT_CONF_VERSION=v7
export PHP_UPLOADS_CONF_VERSION=v3 export PHP_UPLOADS_CONF_VERSION=v3
export ENTRYPOINT_CONF_VERSION=v2 export ENTRYPOINT_CONF_VERSION=v2
export ENTRYPOINT_MAILRELAY_CONF_VERSION=v1 export ENTRYPOINT_MAILRELAY_CONF_VERSION=v1

View File

@ -1,37 +0,0 @@
version: "3.8"
services:
app:
environment:
- DB_HOST=${STACK_NAME}_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}

View File

@ -1,14 +1,19 @@
version: "3.8" version: "3.8"
services: services:
app: app:
image: php:${PHP_VERSION}-fpm-alpine3.13 image: php:8.0-fpm-alpine3.13
volumes: volumes:
- "site_content:/var/www/html/" - "site_content:/var/www/html/"
networks: networks:
- internal - internal
environment: environment:
- PHP_EXTENSIONS - DB_HOST=db
- APP_ENV - DB_USER=site
- DB_PASSWORD_FILE=/run/secrets/db_password
- DB_NAME=site
- PHP_EXTENSIONS_TO_DISABLE
secrets:
- db_password
configs: configs:
- source: php_uploads_conf - source: php_uploads_conf
target: /usr/local/etc/php/conf.d/uploads.ini target: /usr/local/etc/php/conf.d/uploads.ini
@ -16,12 +21,14 @@ services:
# target: /docker-entrypoint.sh # target: /docker-entrypoint.sh
# mode: 0555 # mode: 0555
# entrypoint: /docker-entrypoint.sh # entrypoint: /docker-entrypoint.sh
depends_on:
- db
deploy: deploy:
update_config: update_config:
failure_action: rollback failure_action: rollback
order: start-first order: start-first
labels: labels:
- coop-cloud.${STACK_NAME}.app.version=${PHP_VERSION}-92fac7ac - coop-cloud.${STACK_NAME}.app.version=8.0-92fac7ac
frontend: frontend:
image: nginx:1.19.2 image: nginx:1.19.2
networks: networks:
@ -50,20 +57,43 @@ services:
target: /etc/nginx/conf.d/default.conf target: /etc/nginx/conf.d/default.conf
environment: environment:
- STACK_NAME - STACK_NAME
- ROOT_PATH
# healthcheck: # healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost"] # test: ["CMD", "curl", "-f", "http://localhost"]
# interval: 30s # interval: 30s
# timeout: 10s # timeout: 10s
# retries: 10 # retries: 10
# start_period: 1m # 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: networks:
internal: internal:
internal: true internal: true
proxy: proxy:
external: true external: true
volumes: volumes:
mariadb:
site_content: 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: configs:
entrypoint_conf: entrypoint_conf:
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION} name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}

View File

@ -4,7 +4,7 @@ server {
listen [::]:80; listen [::]:80;
server_name localhost; server_name localhost;
root {{ env "ROOT_PATH" }}; root /var/www/html;
#charset koi8-r; #charset koi8-r;
#access_log /var/log/nginx/host.access.log main; #access_log /var/log/nginx/host.access.log main;