Skip to content

Instantly share code, notes, and snippets.

@muhajirinlpu
Last active February 11, 2024 13:58
Show Gist options
  • Save muhajirinlpu/cb70f37930bf93649714c0483f03d281 to your computer and use it in GitHub Desktop.
Save muhajirinlpu/cb70f37930bf93649714c0483f03d281 to your computer and use it in GitHub Desktop.
hoppscotch server docker compose
#-----------------------Backend Config------------------------------#
# Prisma Config
DATABASE_URL=postgresql://postgres:********@db:5432/hoppscotch
# Auth Tokens Config
JWT_SECRET="secret1233"
TOKEN_SALT_COMPLEXITY=10
MAGIC_LINK_TOKEN_VALIDITY= 3
REFRESH_TOKEN_VALIDITY="604800000" # Default validity is 7 days (604800000 ms) in ms
ACCESS_TOKEN_VALIDITY="86400000" # Default validity is 1 day (86400000 ms) in ms
SESSION_SECRET='add some secret here'
# Hoppscotch App Domain Config
REDIRECT_URL="https://app.hh.dengan.dev"
WHITELISTED_ORIGINS = "https://be.hh.dengan.dev,https://app.hh.dengan.dev,https://admin.hh.dengan.dev"
VITE_ALLOWED_AUTH_PROVIDERS = GITHUB
# Github Auth Config
GITHUB_CLIENT_ID="*****************"
GITHUB_CLIENT_SECRET="***************************"
GITHUB_CALLBACK_URL="https://be.hh.dengan.dev/v1/auth/github/callback"
GITHUB_SCOPE="user:email"
# Mailer config
MAILER_SMTP_URL="smtps://no-reply@dengan.dev:passkeyhere@smtp.some.domain"
MAILER_ADDRESS_FROM='"DEV Hoppscotch" <no-reply@dengan.dev>'
# Rate Limit Config
RATE_LIMIT_TTL=60 # In seconds
RATE_LIMIT_MAX=100 # Max requests per IP
#-----------------------Frontend Config------------------------------#
# Base URLs
VITE_BASE_URL=https://app.hh.dengan.dev
VITE_SHORTCODE_BASE_URL=https://app.hh.dengan.dev
VITE_ADMIN_URL=https://admin.dengan.dev
# Backend URLs
VITE_BACKEND_GQL_URL=https://be.hh.dengan.dev/graphql
VITE_BACKEND_WS_URL=wss://be.hh.dengan.dev/graphql
VITE_BACKEND_API_URL=https://be.hh.dengan.dev/v1
COMPOSE_PROJECT_NAME=hh
version: "3.7"
volumes:
db-data:
driver: local
services:
# This service runs the backend app in the port 3170
backend:
image: hoppscotch/hoppscotch-backend
env_file:
- ./.env
restart: always
environment:
# Edit the below line to match your PostgresDB URL if you have an outside DB (make sure to update the .env file as well)
- DATABASE_URL=postgresql://postgres:********@db:5432/hoppscotch?connect_timeout=300
- PORT=8080
volumes:
# Uncomment the line below when modifying code. Only applicable when using the "dev" target.
# - ./packages/hoppscotch-backend/:/usr/src/app
- /usr/src/app/node_modules/
depends_on:
db:
condition: service_healthy
ports:
- "3170:3170"
# The main hoppscotch app. This will be hosted at port 3000
# NOTE: To do TLS or play around with how the app is hosted, you can look into the Caddyfile for
# the SH admin dashboard server at packages/hoppscotch-selfhost-web/Caddyfile
app:
image: hoppscotch/hoppscotch-frontend
env_file:
- ./.env
depends_on:
- hoppscotch-backend
ports:
- "3000:3000"
# The Self Host dashboard for managing the app. This will be hosted at port 3100
# NOTE: To do TLS or play around with how the app is hosted, you can look into the Caddyfile for
# the SH admin dashboard server at packages/hoppscotch-sh-admin/Caddyfile
sh-admin:
image: hoppscotch/hoppscotch-admin
env_file:
- ./.env
depends_on:
- hoppscotch-backend
ports:
- "3100:3100"
# The preset DB service, you can delete/comment the below lines if
# you are using an external postgres instance
# This will be exposed at port 5432
db:
image: postgres
user: postgres
volumes:
- db-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: wonderful
POSTGRES_DB: hoppscotch
healthcheck:
test:
[
"CMD-SHELL",
"sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'"
]
interval: 5s
timeout: 5s
retries: 10
server {
server_name app.hh.dengan.dev;
client_max_body_size 100M;
include /usr/share/nginx/html/nginx-errors/nginx-errors.conf;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
# Allow the use of websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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 https;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen [::]:80;
listen 80;
}
server {
server_name admin.hh.dengan.dev;
client_max_body_size 100M;
include /usr/share/nginx/html/nginx-errors/nginx-errors.conf;
location / {
proxy_pass http://127.0.0.1:3100;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
# Allow the use of websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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 https;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen [::]:80;
listen 80;
}
server {
server_name be.hh.dengan.dev;
client_max_body_size 100M;
include /usr/share/nginx/html/nginx-errors/nginx-errors.conf;
location / {
proxy_pass http://127.0.0.1:3170;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
# Allow the use of websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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 https;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
listen [::]:80;
listen 80;
}

Hoppscotch docker compose Server Setup

This is just a note for myself, for complete documentation please read official docs

Variable

What you need to generate / get

  1. Domain & Subdomain
  2. DB Password

-TBD-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment