Further thrasing with env var and config passing

This commit is contained in:
Luke Murphy 2020-11-01 10:35:30 +01:00
parent 3818e945c9
commit 10137f355b
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
4 changed files with 96 additions and 19 deletions

View File

@ -1 +1,37 @@
export FOODSOFT_VERSION=4.7.0 export APP=foodsoft
export DOMAIN=order.biobulkbende.org
export LETS_ENCRYPT_ENV=production
export FOODCOOP_NAME=biobulkbende
export FOODCOOP_CITY=Rotterdam
export FOODCOOP_COUNTRY=The Netherlands
export FOODCOOP_EMAIL=info@biobulkbende.org
export FOODCOOP_PHONE="+31684233964"
export FOODCOOP_STREET="Almondestraat 157"
export FOODCOOP_ZIP_CODE=3032CD
export FOODCOOP_HOMEPAGE=https://order.biobulkbende.org
export FOODCOOP_HELP_URL=https://order.biobulkbende.org
export FOODCOOP_TIME_ZONE=Amsterdam
export FOODCOOP_FOOTER="<a href="https://biobulkbende.org/">Biobulkbende</a> hosted by <a href="https://autonomic.zone">Autonomic Cooperative</a>."
export MYSQL_NAME=foodsoft
export MYSQL_HOST=mariadb
export MYSQL_PORT=3306
export MYSQL_USER=foodsoft
export EMAIL_SENDER=foodsoft@biobulkbende.org
export EMAIL_REPLY=foodsoft@biobulkbende.org
export ERROR_EMAIL=systems@biobulkbende.org
export SHARED_LISTS_DB_TYPE=mysql2
export SHARED_LISTS_HOST=order.voedselcollectief.org
export SHARED_LISTS_DB_NAME=sharedlists
export SHARED_LISTS_USER=biobulkbende
export DB_PASSWORD_VERSION=v1
export DB_ROOT_PASSWD_VERSION=v1
export SHARED_LISTS_DB_PASSWD_VERSION=v1
export APP_CONFIG_VERSION=v1
export DB_CONFIG_VERSION=v1

View File

@ -121,10 +121,10 @@ default: &defaults
# ...... # ......
# email address to be used as sender # email address to be used as sender
email_sender: "{{ env "FOODCOOP_EMAIL_SENDER" }}" email_sender: "{{ env "EMAIL_SENDER" }}"
# domain to be used for reply emails # domain to be used for reply emails
reply_email_domain: "{{ env "FOODCOOP_EMAIL_REPLY" }}" reply_email_domain: "{{ env "EMAIL_REPLY" }}"
# If your foodcoop uses a mailing list instead of internal messaging system # If your foodcoop uses a mailing list instead of internal messaging system
#mailing_list: list@example.org #mailing_list: list@example.org
@ -133,13 +133,13 @@ default: &defaults
# Config for the exception_notification plugin # Config for the exception_notification plugin
notification: notification:
error_recipients: error_recipients:
- "{{ env "FOODCOOP_ERROR_MAIL" }}" - "{{ env "EMAIL_ERROR" }}"
sender_address: "\"Foodsoft Error\" <{{ env "FOODCOP_EMAIL_SENDER" }}>" sender_address: "\"Foodsoft Error\" <{{ env "EMAIL_SENDER" }}>"
email_prefix: "[Foodsoft]" email_prefix: "[Foodsoft]"
# http config for this host to generate links in emails (uses environment config when not set) # http config for this host to generate links in emails (uses environment config when not set)
protocol: https protocol: https
host: "{{ env "FOODCOOP_HOST" }}" host: "{{ env "DOMAIN" }}"
#port: 3000 #port: 3000
# Access to sharedlists, the external article-database. # Access to sharedlists, the external article-database.
@ -147,11 +147,11 @@ default: &defaults
# and makes it possible to share data with several foodcoops. Using this requires installing # and makes it possible to share data with several foodcoops. Using this requires installing
# an additional application with a separate database. # an additional application with a separate database.
shared_lists: shared_lists:
adapter: "{{ env "FOODCOOP_SHARED_LISTS_DB_TYPE" }}" adapter: "{{ env "SHARED_LISTS_DB_TYPE" }}"
host: "{{ env "FOODCOOP_SHARED_LISTS_HOST" }}" host: "{{ env "SHARED_LISTS_HOST" }}"
database: "{{ env "FOODCOOP_SHARED_LISTS_DB_NAME" }}" database: "{{ env "SHARED_LISTS_DB_NAME" }}"
username: "{{ env "FOODCOOP_SHARED_LISTS_USERNAME" }}" username: "{{ env "SHARED_LISTS_USER" }}"
password: "{{ secret "shared_lists_db_password" }}" password: "{{ secret "shared_lists_db_passwd" }}"
# don't remove this, required to run the app # don't remove this, required to run the app
production: production:

