diff --git a/.env-backend-cloudflare b/.env-backend-cloudflare new file mode 100644 index 00000000..73844209 --- /dev/null +++ b/.env-backend-cloudflare @@ -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 diff --git a/.env-cloudflared b/.env-cloudflared new file mode 100644 index 00000000..9eb6095f --- /dev/null +++ b/.env-cloudflared @@ -0,0 +1 @@ +TUNNEL_TOKEN=TunnelTokenAsProvidedByCloudflare diff --git a/.env-frontend-cloudflare b/.env-frontend-cloudflare new file mode 100644 index 00000000..ea60b190 --- /dev/null +++ b/.env-frontend-cloudflare @@ -0,0 +1 @@ +BACKEND_HOST=apiticketz.example.com diff --git a/docker-compose-cloudflare.yaml b/docker-compose-cloudflare.yaml new file mode 100644 index 00000000..69f37c01 --- /dev/null +++ b/docker-compose-cloudflare.yaml @@ -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