Skip to content

Commit

Permalink
created action for gauzy api stage on digitalOcean droplet
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey1330 committed Mar 3, 2024
1 parent 84f22cd commit c5e5864
Show file tree
Hide file tree
Showing 9 changed files with 602 additions and 55 deletions.
22 changes: 22 additions & 0 deletions .deploy/ssh/docker-compose.api.prod.cloudflare.pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.8'

services:
nginx:
image: nginx:latest
volumes:
- ./nginx.prod.pre.cloudflare.conf:/etc/nginx/nginx.conf:ro
- ./ingress.api.crt:/etc/nginx/ssl/fullchain.pem
- ./ingress.api.key:/etc/nginx/ssl/privkey.pem
restart: unless-stopped
ports:
- "80:80"
- "443:443"
networks:
- with-cloudflare_overlay
volumes:
certificates: {}

networks:
with-cloudflare_overlay:
external: true

29 changes: 29 additions & 0 deletions .deploy/ssh/docker-compose.api.prod.letsencrypt.pre.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3.8'

services:
nginx:
image: nginx:latest
volumes:
- ./nginx.prod.pre.letsencrypt.conf:/etc/nginx/nginx.conf:ro
- ./certbot/conf:/etc/nginx/ssl:ro
- ./certbot/www:/var/www/certbot:ro
restart: unless-stopped
ports:
- "80:80"
- "443:443"
networks:
- with-letsencrypt_overlay
certbot:
image: certbot/certbot:latest
container_name: certbot
volumes:
- ./certbot/conf:/etc/letsencrypt:rw
- ./certbot/www:/var/www/certbot:rw
command: certonly --webroot -w /var/www/certbot --force-renewal --email ever@ever.tech -d apidts.gauzy.co --agree-tos
volumes:
certificates: {}

networks:
with-letsencrypt_overlay:
external: true

25 changes: 25 additions & 0 deletions .deploy/ssh/nginx.prod.pre.cloudflare.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
user nginx;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name apidt.gauzy.co;

location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name apidt.gauzy.co;

ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;

location / {
proxy_pass http://api:3000;
}
}
}
31 changes: 31 additions & 0 deletions .deploy/ssh/nginx.prod.pre.letsencrypt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
user nginx;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name apidts.gauzy.co;

location / {
return 301 https://$host$request_uri;
}
location ~ /.well-known/acme-challenge/ {
root /var/www/certbot;
}
}

server {
listen 443 ssl;
server_name apidts.gauzy.co;

# use the certificates
ssl_certificate /etc/nginx/ssl/live/apidts.gauzy.co/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/live/apidts.gauzy.co/privkey.pem;

location / {
proxy_pass http://api:3000;
}
}

}
123 changes: 123 additions & 0 deletions .deploy/ssh/with-cloudflare/docker-compose.api.prod.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
version: '3.8'

services:
api:
#container_name: api-${ENV_NAME}
image: ghcr.io/ever-co/gauzy-api-stage:latest
deploy:
mode: replicated
replicas: 2
environment:
API_HOST: '0.0.0.0'
DEMO: '${DEMO}'
NODE_ENV: '${NODE_ENV}'
ADMIN_PASSWORD_RESET: '${ADMIN_PASSWORD_RESET}'
API_BASE_URL: '${API_BASE_URL}'
CLIENT_BASE_URL: '${CLIENT_BASE_URL}'
DB_TYPE: '${DB_TYPE}'
DB_URI: '${DB_URI}'
DB_HOST: '${DB_HOST}'
DB_USER: '${DB_USER}'
DB_PASS: '${DB_PASS}'
DB_NAME: '${DB_NAME}'
DB_PORT: '${DB_PORT}'
DB_CA_CERT: '${DB_CA_CERT}'
DB_SSL_MODE: '${DB_SSL_MODE}'
DB_POOL_SIZE: '${DB_POOL_SIZE}'
DB_POOL_SIZE_KNEX: '${DB_POOL_SIZE_KNEX}'
REDIS_ENABLED: '${REDIS_ENABLED}'
REDIS_URL: '${REDIS_URL}'
CLOUD_PROVIDER: 'DO'
SENTRY_DSN: '${SENTRY_DSN}'
SENTRY_TRACES_SAMPLE_RATE: '${SENTRY_TRACES_SAMPLE_RATE}'
SENTRY_PROFILE_SAMPLE_RATE: '${SENTRY_PROFILE_SAMPLE_RATE}'
SENTRY_HTTP_TRACING_ENABLED: '${SENTRY_HTTP_TRACING_ENABLED}'
SENTRY_POSTGRES_TRACKING_ENABLED: '${SENTRY_POSTGRES_TRACKING_ENABLED}'
SENTRY_PROFILING_ENABLED: '${SENTRY_PROFILING_ENABLED}'
AWS_ACCESS_KEY_ID: '${AWS_ACCESS_KEY_ID}'
AWS_SECRET_ACCESS_KEY: '${AWS_SECRET_ACCESS_KEY}'
AWS_REGION: '${AWS_REGION}'
AWS_S3_BUCKET: '${AWS_S3_BUCKET}'
WASABI_ACCESS_KEY_ID: '${WASABI_ACCESS_KEY_ID}'
WASABI_SECRET_ACCESS_KEY: '${WASABI_SECRET_ACCESS_KEY}'
WASABI_REGION: '${WASABI_REGION}'
WASABI_SERVICE_URL: '${WASABI_SERVICE_URL}'
WASABI_S3_BUCKET: '${WASABI_S3_BUCKET}'
EXPRESS_SESSION_SECRET: '${EXPRESS_SESSION_SECRET}'
JWT_SECRET: '${JWT_SECRET}'
JWT_REFRESH_TOKEN_SECRET: '${JWT_REFRESH_TOKEN_SECRET}'
JWT_REFRESH_TOKEN_EXPIRATION_TIME: '${JWT_REFRESH_TOKEN_EXPIRATION_TIME}'
CLOUDINARY_API_KEY: '${CLOUDINARY_API_KEY}'
CLOUDINARY_API_SECRET: '${CLOUDINARY_API_SECRET}'
CLOUDINARY_CLOUD_NAME: '${CLOUDINARY_CLOUD_NAME}'
MAIL_FROM_ADDRESS: '${MAIL_FROM_ADDRESS}'
MAIL_HOST: '${MAIL_HOST}'
MAIL_PORT: '${MAIL_PORT}'
MAIL_USERNAME: '${MAIL_USERNAME}'
MAIL_PASSWORD: '${MAIL_PASSWORD}'
ALLOW_SUPER_ADMIN_ROLE: '${ALLOW_SUPER_ADMIN_ROLE}'
GOOGLE_CLIENT_ID: '${GOOGLE_CLIENT_ID}'
GOOGLE_CLIENT_SECRET: '${GOOGLE_CLIENT_SECRET}'
GOOGLE_CALLBACK_URL: '${GOOGLE_CALLBACK_URL}'
FACEBOOK_CLIENT_ID: '${FACEBOOK_CLIENT_ID}'
FACEBOOK_CLIENT_SECRET: '${FACEBOOK_CLIENT_SECRET}'
FACEBOOK_GRAPH_VERSION: '${FACEBOOK_GRAPH_VERSION}'
FACEBOOK_CALLBACK_URL: '${FACEBOOK_CALLBACK_URL}'
INTEGRATED_USER_DEFAULT_PASS: '${INTEGRATED_USER_DEFAULT_PASS}'
UPWORK_REDIRECT_URL: '${UPWORK_REDIRECT_URL}'
FILE_PROVIDER: '${FILE_PROVIDER}'
GAUZY_AI_GRAPHQL_ENDPOINT: '${GAUZY_AI_GRAPHQL_ENDPOINT}'
GAUZY_AI_REST_ENDPOINT: '${GAUZY_AI_REST_ENDPOINT}'
UNLEASH_APP_NAME: '${UNLEASH_APP_NAME}'
UNLEASH_API_URL: '${UNLEASH_API_URL}'
UNLEASH_INSTANCE_ID: '${UNLEASH_INSTANCE_ID}'
UNLEASH_REFRESH_INTERVAL: '${UNLEASH_REFRESH_INTERVAL}'
UNLEASH_METRICS_INTERVAL: '${UNLEASH_METRICS_INTERVAL}'
UNLEASH_API_KEY: '${UNLEASH_API_KEY}'
PM2_MACHINE_NAME: '${PM2_MACHINE_NAME}'
PM2_SECRET_KEY: '${PM2_SECRET_KEY}'
PM2_PUBLIC_KEY: '${PM2_PUBLIC_KEY}'
JITSU_SERVER_URL: '${JITSU_SERVER_URL}'
JITSU_SERVER_WRITE_KEY: '${JITSU_SERVER_WRITE_KEY}'
OTEL_ENABLED: '${OTEL_ENABLED}'
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: '${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT}'
OTEL_EXPORTER_OTLP_HEADERS: '${OTEL_EXPORTER_OTLP_HEADERS}'
GAUZY_GITHUB_CLIENT_ID: '${GAUZY_GITHUB_CLIENT_ID}'
GAUZY_GITHUB_CLIENT_SECRET: '${GAUZY_GITHUB_CLIENT_SECRET}'
GAUZY_GITHUB_APP_PRIVATE_KEY: '${GAUZY_GITHUB_APP_PRIVATE_KEY}'
GAUZY_GITHUB_WEBHOOK_URL: '${GAUZY_GITHUB_WEBHOOK_URL}'
GAUZY_GITHUB_WEBHOOK_SECRET: '${GAUZY_GITHUB_WEBHOOK_SECRET}'
GAUZY_GITHUB_APP_NAME: '${GAUZY_GITHUB_APP_NAME}'
GAUZY_GITHUB_REDIRECT_URL: '${GAUZY_GITHUB_REDIRECT_URL}'
GAUZY_GITHUB_POST_INSTALL_URL: '${GAUZY_GITHUB_POST_INSTALL_URL}'
GAUZY_GITHUB_APP_ID: '${GAUZY_GITHUB_APP_ID}'
GAUZY_GITHUB_OAUTH_CLIENT_ID: '${GAUZY_GITHUB_OAUTH_CLIENT_ID}'
GAUZY_GITHUB_OAUTH_CLIENT_SECRET: '${GAUZY_GITHUB_OAUTH_CLIENT_SECRET}'
GAUZY_GITHUB_OAUTH_CALLBACK_URL: '${GAUZY_GITHUB_OAUTH_CALLBACK_URL}'
JITSU_BROWSER_URL: '${JITSU_BROWSER_URL}'
JITSU_BROWSER_WRITE_KEY: '${JITSU_BROWSER_WRITE_KEY}'
MAGIC_CODE_EXPIRATION_TIME: '${MAGIC_CODE_EXPIRATION_TIME}'
APP_NAME: '${APP_NAME}'
APP_LOGO: '${APP_LOGO}'
APP_SIGNATURE: '${APP_SIGNATURE}'
APP_LINK: '${APP_LINK}'
APP_EMAIL_CONFIRMATION_URL: '${APP_EMAIL_CONFIRMATION_URL}'
APP_MAGIC_SIGN_URL: '${APP_MAGIC_SIGN_URL}'
COMPANY_LINK: '${COMPANY_LINK}'
COMPANY_NAME: '${COMPANY_NAME}'

