Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seprated env variables for specific app containers and added SSL feature using caddy #5429

Draft
wants to merge 23 commits into
base: preview
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
de2cb6b
Separated environment variables for specific app containers.
akshat5302 Aug 20, 2024
779a9c0
added caddy setup for with or without SSL
akshat5302 Aug 26, 2024
99ab338
added envs in variables file
akshat5302 Aug 26, 2024
da11073
fix: handling localhost as APP_DOMAIN
akshat5302 Aug 28, 2024
3d12305
Update variables.env
akshat5302 Aug 28, 2024
a6f8d14
fix: handling localhost as APP_DOMAIN
akshat5302 Aug 28, 2024
0741a00
Merge branch 'env-update' of https://github.com/makeplane/plane into …
akshat5302 Aug 28, 2024
f02e67a
fixed envs
akshat5302 Aug 28, 2024
83a6ba8
fixed typo changes
akshat5302 Aug 28, 2024
1968242
added release assets
mguptahub Aug 29, 2024
78edbc8
updated build.yml
mguptahub Aug 29, 2024
e13c561
Merge branch 'preview' of https://github.com/makeplane/plane into env…
mguptahub Aug 29, 2024
c8c7d43
update install.sh
mguptahub Aug 29, 2024
7b1df8f
updated selfhost README
mguptahub Sep 3, 2024
ee50529
Update selfhost README
mguptahub Sep 3, 2024
607ad3d
Merge branch 'preview' of https://github.com/makeplane/plane into env…
mguptahub Sep 3, 2024
bae525e
selfhost fix for live
mguptahub Sep 3, 2024
085fc16
AIO updates for LIVE
mguptahub Sep 3, 2024
7d4ec00
updated AIP
mguptahub Sep 3, 2024
54a83ef
add default value for CERT_EMAIL
akshat5302 Sep 6, 2024
f0ddcd7
Merge branch 'preview' of github.com:makeplane/plane into env-update
mguptahub Sep 10, 2024
5184ce6
updated branch-build
mguptahub Sep 10, 2024
c5e5b99
updated install.sh to not use release assets
mguptahub Sep 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,61 @@ jobs:
- name: Build and Push Plane-Proxy to Docker Hub
uses: docker/build-push-action@v5.1.0
with:
context: ./nginx
file: ./nginx/Dockerfile
context: ./caddy
file: ./caddy/Dockerfile
platforms: ${{ env.BUILDX_PLATFORMS }}
tags: ${{ env.PROXY_TAG }}
push: true
env:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}

publish_assets:
if : ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs: [branch_build_push_web, branch_build_push_admin, branch_build_push_space, branch_build_push_apiserver, branch_build_push_proxy]
steps:
- id: checkout_files
name: Checkout Files
uses: actions/checkout@v4

- name: Update shell script branch
run: |
sed -i "s/^RELEASE_TAG=.*/RELEASE_TAG=${{ github.event.release.tag_name }}/" ./deploy/selfhost/install.sh
sed -i "s/^export APP_RELEASE=.*/export APP_RELEASE=${{ github.event.release.tag_name }}/g" ./deploy/selfhost/install.sh
sed -i "s/APP_RELEASE=stable/APP_RELEASE=${{ github.event.release.tag_name }}/g" ./deploy/selfhost/install.sh

sed -i "s/^APP_RELEASE=.*/APP_RELEASE=${{ github.event.release.tag_name }}/" ./deploy/selfhost/variables.env

echo "Release Upload URL :::: ${{ github.event.release.upload_url }}"

- name: Upload docker-compose.yaml
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/docker-compose.yml
asset_name: docker-compose.yaml
asset_content_type: application/octet-stream

- name: Upload variables.env
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/variables.env
asset_name: variables.env
asset_content_type: application/octet-stream

- name: Upload setup.sh
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./deploy/selfhost/install.sh
asset_name: setup.sh
asset_content_type: application/octet-stream
32 changes: 32 additions & 0 deletions caddy/Caddyfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(plane_proxy) {
request_body {
max_size {$FILE_SIZE_LIMIT}
}

reverse_proxy /spaces/* space:3000

reverse_proxy /god-mode/* admin:3000

reverse_proxy /api/* api:8000

reverse_proxy /auth/* api:8000

reverse_proxy /{$BUCKET_NAME}/* plane-minio:9000

reverse_proxy /* web:3000
}

{
email {$CERT_EMAIL:admin@example.com}
acme_ca {$CERT_ACME_CA}
{$CERT_ACME_DNS}
servers {
max_header_size 5MB
client_ip_headers X-Forwarded-For X-Real-IP
trusted_proxies static {$TRUSTED_PROXIES:0.0.0.0/0}
}
}

{$SITE_ADDRESS} {
import plane_proxy
}
9 changes: 9 additions & 0 deletions caddy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM makeplane/caddy:latest

Check warning on line 1 in caddy/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

caddy/Dockerfile#L1

Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag
mguptahub marked this conversation as resolved.
Show resolved Hide resolved

COPY ./Caddyfile.template /etc/caddy/Caddyfile

COPY ./caddy.sh /docker-entrypoint.sh

RUN chmod +x /docker-entrypoint.sh

CMD ["/docker-entrypoint.sh"]
11 changes: 11 additions & 0 deletions caddy/caddy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

if [ "$APP_DOMAIN" == "localhost" ]; then
mguptahub marked this conversation as resolved.
Show resolved Hide resolved
export SITE_ADDRESS=":${LISTEN_HTTP_PORT}"
elif [ "$SSL" == "true" ]; then
export SITE_ADDRESS="${APP_DOMAIN}:${LISTEN_HTTPS_PORT}"
else
export SITE_ADDRESS="http://${APP_DOMAIN}:${LISTEN_HTTP_PORT}"
fi

exec caddy run --config /etc/caddy/Caddyfile
2 changes: 1 addition & 1 deletion deploy/selfhost/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ services:
proxy:
image: ${DOCKERHUB_USER:-local}/plane-proxy:${APP_RELEASE:-latest}
build:
context: ./nginx
context: ./caddy
dockerfile: ./Dockerfile
120 changes: 69 additions & 51 deletions deploy/selfhost/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
x-db-env: &db-env
PGHOST: ${PGHOST:-plane-db}
PGDATABASE: ${PGDATABASE:-plane}
POSTGRES_USER: ${POSTGRES_USER:-plane}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-plane}
POSTGRES_DB: ${POSTGRES_DB:-plane}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
PGDATA: ${PGDATA:-/var/lib/postgresql/data}

x-redis-env: &redis-env
REDIS_HOST: ${REDIS_HOST:-plane-redis}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_URL: ${REDIS_URL:-redis://plane-redis:6379/}

x-data-store-env: &data-store-env
USE_MINIO: ${USE_MINIO:-1}
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-access-key}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-secret-key}
AWS_REGION: ${AWS_REGION:-}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-access-key}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-secret-key}
AWS_S3_ENDPOINT_URL: ${AWS_S3_ENDPOINT_URL:-http://plane-minio:9000}
AWS_S3_BUCKET_NAME: ${AWS_S3_BUCKET_NAME:-uploads}
BUCKET_NAME: ${BUCKET_NAME:-uploads}

x-proxy-env: &proxy-env
SSL: ${SSL:-false}
APP_DOMAIN: ${APP_DOMAIN:-localhost}
FILE_SIZE_LIMIT: ${FILE_SIZE_LIMIT:-5242880}
CERT_EMAIL: ${CERT_EMAIL}
CERT_ACME_CA: ${CERT_ACME_CA:-}
LISTEN_HTTP_PORT: ${LISTEN_PORT:-80}
LISTEN_HTTPS_PORT: ${LISTEN_SSL_PORT:-443}

x-app-env: &app-env
environment:
- NGINX_PORT=${NGINX_PORT:-80}
- WEB_URL=${WEB_URL:-http://localhost}
- DEBUG=${DEBUG:-0}
- SENTRY_DSN=${SENTRY_DSN}
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT:-"production"}
- CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS}
# Gunicorn Workers
- GUNICORN_WORKERS=${GUNICORN_WORKERS:-1}
#DB SETTINGS
- PGHOST=${PGHOST:-plane-db}
- PGDATABASE=${PGDATABASE:-plane}
- POSTGRES_USER=${POSTGRES_USER:-plane}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-plane}
- POSTGRES_DB=${POSTGRES_DB:-plane}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- PGDATA=${PGDATA:-/var/lib/postgresql/data}
- DATABASE_URL=${DATABASE_URL:-postgresql://plane:plane@plane-db/plane}
# REDIS SETTINGS
- REDIS_HOST=${REDIS_HOST:-plane-redis}
- REDIS_PORT=${REDIS_PORT:-6379}
- REDIS_URL=${REDIS_URL:-redis://plane-redis:6379/}
# Application secret
- SECRET_KEY=${SECRET_KEY:-60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b5}
# DATA STORE SETTINGS
- USE_MINIO=${USE_MINIO:-1}
- AWS_REGION=${AWS_REGION:-""}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-"access-key"}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-"secret-key"}
- AWS_S3_ENDPOINT_URL=${AWS_S3_ENDPOINT_URL:-http://plane-minio:9000}
- AWS_S3_BUCKET_NAME=${AWS_S3_BUCKET_NAME:-uploads}
- MINIO_ROOT_USER=${MINIO_ROOT_USER:-"access-key"}
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-"secret-key"}
- BUCKET_NAME=${BUCKET_NAME:-uploads}
- FILE_SIZE_LIMIT=${FILE_SIZE_LIMIT:-5242880}
# Admin and Space URLs
- ADMIN_BASE_URL=${ADMIN_BASE_URL}
- SPACE_BASE_URL=${SPACE_BASE_URL}
- APP_BASE_URL=${APP_BASE_URL}
WEB_URL: ${WEB_URL:-http://localhost}
DEBUG: ${DEBUG:-0}
SENTRY_DSN: ${SENTRY_DSN}
SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT:-production}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS}
GUNICORN_WORKERS: 1
DATABASE_URL: ${DATABASE_URL:-postgresql://plane:plane@plane-db/plane}
SECRET_KEY: ${SECRET_KEY:-60gp0byfz2dvffa45cxl20p1scy9xbpf6d8c5y0geejgkyp1b5}
ADMIN_BASE_URL: ${ADMIN_BASE_URL}
SPACE_BASE_URL: ${SPACE_BASE_URL}
APP_BASE_URL: ${APP_BASE_URL}

services:
web:
<<: *app-env
image: ${DOCKERHUB_USER:-makeplane}/plane-frontend:${APP_RELEASE:-stable}
platform: ${DOCKER_PLATFORM:-}
pull_policy: if_not_present
Expand All @@ -54,7 +59,6 @@ services:
- worker

space:
<<: *app-env
image: ${DOCKERHUB_USER:-makeplane}/plane-space:${APP_RELEASE:-stable}
platform: ${DOCKER_PLATFORM:-}
pull_policy: if_not_present
Expand All @@ -68,7 +72,6 @@ services:
- web

admin:
<<: *app-env
image: ${DOCKERHUB_USER:-makeplane}/plane-admin:${APP_RELEASE:-stable}
platform: ${DOCKER_PLATFORM:-}
pull_policy: if_not_present
Expand All @@ -81,7 +84,6 @@ services:
- web

api:
<<: *app-env
image: ${DOCKERHUB_USER:-makeplane}/plane-backend:${APP_RELEASE:-stable}
platform: ${DOCKER_PLATFORM:-}
pull_policy: if_not_present
Expand All @@ -91,86 +93,99 @@ services:
replicas: ${API_REPLICAS:-1}
volumes:
- logs_api:/code/plane/logs
environment:
<<: [ *app-env, *db-env, *redis-env, *data-store-env, *proxy-env ]
depends_on:
- plane-db
- plane-redis

worker:
<<: *app-env
image: ${DOCKERHUB_USER:-makeplane}/plane-backend:${APP_RELEASE:-stable}
platform: ${DOCKER_PLATFORM:-}
pull_policy: if_not_present
restart: unless-stopped
command: ./bin/docker-entrypoint-worker.sh
volumes:
- logs_worker:/code/plane/logs
environment:
<<: [ *app-env, *db-env, *redis-env, *data-store-env, *proxy-env ]
depends_on:
- api
- plane-db
- plane-redis

beat-worker:
<<: *app-env
image: ${DOCKERHUB_USER:-makeplane}/plane-backend:${APP_RELEASE:-stable}
platform: ${DOCKER_PLATFORM:-}
pull_policy: if_not_present
restart: unless-stopped
command: ./bin/docker-entrypoint-beat.sh
volumes:
- logs_beat-worker:/code/plane/logs
environment:
<<: [ *app-env, *db-env, *redis-env, *data-store-env, *proxy-env ]
depends_on:
- api
- plane-db
- plane-redis

migrator:
<<: *app-env
image: ${DOCKERHUB_USER:-makeplane}/plane-backend:${APP_RELEASE:-stable}
platform: ${DOCKER_PLATFORM:-}
pull_policy: if_not_present
restart: "no"
command: ./bin/docker-entrypoint-migrator.sh
volumes:
- logs_migrator:/code/plane/logs
environment:
<<: [ *app-env, *db-env, *redis-env, *data-store-env, *proxy-env ]
depends_on:
- plane-db
- plane-redis

plane-db:
<<: *app-env
image: postgres:15.7-alpine
pull_policy: if_not_present
restart: unless-stopped
command: postgres -c 'max_connections=1000'
environment:
<<: *db-env
volumes:
- pgdata:/var/lib/postgresql/data

plane-redis:
<<: *app-env
image: valkey/valkey:7.2.5-alpine
pull_policy: if_not_present
restart: unless-stopped
environment:
<<: *redis-env
volumes:
- redisdata:/data

plane-minio:
<<: *app-env
image: minio/minio:latest
pull_policy: if_not_present
restart: unless-stopped
command: server /export --console-address ":9090"
environment:
<<: *data-store-env
volumes:
- uploads:/export

# Comment this if you already have a reverse proxy running
proxy:
<<: *app-env
image: ${DOCKERHUB_USER:-makeplane}/plane-proxy:${APP_RELEASE:-stable}
platform: ${DOCKER_PLATFORM:-}
pull_policy: if_not_present
restart: unless-stopped
ports:
- ${NGINX_PORT}:80
- ${LISTEN_HTTP_PORT:-80}:${LISTEN_HTTP_PORT:-80}
- ${LISTEN_HTTPS_PORT:-443}:${LISTEN_HTTPS_PORT:-443}
volumes:
- caddy_config:/config
- caddy_data:/data
environment:
<<: *proxy-env
depends_on:
- web
- api
Expand All @@ -184,3 +199,6 @@ volumes:
logs_worker:
logs_beat-worker:
logs_migrator:
caddy_config:
caddy_data:

mguptahub marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading