From 6ea0ba068951ca55e285ccbef5ac0fc1e60f639b Mon Sep 17 00:00:00 2001 From: Bartosz Juraszewski Date: Tue, 1 Mar 2022 14:50:32 +0100 Subject: [PATCH] Added local silverbox instance --- .env.example | 3 ++- docker-compose.yaml | 18 ++++++++++++++++++ docker/nginx/default.conf.template | 14 +++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 9045d3230..34e17f75e 100644 --- a/.env.example +++ b/.env.example @@ -35,7 +35,7 @@ EMAIL_PASSWORD=secret EMAIL_ADDRESS=example@example.com EMAIL_NAME=Store -SILVERBOX_HOST=https://cdn.example.com +SILVERBOX_HOST=silverbox.localhost SILVERBOX_CLIENT=heseya SILVERBOX_KEY=secret @@ -68,6 +68,7 @@ PAYU_URL=https://secure.payu.com DOCKER_PORT=80 DOCKER_ADMINER_PREFIX=adminer +DOCKER_SILVERBOX_PREFIX=silverbox PAYPAL_SANDBOX=true PAYPAL_CLIENT_ID= diff --git a/docker-compose.yaml b/docker-compose.yaml index 91b8e630c..dd554987f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -47,3 +47,21 @@ services: - ${DOCKER_PORT}:80 environment: - ADMINER_PREFIX=${DOCKER_ADMINER_PREFIX} + - SILVERBOX_PREFIX=${DOCKER_SILVERBOX_PREFIX} + silverbox: + image: heseya/silverbox:1.2.0 + restart: unless-stopped + command: + - bash + - -c + - | + if [ ! -f "/usr/src/init" ]; then + php silverbox client:add ${SILVERBOX_CLIENT} ${SILVERBOX_KEY} + chown -R www-data:www-data storage + touch /usr/src/init + fi + exec apache2-foreground + networks: + default: + aliases: + - ${SILVERBOX_HOST} diff --git a/docker/nginx/default.conf.template b/docker/nginx/default.conf.template index f0c34713e..df0573fba 100644 --- a/docker/nginx/default.conf.template +++ b/docker/nginx/default.conf.template @@ -20,4 +20,16 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } -} \ No newline at end of file +} + +server { + listen 80; + server_name ${SILVERBOX_PREFIX}.*; + + location / { + proxy_pass http://silverbox:80; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +}