Skip to content

Commit

Permalink
Support for Cloudflare ZeroTrust Tunnel
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Apr 22, 2024
1 parent 48dd874 commit 56b011e
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .env-backend-cloudflare
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BACKEND_URL=https://apiticketz.example.com
FRONTEND_URL=https://ticketz.example.com

## normalmente não precisa editar daqui em diante

DB_DIALECT=postgres
DB_HOST=postgres
DB_PORT=5432
DB_USER=ticketz
DB_NAME=ticketz


REDIS_URI=redis://redis:6379
REDIS_OPT_LIMITER_MAX=1
REDIS_OPT_LIMITER_DURATION=3000

USER_LIMIT=10000
CONNECTIONS_LIMIT=100000
CLOSED_SEND_BY_ME=true

## não funciona em modo local (ainda)
EFI_ENABLE_PIX=false

VERIFY_TOKEN=ticketz
SOCKET_ADMIN=true
1 change: 1 addition & 0 deletions .env-cloudflared
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TUNNEL_TOKEN=TunnelTokenAsProvidedByCloudflare
1 change: 1 addition & 0 deletions .env-frontend-cloudflare
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BACKEND_HOST=apiticketz.example.com
76 changes: 76 additions & 0 deletions docker-compose-cloudflare.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
version: '3'

networks:
ticketz:

volumes:
postgres_data:
redis_data:
backend_public:

services:

backend:
build:
context: ./backend
dockerfile: ./Dockerfile
volumes:
- backend_public:/usr/src/app/public
env_file:
- .env-backend-cloudflare
restart: always
depends_on:
- postgres
- redis
networks:
- ticketz

frontend:
build:
context: ./frontend
dockerfile: ./Dockerfile
env_file:
- .env-frontend-cloudflare
restart: always
depends_on:
- backend
networks:
- ticketz

postgres:
image: postgres:16-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER:-ticketz}
- POSTGRES_DB=${POSTGRES_DB:-ticketz}
- POSTGRES_HOST_AUTH_METHOD=trust
- TZ=${TZ:-America/Fortaleza}
expose:
- 5432
restart: always
networks:
- ticketz

redis:
image: redis:alpine
command: redis-server --appendonly yes
expose:
- 6379
restart: always
volumes:
- redis_data:/data
networks:
- ticketz

cloudflared:
image: cloudflare/cloudflared
restart: always
command: tunnel run
env_file:
- .env-cloudflared
depends_on:
- backend
- frontend
networks:
- ticketz

0 comments on commit 56b011e

Please sign in to comment.