View File

@ -3,10 +3,37 @@ version: "3.8"
services: services:
app: app:
image: foodcoops/foodsoft:${FOODSOFT_VERSION} image: "foodcoops/foodsoft:4.7.0"
networks: networks:
- internal - internal
- proxy - proxy
secrets:
- db_passwd
- shared_lists_db_passwd
environment:
- DOMAIN
- EMAIL_ERROR
- EMAIL_REPLY
- EMAIL_SENDER
- FOODCOOP_CITY
- FOODCOOP_COUNTRY
- FOODCOOP_EMAIL
- FOODCOOP_FOOTER
- FOODCOOP_HELP_URL
- FOODCOOP_HOMEPAGE
- FOODCOOP_NAME
- FOODCOOP_PHONE
- FOODCOOP_STREET
- FOODCOOP_TIME_ZONE
- FOODCOOP_ZIP_CODE
- MYSQL_HOST=db
- MYSQL_NAME=foodsoft
- MYSQL_PORT=3306
- MYSQL_USER=foodsoft
- SHARED_LISTS_DB_NAME
- SHARED_LISTS_DB_TYPE
- SHARED_LISTS_HOST
- SHARED_LISTS_USER
deploy: deploy:
update_config: update_config:
failure_action: rollback failure_action: rollback
@ -16,16 +43,16 @@ services:
- "traefik.http.routers.foodsoft.rule=Host(`${DOMAIN}`)" - "traefik.http.routers.foodsoft.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.foodsoft.entrypoints=web-secure" - "traefik.http.routers.foodsoft.entrypoints=web-secure"
- "traefik.http.services.foodsoft.loadbalancer.server.port=3000" - "traefik.http.services.foodsoft.loadbalancer.server.port=3000"
- "traefik.http.routers.foodsoft.tls.certresolver=production" - "traefik.http.routers.foodsoft.tls.certresolver=${LETS_ENCRYPT_ENV}"
cron: cron:
image: foodcoops/foodsoft:${FOODSOFT_VERSION} image: "foodcoops/foodsoft:4.7.0"
command: ./proc-start cron command: ./proc-start cron
networks: networks:
- internal - internal
worker: worker:
image: foodcoops/foodsoft:${FOODSOFT_VERSION} image: "foodcoops/foodsoft:4.7.0"
command: ./proc-start worker command: ./proc-start worker
networks: networks:
- internal - internal
@ -48,7 +75,7 @@ services:
- internal - internal
cache: cache:
image: redis:6 image: "redis:6"
networks: networks:
internal: internal:
@ -60,14 +87,21 @@ volumes:
configs: configs:
app_config: app_config:
name: ${APP_CONFIG_VERSION} name: ${STACK_NAME}_app_config_${APP_CONFIG_VERSION}
file: app_config.yml.tmpl file: app_config.yml.tmpl
template_driver: golang template_driver: golang
db_config:
name: ${STACK_NAME}_db_config_${DB_CONFIG_VERSION}
file: database.yml.tmpl
template_driver: golang
secrets: secrets:
db_passwd: db_passwd:
name: ${DB_PASSWD_VERSION} name: ${STACK_NAME}_db_passwd_${DB_PASSWORD_VERSION}
external: true external: true
db_root_passwd: db_root_passwd:
name: ${DB_ROOT_PASSWD_VERSION} name: ${STACK_NAME}_db_root_passwd_${DB_ROOT_PASSWD_VERSION}
external: true
shared_lists_db_passwd:
name: ${STACK_NAME}_shared_lists_db_passwd_${SHARED_LISTS_DB_PASSWD_VERSION}
external: true external: true

7
database.yml.tmpl Normal file
View File

@ -0,0 +1,7 @@
production:
adapter: mysql2
database: "{{ env "MYSQL_NAME" }}"
host: "{{ env "MYSQL_HOST" }}"
password: "{{ secret "db_passwd" }}"
port: "{{ env "MYSQL_PORT" }}"
username: "{{ env "MYSQL_USER" }}"