entrypoint: './entrypoint.prod.sh'
command: ['node', 'main.js']
restart: on-failure
ports:
- '3000'
# '3000-3001:${API_PORT}'
networks:
- overlay

volumes:
certificates: {}

networks:
overlay:
driver: bridge
145 changes: 145 additions & 0 deletions .deploy/ssh/with-letsencrypt/docker-compose.api.prod.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
version: '3.8'

services:
api:
#container_name: api-${ENV_NAME}
image: ghcr.io/ever-co/gauzy-api:latest
deploy:
mode: replicated
replicas: 2
environment:
API_HOST: '0.0.0.0'
DEMO: '${DEMO}'
NODE_ENV: '${NODE_ENV}'
ADMIN_PASSWORD_RESET: '${ADMIN_PASSWORD_RESET}'
API_BASE_URL: '${API_BASE_URL}'
CLIENT_BASE_URL: '${CLIENT_BASE_URL}'
DB_TYPE: '${DB_TYPE}'
DB_URI: '${DB_URI}'
DB_HOST: '${DB_HOST}'
DB_USER: '${DB_USER}'
DB_PASS: '${DB_PASS}'
DB_NAME: '${DB_NAME}'
DB_PORT: '${DB_PORT}'
DB_CA_CERT: '${DB_CA_CERT}'
DB_SSL_MODE: '${DB_SSL_MODE}'
DB_POOL_SIZE: '${DB_POOL_SIZE}'
DB_POOL_SIZE_KNEX: '${DB_POOL_SIZE_KNEX}'
REDIS_ENABLED: '${REDIS_ENABLED}'
REDIS_URL: '${REDIS_URL}'
CLOUD_PROVIDER: 'DO'
SENTRY_DSN: '${SENTRY_DSN}'
SENTRY_TRACES_SAMPLE_RATE: '${SENTRY_TRACES_SAMPLE_RATE}'
SENTRY_PROFILE_SAMPLE_RATE: '${SENTRY_PROFILE_SAMPLE_RATE}'
SENTRY_HTTP_TRACING_ENABLED: '${SENTRY_HTTP_TRACING_ENABLED}'
SENTRY_POSTGRES_TRACKING_ENABLED: '${SENTRY_POSTGRES_TRACKING_ENABLED}'
SENTRY_PROFILING_ENABLED: '${SENTRY_PROFILING_ENABLED}'
AWS_ACCESS_KEY_ID: '${AWS_ACCESS_KEY_ID}'
AWS_SECRET_ACCESS_KEY: '${AWS_SECRET_ACCESS_KEY}'
AWS_REGION: '${AWS_REGION}'
AWS_S3_BUCKET: '${AWS_S3_BUCKET}'
WASABI_ACCESS_KEY_ID: '${WASABI_ACCESS_KEY_ID}'
WASABI_SECRET_ACCESS_KEY: '${WASABI_SECRET_ACCESS_KEY}'
WASABI_REGION: '${WASABI_REGION}'
WASABI_SERVICE_URL: '${WASABI_SERVICE_URL}'
WASABI_S3_BUCKET: '${WASABI_S3_BUCKET}'
EXPRESS_SESSION_SECRET: '${EXPRESS_SESSION_SECRET}'
JWT_SECRET: '${JWT_SECRET}'
JWT_REFRESH_TOKEN_SECRET: '${JWT_REFRESH_TOKEN_SECRET}'
JWT_REFRESH_TOKEN_EXPIRATION_TIME: '${JWT_REFRESH_TOKEN_EXPIRATION_TIME}'
CLOUDINARY_API_KEY: '${CLOUDINARY_API_KEY}'
CLOUDINARY_API_SECRET: '${CLOUDINARY_API_SECRET}'
CLOUDINARY_CLOUD_NAME: '${CLOUDINARY_CLOUD_NAME}'
MAIL_FROM_ADDRESS: '${MAIL_FROM_ADDRESS}'
MAIL_HOST: '${MAIL_HOST}'
MAIL_PORT: '${MAIL_PORT}'
MAIL_USERNAME: '${MAIL_USERNAME}'
MAIL_PASSWORD: '${MAIL_PASSWORD}'
ALLOW_SUPER_ADMIN_ROLE: '${ALLOW_SUPER_ADMIN_ROLE}'
GOOGLE_CLIENT_ID: '${GOOGLE_CLIENT_ID}'
GOOGLE_CLIENT_SECRET: '${GOOGLE_CLIENT_SECRET}'
GOOGLE_CALLBACK_URL: '${GOOGLE_CALLBACK_URL}'
FACEBOOK_CLIENT_ID: '${FACEBOOK_CLIENT_ID}'
FACEBOOK_CLIENT_SECRET: '${FACEBOOK_CLIENT_SECRET}'
FACEBOOK_GRAPH_VERSION: '${FACEBOOK_GRAPH_VERSION}'
FACEBOOK_CALLBACK_URL: '${FACEBOOK_CALLBACK_URL}'
INTEGRATED_USER_DEFAULT_PASS: '${INTEGRATED_USER_DEFAULT_PASS}'
UPWORK_REDIRECT_URL: '${UPWORK_REDIRECT_URL}'
FILE_PROVIDER: '${FILE_PROVIDER}'
GAUZY_AI_GRAPHQL_ENDPOINT: '${GAUZY_AI_GRAPHQL_ENDPOINT}'
GAUZY_AI_REST_ENDPOINT: '${GAUZY_AI_REST_ENDPOINT}'
UNLEASH_APP_NAME: '${UNLEASH_APP_NAME}'
UNLEASH_API_URL: '${UNLEASH_API_URL}'
UNLEASH_INSTANCE_ID: '${UNLEASH_INSTANCE_ID}'
UNLEASH_REFRESH_INTERVAL: '${UNLEASH_REFRESH_INTERVAL}'
UNLEASH_METRICS_INTERVAL: '${UNLEASH_METRICS_INTERVAL}'
UNLEASH_API_KEY: '${UNLEASH_API_KEY}'
PM2_MACHINE_NAME: '${PM2_MACHINE_NAME}'
PM2_SECRET_KEY: '${PM2_SECRET_KEY}'
PM2_PUBLIC_KEY: '${PM2_PUBLIC_KEY}'
JITSU_SERVER_URL: '${JITSU_SERVER_URL}'
JITSU_SERVER_WRITE_KEY: '${JITSU_SERVER_WRITE_KEY}'
OTEL_ENABLED: '${OTEL_ENABLED}'
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: '${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT}'
OTEL_EXPORTER_OTLP_HEADERS: '${OTEL_EXPORTER_OTLP_HEADERS}'
GAUZY_GITHUB_CLIENT_ID: '${GAUZY_GITHUB_CLIENT_ID}'
GAUZY_GITHUB_CLIENT_SECRET: '${GAUZY_GITHUB_CLIENT_SECRET}'
GAUZY_GITHUB_APP_PRIVATE_KEY: '${GAUZY_GITHUB_APP_PRIVATE_KEY}'
GAUZY_GITHUB_WEBHOOK_URL: '${GAUZY_GITHUB_WEBHOOK_URL}'
GAUZY_GITHUB_WEBHOOK_SECRET: '${GAUZY_GITHUB_WEBHOOK_SECRET}'
GAUZY_GITHUB_APP_NAME: '${GAUZY_GITHUB_APP_NAME}'
GAUZY_GITHUB_REDIRECT_URL: '${GAUZY_GITHUB_REDIRECT_URL}'
GAUZY_GITHUB_POST_INSTALL_URL: '${GAUZY_GITHUB_POST_INSTALL_URL}'
GAUZY_GITHUB_APP_ID: '${GAUZY_GITHUB_APP_ID}'
GAUZY_GITHUB_OAUTH_CLIENT_ID: '${GAUZY_GITHUB_OAUTH_CLIENT_ID}'
GAUZY_GITHUB_OAUTH_CLIENT_SECRET: '${GAUZY_GITHUB_OAUTH_CLIENT_SECRET}'
GAUZY_GITHUB_OAUTH_CALLBACK_URL: '${GAUZY_GITHUB_OAUTH_CALLBACK_URL}'
JITSU_BROWSER_URL: '${JITSU_BROWSER_URL}'
JITSU_BROWSER_WRITE_KEY: '${JITSU_BROWSER_WRITE_KEY}'
MAGIC_CODE_EXPIRATION_TIME: '${MAGIC_CODE_EXPIRATION_TIME}'
APP_NAME: '${APP_NAME}'
APP_LOGO: '${APP_LOGO}'
APP_SIGNATURE: '${APP_SIGNATURE}'
APP_LINK: '${APP_LINK}'
APP_EMAIL_CONFIRMATION_URL: '${APP_EMAIL_CONFIRMATION_URL}'
APP_MAGIC_SIGN_URL: '${APP_MAGIC_SIGN_URL}'
COMPANY_LINK: '${COMPANY_LINK}'
COMPANY_NAME: '${COMPANY_NAME}'

entrypoint: './entrypoint.prod.sh'
command: ['node', 'main.js']
restart: on-failure
ports:
- '3000'
# '3000-3001:${API_PORT}'
networks:
- overlay

# nginx:
# image: nginx:latest
# volumes:
# - ./nginx.conf:/etc/nginx/nginx.conf:ro
# - ./etc/letsencrypt:/etc/letsencrypt:ro
# - ./certbot/data:/var/www/certbot
# depends_on:
# - api
# restart: unless-stopped
# ports:
# - "80:80"
# - "443:443"
# networks:
# - overlay

# certbot:
# image: certbot/certbot
# container_name: certbot
# volumes:
# - ./certbot/conf:/etc/letsencrypt
# - ./certbot/www:/var/www/certbot
# command: certonly --webroot -w /var/www/certbot --force-renewal --email ever@ever.tech -d apistagedt.gauzy.co --agree-tos
volumes:
certificates: {}

networks:
overlay:
driver: bridge
Loading

0 comments on commit c5e5864

Please sign in to comment.