Webhook.site stack and Redis persistence (#85)

Co-authored-by: Alexey Skobkin <skobkin-ru@ya.ru>
Reviewed-on: #85
This commit is contained in:
Alexey Skobkin 2024-03-07 13:40:37 +00:00
parent fbec9eb96c
commit 365d8646e4
8 changed files with 117 additions and 6 deletions

View File

@ -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) |

View File

@ -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

2
redis/data/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/*
!/.gitignore

View File

@ -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

27
webhooksite/.env.dist Normal file
View File

@ -0,0 +1,27 @@
# 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=redis
REDIS_PORT=6379
#REDIS_PASSWORD=null
BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
QUEUE_DRIVER=redis
ECHO_HOST_MODE=path
REDIS_HOST_DATA_DIR=./data
LOG_MAX_SIZE=5m
LOG_MAX_FILE=5

2
webhooksite/data/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/*
!/.gitignore

View File

@ -0,0 +1,48 @@
# 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"
depends_on:
- redis
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=*"
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}"

View File

@ -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;
}
}