From fe61216f95208d419c4824296bb90b1c05711d74 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Wed, 6 Mar 2024 21:44:58 +0300 Subject: [PATCH 1/4] redis. Adding persistence. --- redis/.env.dist | 6 +++++- redis/data/.gitignore | 2 ++ redis/docker-compose.yml | 9 ++++----- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 redis/data/.gitignore diff --git a/redis/.env.dist b/redis/.env.dist index a4a2e70..5a5f99a 100644 --- a/redis/.env.dist +++ b/redis/.env.dist @@ -1,7 +1,11 @@ # https://hub.docker.com/_/redis # Uncomment to use directory binding instead of docker volume (almost always not needed) -#DATA_PATH=/some/path +HOST_DATA_DIR=./data +# https://redis.io/docs/management/persistence/#snapshotting +PERSISTENCE_PERIOD_SEC=60 +PERSISTENCE_MIN_OPS=1 +LOG_LEVEL=warning LOG_MAX_SIZE=5m LOG_MAX_FILE=5 diff --git a/redis/data/.gitignore b/redis/data/.gitignore new file mode 100644 index 0000000..a68d087 --- /dev/null +++ b/redis/data/.gitignore @@ -0,0 +1,2 @@ +/* +!/.gitignore diff --git a/redis/docker-compose.yml b/redis/docker-compose.yml index 646a8ce..22f0bdf 100644 --- a/redis/docker-compose.yml +++ b/redis/docker-compose.yml @@ -1,10 +1,13 @@ -version: '3.7' +version: '3.8' services: redis: # https://hub.docker.com/_/redis image: redis:alpine container_name: redis + command: "redis-server --save ${PERSISTENCE_PERIOD_SEC:-60} ${PERSISTENCE_MIN_OPS:-1} --loglevel ${LOG_LEVEL:-warning}" + volumes: + - "${HOST_DATA_DIR:-./data}:/data" ports: - "127.0.0.1:6379:6379/tcp" env_file: .env @@ -14,7 +17,3 @@ services: options: max-size: "${LOG_MAX_SIZE:-5m}" max-file: "${LOG_MAX_FILE:-5}" - -#volumes: -# redis_data: -# name: redis_data -- 2.43.5 From ed74e0aaa7d174aac347dc639f23b15f1ec511d3 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Wed, 6 Mar 2024 21:49:36 +0300 Subject: [PATCH 2/4] webhooksite. Adding stack draft. --- README.md | 1 + webhooksite/.env.dist | 25 +++++++++++++++++++++++++ webhooksite/docker-compose.yml | 33 +++++++++++++++++++++++++++++++++ webhooksite/nginx/webhook.conf | 28 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 webhooksite/.env.dist create mode 100644 webhooksite/docker-compose.yml create mode 100644 webhooksite/nginx/webhook.conf diff --git a/README.md b/README.md index 5958fdc..d98acdc 100644 --- a/README.md +++ b/README.md @@ -81,5 +81,6 @@ Not every stack is tested to fully work. | Tor OBFS4 Bridge | ✅ | `thetorproject/obfs4-bridge` | Tor OBFS4 Bridge for Tor blocking bypass. | [Website](https://community.torproject.org/relay/setup/bridge/), [Gitlab](https://gitlab.torproject.org/tpo/anti-censorship/docker-obfs4-bridge), [Manual](https://community.torproject.org/relay/setup/bridge/docker/) | | Tor Privoxy | ✅ | `registry.gitlab.com/skobkin/torproxy-obfs4` | Tor image with integrated privoxy and OBFS4 bridge support. | [Original image Github](https://github.com/dperson/torproxy), [OBFS4 support image Gitlab](https://gitlab.com/skobkin/torproxy-obfs4) | | Watchtower | ✅ | `containrrr/watchtower` | Docker container auto-update daemon. | [Website](https://containrrr.dev/watchtower/), [Github](https://github.com/containrrr/watchtower) | +| Webhook.site | | `webhooksite/webhook.site` | HTTP callback testing tool | [Website](https://webhook.site), [Github](https://github.com/webhooksite/webhook.site) | | Wireguard | ❌ Unfinished | `cmulk/wireguard-docker` | WireGuard VPN. | [Website](https://www.wireguard.com), [Image Github](https://github.com/cmulk/wireguard-docker) | | ~~Wordpress~~ | ❌ Unfinished | `wordpress` | Wordpress blogging platform. | [Webiste](https://wordpress.org), [SVN](https://build.trac.wordpress.org/browser) | diff --git a/webhooksite/.env.dist b/webhooksite/.env.dist new file mode 100644 index 0000000..d46984f --- /dev/null +++ b/webhooksite/.env.dist @@ -0,0 +1,25 @@ +# see https://hub.docker.com/r/webhooksite/webhook.site +# see https://github.com/webhooksite/webhook.site/blob/master/docker-compose.yml + +WEBUI_BIND_ADDR=127.0.0.1 +WEBUI_BIND_PORT=8391 + +ECHO_BIND_ADDR=0.0.0.0 +# Do not change unless you'll also change it in Nginx config +ECHO_BIND_PORT=6001 + +APP_ENV=prod +APP_DEBUG=false +APP_URL=http://domain.tld:80 +APP_LOG=errorlog +DB_CONNECTION=sqlite +REDIS_HOST=127.0.0.1 +REDIS_PORT=6379 +#REDIS_PASSWORD=null +BROADCAST_DRIVER=redis +CACHE_DRIVER=redis +QUEUE_DRIVER=redis +ECHO_HOST_MODE=path + +LOG_MAX_SIZE=5m +LOG_MAX_FILE=5 \ No newline at end of file diff --git a/webhooksite/docker-compose.yml b/webhooksite/docker-compose.yml new file mode 100644 index 0000000..3b13aa8 --- /dev/null +++ b/webhooksite/docker-compose.yml @@ -0,0 +1,33 @@ +# https://hub.docker.com/r/webhooksite/webhook.site +version: '3.8' + +services: + webhook: + image: "webhooksite/webhook.site" + container_name: webhook-site + command: "php artisan queue:work --daemon --tries=3 --timeout=10" + ports: + - "${WEBUI_BIND_ADDR}:${WEBUI_BIND_PORT}:80" + env_file: .env + restart: unless-stopped + logging: + driver: "json-file" + options: + max-size: "${LOG_MAX_SIZE:-5m}" + max-file: "${LOG_MAX_FILE:-5}" + + laravel-echo-server: + image: "webhooksite/laravel-echo-server" + ports: + - "${ECHO_BIND_ADDR:-127.0.0.1}:${ECHO_BIND_PORT:-6001}:${ECHO_BIND_PORT:-6001}" + environment: + - "LARAVEL_ECHO_SERVER_AUTH_HOST=http://webhook" + - "LARAVEL_ECHO_SERVER_HOST=${ECHO_BIND_ADDR:-0.0.0.0}" + - "LARAVEL_ECHO_SERVER_PORT=${ECHO_BIND_PORT:-6001}" + - "ECHO_REDIS_PORT=${REDIS_PORT:-6379}" + - "ECHO_REDIS_HOSTNAME=${REDIS_HOST:-redis}" + - "ECHO_PROTOCOL=http" + - "ECHO_ALLOW_CORS=true" + - "ECHO_ALLOW_ORIGIN=*" + - "ECHO_ALLOW_METHODS=*" + - "ECHO_ALLOW_HEADERS=*" diff --git a/webhooksite/nginx/webhook.conf b/webhooksite/nginx/webhook.conf new file mode 100644 index 0000000..c3394af --- /dev/null +++ b/webhooksite/nginx/webhook.conf @@ -0,0 +1,28 @@ +server { + listen 80; + server_name webhook.domain.tld; + + #charset utf-8; + + location / { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_read_timeout 600s; + proxy_send_timeout 600s; + + proxy_pass http://127.0.0.1:8391/; + } + + # https://docs.webhook.site/install.html#docker + location /socket.io { + proxy_pass http://127.0.0.1:6001; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } +} \ No newline at end of file -- 2.43.5 From 020f498c74ff7f8be5071a0353c3b57b9c535ffd Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Thu, 7 Mar 2024 16:15:04 +0300 Subject: [PATCH 3/4] webhooksite. Adding host hostname bind. --- webhooksite/.env.dist | 2 +- webhooksite/docker-compose.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webhooksite/.env.dist b/webhooksite/.env.dist index d46984f..8ba58f8 100644 --- a/webhooksite/.env.dist +++ b/webhooksite/.env.dist @@ -13,7 +13,7 @@ APP_DEBUG=false APP_URL=http://domain.tld:80 APP_LOG=errorlog DB_CONNECTION=sqlite -REDIS_HOST=127.0.0.1 +REDIS_HOST=host.docker.internal REDIS_PORT=6379 #REDIS_PASSWORD=null BROADCAST_DRIVER=redis diff --git a/webhooksite/docker-compose.yml b/webhooksite/docker-compose.yml index 3b13aa8..9a929c1 100644 --- a/webhooksite/docker-compose.yml +++ b/webhooksite/docker-compose.yml @@ -6,6 +6,8 @@ services: image: "webhooksite/webhook.site" container_name: webhook-site command: "php artisan queue:work --daemon --tries=3 --timeout=10" + extra_hosts: + - 'host.docker.internal:host-gateway' ports: - "${WEBUI_BIND_ADDR}:${WEBUI_BIND_PORT}:80" env_file: .env -- 2.43.5 From e4783097aab1e4d5149db5d0ebf19cc535a5e931 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Thu, 7 Mar 2024 16:26:35 +0300 Subject: [PATCH 4/4] webhooksite. Adding Redis to stack. --- webhooksite/.env.dist | 4 +++- webhooksite/data/.gitignore | 2 ++ webhooksite/docker-compose.yml | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 webhooksite/data/.gitignore diff --git a/webhooksite/.env.dist b/webhooksite/.env.dist index 8ba58f8..492f07c 100644 --- a/webhooksite/.env.dist +++ b/webhooksite/.env.dist @@ -13,7 +13,7 @@ APP_DEBUG=false APP_URL=http://domain.tld:80 APP_LOG=errorlog DB_CONNECTION=sqlite -REDIS_HOST=host.docker.internal +REDIS_HOST=redis REDIS_PORT=6379 #REDIS_PASSWORD=null BROADCAST_DRIVER=redis @@ -21,5 +21,7 @@ CACHE_DRIVER=redis QUEUE_DRIVER=redis ECHO_HOST_MODE=path +REDIS_HOST_DATA_DIR=./data + LOG_MAX_SIZE=5m LOG_MAX_FILE=5 \ No newline at end of file diff --git a/webhooksite/data/.gitignore b/webhooksite/data/.gitignore new file mode 100644 index 0000000..a68d087 --- /dev/null +++ b/webhooksite/data/.gitignore @@ -0,0 +1,2 @@ +/* +!/.gitignore diff --git a/webhooksite/docker-compose.yml b/webhooksite/docker-compose.yml index 9a929c1..b8d1d67 100644 --- a/webhooksite/docker-compose.yml +++ b/webhooksite/docker-compose.yml @@ -6,8 +6,6 @@ services: image: "webhooksite/webhook.site" container_name: webhook-site command: "php artisan queue:work --daemon --tries=3 --timeout=10" - extra_hosts: - - 'host.docker.internal:host-gateway' ports: - "${WEBUI_BIND_ADDR}:${WEBUI_BIND_PORT}:80" env_file: .env @@ -20,6 +18,8 @@ services: laravel-echo-server: image: "webhooksite/laravel-echo-server" + depends_on: + - redis ports: - "${ECHO_BIND_ADDR:-127.0.0.1}:${ECHO_BIND_PORT:-6001}:${ECHO_BIND_PORT:-6001}" environment: @@ -33,3 +33,16 @@ services: - "ECHO_ALLOW_ORIGIN=*" - "ECHO_ALLOW_METHODS=*" - "ECHO_ALLOW_HEADERS=*" + + redis: + image: redis:alpine + command: "redis-server --save ${PERSISTENCE_PERIOD_SEC:-60} ${PERSISTENCE_MIN_OPS:-1} --loglevel ${LOG_LEVEL:-warning}" + volumes: + - "${REDIS_HOST_DATA_DIR:-./data}:/data" + env_file: .env + restart: unless-stopped + logging: + driver: "json-file" + options: + max-size: "${LOG_MAX_SIZE:-5m}" + max-file: "${LOG_MAX_FILE:-5}" -- 2.43.5