Skip to content

Commit

Permalink
Merge pull request #469 from panoratech/docker-hc
Browse files Browse the repository at this point in the history
🩺 Healthchecks in docker
  • Loading branch information
rflihxyz authored May 30, 2024
2 parents 233555d + 6fe987c commit 79ea131
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 41 deletions.
37 changes: 11 additions & 26 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# # # # # #
# Secrets #
# # # # # #

POSTGRES_PASSWORD=my_password
JWT_SECRET=secret_jwt
ENCRYPT_CRYPTO_SECRET_KEY="0123456789abcdef0123456789abcdef"

# ================================================
# API Backend
# ================================================
ENV=dev
DISTRIBUTION=selfhosted # selfhosted or managed
OAUTH_REDIRECT_BASE=http://localhost:3000
JWT_SECRET=secret_jwt
ENCRYPT_CRYPTO_SECRET_KEY="0123456789abcdef0123456789abcdef"
BACKEND_PORT=3000

#Managed only
SENTRY_DSN=


# ================================================
# REDIS
REDIS_HOST=redis
Expand All @@ -26,9 +25,10 @@ REDIS_PASS=A3vniod98Zbuvn9u5
POSTGRES_USER=my_user
POSTGRES_DB=panora_db
POSTGRES_HOST=postgres
POSTGRES_PASSWORD=my_password


# Each Provider is of form PROVIDER_TICKETING_SOFTWAREMODE_ATTRIBUTE
# Each Provider is of form PROVIDER_VERTICAL_SOFTWAREMODE_ATTRIBUTE
# ================================================
# Integration Providers
# ================================================
Expand Down Expand Up @@ -74,21 +74,6 @@ NEXT_PUBLIC_BACKEND_DOMAIN=http://localhost:3000 # https://api.panora.dev/
NEXT_PUBLIC_MAGIC_LINK_DOMAIN=http://localhost:81
NEXT_PUBLIC_POSTHOG_KEY=<ph_project_api_key>
NEXT_PUBLIC_POSTHOG_HOST=<ph_instance_address>

NEXT_PUBLIC_STYTCH_PROJECT_ID="project-test"
NEXT_PUBLIC_STYTCH_SECRET="example"
NEXT_PUBLIC_STYTCH_PROJECT_ENV="test"
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN="public-token-test"
NEXT_PUBLIC_WEBAPP_DOMAIN="http://localhost"

# ================================================
# Minio (s3 file storage)
# ================================================
MINIO_ROOT_USER=myaccesskey13
MINIO_ROOT_PASSWORD=mysecretkey12
AWS_S3_REGION=us-east-1
# S3 Buckets
# Ticketing Attachments bucket
S3_TCG_ATTACHMENTS_BUCKETNAME=tcg-attachments
BUCKET_TCG_ATTACHMENTS_USER=BUCKET_TCG_ATTACHMENTS_USER01
BUCKET_TCG_ATTACHMENTS_PW=BUCKET_TCG_ATTACHMENTS_PW01
# Disable Next.js spyware
NEXT_TELEMETRY_DISABLED=1
4 changes: 0 additions & 4 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,8 @@ services:
VITE_BACKEND_DOMAIN: ${NEXT_PUBLIC_BACKEND_DOMAIN}
VITE_FRONTEND_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN}
environment:
NEXT_PUBLIC_STYTCH_SECRET: ${NEXT_PUBLIC_STYTCH_SECRET}
NEXT_PUBLIC_STYTCH_PROJECT_ID: ${NEXT_PUBLIC_STYTCH_PROJECT_ID}
NEXT_PUBLIC_DISTRIBUTION: ${DISTRIBUTION}
NEXT_PUBLIC_BACKEND_DOMAIN: ${NEXT_PUBLIC_BACKEND_DOMAIN}
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN: ${NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN}
NEXT_PUBLIC_STYTCH_PROJECT_ENV: ${NEXT_PUBLIC_STYTCH_PROJECT_ENV}
NEXT_PUBLIC_MAGIC_LINK_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN}
NEXT_PUBLIC_WEBAPP_DOMAIN: ${NEXT_PUBLIC_WEBAPP_DOMAIN}
restart: unless-stopped
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ services:
dockerfile: ./apps/client-ts/Dockerfile
context: ./
args:
NEXT_PUBLIC_STYTCH_PROJECT_ID: ${NEXT_PUBLIC_STYTCH_PROJECT_ID}
NEXT_PUBLIC_STYTCH_SECRET: ${NEXT_PUBLIC_STYTCH_SECRET}
NEXT_PUBLIC_STYTCH_PROJECT_ENV: ${NEXT_PUBLIC_STYTCH_PROJECT_ENV}
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN: ${NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN}
NEXT_PUBLIC_DISTRIBUTION: ${DISTRIBUTION}
NEXT_PUBLIC_BACKEND_DOMAIN: ${NEXT_PUBLIC_BACKEND_DOMAIN}
NEXT_PUBLIC_FRONTEND_DOMAIN: ${NEXT_PUBLIC_FRONTEND_DOMAIN}
Expand Down
18 changes: 11 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
image: panoradotdev/backend-api:selfhosted
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?ssl=false
PORT: ${BACKEND_PORT}
DISTRIBUTION: ${DISTRIBUTION}
JWT_SECRET: ${JWT_SECRET}
REDIS_HOST: ${REDIS_HOST}
Expand Down Expand Up @@ -114,7 +115,12 @@ services:
condition: service_healthy
networks:
- backend

healthcheck:
#test: ["CMD", "nc", "-z", "localhost", "${BACKEND_PORT}"]
test: ["CMD", "curl", "-f", "http://api:3000/health"] # Alternative healthcheck method
interval: 10s
timeout: 1s
retries: 5

redis:
image: valkey/valkey:7.2-alpine
Expand All @@ -134,18 +140,15 @@ services:
ports:
- 81:80
depends_on:
- api
api:
condition: service_healthy
networks:
- backend
- frontend

webapp-next:
image: panoradotdev/frontend-webapp:selfhosted
environment:
NEXT_PUBLIC_STYTCH_PROJECT_ID: ${NEXT_PUBLIC_STYTCH_PROJECT_ID}
NEXT_PUBLIC_STYTCH_SECRET: ${NEXT_PUBLIC_STYTCH_SECRET}
NEXT_PUBLIC_STYTCH_PROJECT_ENV: ${NEXT_PUBLIC_STYTCH_PROJECT_ENV}
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN: ${NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN}
NEXT_PUBLIC_DISTRIBUTION: ${DISTRIBUTION}
NEXT_PUBLIC_BACKEND_DOMAIN: ${NEXT_PUBLIC_BACKEND_DOMAIN}
NEXT_PUBLIC_MAGIC_LINK_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN}
Expand All @@ -154,7 +157,8 @@ services:
ports:
- 80:8090
depends_on:
- api
api:
condition: service_healthy
networks:
- backend
- frontend
Expand Down
2 changes: 2 additions & 0 deletions packages/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ RUN pnpm run build

# ========================================================================
FROM base AS runner
RUN apk add --no-cache libc6-compat netcat-openbsd curl

WORKDIR /app

COPY --from=installer ./app .
Expand Down

0 comments on commit 79ea131

Please sign in to comment.