mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-11-18 19:16:27 +00:00
Compare commits
3 Commits
d66ad37c5d
...
493d5bbbda
| Author | SHA1 | Date | |
|---|---|---|---|
| 493d5bbbda | |||
| 2fcbae8fc7 | |||
| 02f38d60db |
@@ -15,6 +15,7 @@ location {{location}}
|
|||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_set_header X-Forwarded-Port {{ WEB_PORT }};
|
proxy_set_header X-Forwarded-Port {{ WEB_PORT }};
|
||||||
|
proxy_set_header X-Forwarded-Ssl on;
|
||||||
proxy_pass_request_headers on;
|
proxy_pass_request_headers on;
|
||||||
|
|
||||||
{% include 'roles/sys-svc-proxy/templates/headers/content_security_policy.conf.j2' %}
|
{% include 'roles/sys-svc-proxy/templates/headers/content_security_policy.conf.j2' %}
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ server:
|
|||||||
connect-src:
|
connect-src:
|
||||||
- https://q.clarity.ms
|
- https://q.clarity.ms
|
||||||
- https://n.clarity.ms
|
- https://n.clarity.ms
|
||||||
|
- https://z.clarity.ms
|
||||||
- "data:"
|
- "data:"
|
||||||
style-src-elem: []
|
style-src-elem: []
|
||||||
font-src: []
|
font-src: []
|
||||||
frame-ancestors: []
|
frame-ancestors: []
|
||||||
flags:
|
flags:
|
||||||
style-src-attr:
|
style-src-attr:
|
||||||
|
|||||||
7
roles/web-app-shopware/files/framework.yaml
Normal file
7
roles/web-app-shopware/files/framework.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
framework:
|
||||||
|
trusted_proxies: '%env(TRUSTED_PROXIES)%'
|
||||||
|
trusted_headers:
|
||||||
|
- x-forwarded-for
|
||||||
|
- x-forwarded-proto
|
||||||
|
- x-forwarded-host
|
||||||
|
- x-forwarded-port
|
||||||
@@ -29,8 +29,14 @@ if [ "$(id -u)" -eq 0 ]; then
|
|||||||
"$APP_ROOT/var"
|
"$APP_ROOT/var"
|
||||||
|
|
||||||
log "Fixing permissions on shared volumes..."
|
log "Fixing permissions on shared volumes..."
|
||||||
chown -R www-data:www-data "$APP_ROOT/public" "$APP_ROOT/var" || true
|
chown -R www-data:www-data \
|
||||||
chmod -R 775 "$APP_ROOT/public" "$APP_ROOT/var" || true
|
"$APP_ROOT/public" \
|
||||||
|
"$APP_ROOT/var" \
|
||||||
|
"$APP_ROOT/.infinito" || true
|
||||||
|
chmod -R 775 \
|
||||||
|
"$APP_ROOT/public" \
|
||||||
|
"$APP_ROOT/var" \
|
||||||
|
"$APP_ROOT/.infinito" || true
|
||||||
|
|
||||||
# Switch to www-data for all subsequent operations
|
# Switch to www-data for all subsequent operations
|
||||||
exec su -s /bin/sh www-data "$0" "$@"
|
exec su -s /bin/sh www-data "$0" "$@"
|
||||||
|
|||||||
@@ -14,6 +14,14 @@
|
|||||||
- docker compose up
|
- docker compose up
|
||||||
- docker compose build
|
- docker compose build
|
||||||
|
|
||||||
|
- name: "Render framework.yaml (trusted proxies/headers/hosts)"
|
||||||
|
copy:
|
||||||
|
src: "framework.yaml"
|
||||||
|
dest: "{{ SHOPWARE_FRAMEWORK_HOST }}"
|
||||||
|
mode: "0644"
|
||||||
|
notify:
|
||||||
|
- docker compose up
|
||||||
|
|
||||||
- name: "Flush docker compose handlers"
|
- name: "Flush docker compose handlers"
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
|
||||||
|
|||||||
@@ -76,12 +76,5 @@ RUN set -eux; \
|
|||||||
/var/www/html/public/theme; \
|
/var/www/html/public/theme; \
|
||||||
chown -R www-data:www-data /var/www/html
|
chown -R www-data:www-data /var/www/html
|
||||||
|
|
||||||
# Add trusted proxies wiring (Symfony reads env TRUSTED_PROXIES)
|
|
||||||
RUN set -eux; \
|
|
||||||
mkdir -p /var/www/html/config/packages; \
|
|
||||||
if [ ! -f /var/www/html/config/packages/framework.yaml ]; then \
|
|
||||||
printf "framework:\n trusted_proxies: '%%env(TRUSTED_PROXIES)%%'\n" > /var/www/html/config/packages/framework.yaml; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Drop back to the app user
|
# Drop back to the app user
|
||||||
USER www-data
|
USER www-data
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ x-environment: &shopware
|
|||||||
- sitemap:/var/www/html/public/sitemap
|
- sitemap:/var/www/html/public/sitemap
|
||||||
- "{{ SHOPWARE_INIT_HOST }}:{{ SHOPWARE_INIT_DOCKER }}:ro"
|
- "{{ SHOPWARE_INIT_HOST }}:{{ SHOPWARE_INIT_DOCKER }}:ro"
|
||||||
- bundles:/var/www/html/public/bundles
|
- bundles:/var/www/html/public/bundles
|
||||||
|
- "{{ SHOPWARE_FRAMEWORK_HOST }}:{{ SHOPWARE_FRAMEWORK_DOCKER }}:ro"
|
||||||
working_dir: {{ SHOPWARE_ROOT }}
|
working_dir: {{ SHOPWARE_ROOT }}
|
||||||
|
|
||||||
{% include 'roles/docker-compose/templates/base.yml.j2' %}
|
{% include 'roles/docker-compose/templates/base.yml.j2' %}
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
# DOMAIN/URL
|
# DOMAIN/URL
|
||||||
DOMAIN={{ domains | get_domain(application_id) }}
|
DOMAIN={{ SHOPWARE_DOMAIN }}
|
||||||
APP_URL="{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
|
APP_URL="{{ domains | get_url(application_id, WEB_PROTOCOL) }}"
|
||||||
APP_DEBUG="{{ MODE_DEBUG | ternary(1, 0) }}"
|
APP_DEBUG="{{ MODE_DEBUG | ternary(1, 0) }}"
|
||||||
|
|
||||||
# Shopware
|
# Shopware
|
||||||
APP_ENV={{ 'dev' if (ENVIRONMENT | lower) == 'development' else 'prod' }}
|
APP_ENV={{ 'dev' if (ENVIRONMENT | lower) == 'development' else 'prod' }}
|
||||||
TRUSTED_PROXIES=*
|
|
||||||
INSTANCE_ID={{ application_id }}
|
INSTANCE_ID={{ application_id }}
|
||||||
|
|
||||||
|
# Proxy
|
||||||
|
TRUSTED_PROXIES="{{ networks.internet.values() | select | join(',') }},127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
|
||||||
|
TRUSTED_HOSTS="{{ SHOPWARE_DOMAIN }}"
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DATABASE_URL="mysql://{{ database_username }}:{{ database_password }}@{{ database_host }}:{{ database_port }}/{{ database_name }}"
|
DATABASE_URL="mysql://{{ database_username }}:{{ database_password }}@{{ database_host }}:{{ database_port }}/{{ database_name }}"
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ entity_name: "{{ application_id | get_entity_name }}"
|
|||||||
container_port: "{{ applications | get_app_conf(application_id, 'docker.services.web.port') }}"
|
container_port: "{{ applications | get_app_conf(application_id, 'docker.services.web.port') }}"
|
||||||
docker_compose_flush_handlers: true
|
docker_compose_flush_handlers: true
|
||||||
|
|
||||||
|
SHOPWARE_DOMAIN: "{{ domains | get_domain(application_id) }}"
|
||||||
|
|
||||||
# Shopware container/image vars
|
# Shopware container/image vars
|
||||||
SHOPWARE_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.shopware.version') }}"
|
SHOPWARE_VERSION: "{{ applications | get_app_conf(application_id, 'docker.services.shopware.version') }}"
|
||||||
SHOPWARE_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.shopware.image') }}"
|
SHOPWARE_IMAGE: "{{ applications | get_app_conf(application_id, 'docker.services.shopware.image') }}"
|
||||||
@@ -22,6 +24,8 @@ SHOPWARE_WORKER_CONTAINER: "{{ applications | get_app_conf(application_id,
|
|||||||
SHOPWARE_SCHED_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.scheduler.name') }}"
|
SHOPWARE_SCHED_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.scheduler.name') }}"
|
||||||
SHOPWARE_INIT_HOST: "{{ [ docker_compose.directories.volumes, 'init.sh' ] | path_join }}"
|
SHOPWARE_INIT_HOST: "{{ [ docker_compose.directories.volumes, 'init.sh' ] | path_join }}"
|
||||||
SHOPWARE_INIT_DOCKER: "/usr/local/bin/init.sh"
|
SHOPWARE_INIT_DOCKER: "/usr/local/bin/init.sh"
|
||||||
|
SHOPWARE_FRAMEWORK_HOST: "{{ [ docker_compose.directories.config, 'framework.yaml' ] | path_join }}"
|
||||||
|
SHOPWARE_FRAMEWORK_DOCKER: "/var/www/html/config/packages/framework.yaml"
|
||||||
|
|
||||||
# Entrypoints & replicas
|
# Entrypoints & replicas
|
||||||
SHOPWARE_WORKER_ENTRYPOINT: "{{ applications | get_app_conf(application_id, 'docker.services.worker.entrypoint') }}"
|
SHOPWARE_WORKER_ENTRYPOINT: "{{ applications | get_app_conf(application_id, 'docker.services.worker.entrypoint') }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user