From 728213e3fd3fe318534fbbac78acbe6d2d7b0105 Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Sun, 19 Nov 2023 01:48:05 +0530 Subject: [PATCH] dev: environment settings (#2794) * dev: update environment configuration * dev: update the takeoff script for instance registration --- apiserver/.env.example | 2 +- apiserver/bin/takeoff | 15 +++++++++++---- apiserver/plane/settings/common.py | 5 +---- deploy/selfhost/docker-compose.yml | 2 +- deploy/selfhost/variables.env | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/apiserver/.env.example b/apiserver/.env.example index 2078fc94a..88a9c17f5 100644 --- a/apiserver/.env.example +++ b/apiserver/.env.example @@ -2,10 +2,10 @@ # Debug value for api server use it as 0 for production use DEBUG=0 CORS_ALLOWED_ORIGINS="" -ENVIRONMENT="development" # Error logs SENTRY_DSN="" +SENTRY_ENVIRONMENT="development" # Database Settings PGUSER="plane" diff --git a/apiserver/bin/takeoff b/apiserver/bin/takeoff index 44f251155..13e557edc 100755 --- a/apiserver/bin/takeoff +++ b/apiserver/bin/takeoff @@ -3,10 +3,17 @@ set -e python manage.py wait_for_db python manage.py migrate -# Register instance -python manage.py register_instance -# Load the configuration variable -python manage.py configure_instance +# Set default value for ENABLE_REGISTRATION +ENABLE_REGISTRATION=${ENABLE_REGISTRATION:-1} + +# Check if ENABLE_REGISTRATION is not set to '0' +if [ "$ENABLE_REGISTRATION" != "0" ]; then + # Register instance + python manage.py register_instance + # Load the configuration variable + python manage.py configure_instance +fi + # Create the default bucket python bin/bucket_script.py diff --git a/apiserver/plane/settings/common.py b/apiserver/plane/settings/common.py index 0ef96717f..f6359344d 100644 --- a/apiserver/plane/settings/common.py +++ b/apiserver/plane/settings/common.py @@ -27,9 +27,6 @@ DEBUG = False # Allowed Hosts ALLOWED_HOSTS = ["*"] -# Redirect if / is not present -APPEND_SLASH = True - # Application definition INSTALLED_APPS = [ "django.contrib.auth", @@ -301,7 +298,7 @@ if bool(os.environ.get("SENTRY_DSN", False)): ], traces_sample_rate=1, send_default_pii=True, - environment=os.environ.get("ENVIRONMENT", "development"), + environment=os.environ.get("SENTRY_ENVIRONMENT", "development"), profiles_sample_rate=1.0, ) diff --git a/deploy/selfhost/docker-compose.yml b/deploy/selfhost/docker-compose.yml index 74377aef0..d324605ef 100644 --- a/deploy/selfhost/docker-compose.yml +++ b/deploy/selfhost/docker-compose.yml @@ -12,7 +12,7 @@ x-app-env : &app-env - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-""} - DOCKERIZED=${DOCKERIZED:-1} # deprecated - CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS:-""} - - ENVIRONMENT=${ENVIRONMENT:-"production"} + - SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT:-"production"} # Gunicorn Workers - GUNICORN_WORKERS=${GUNICORN_WORKERS:-2} #DB SETTINGS diff --git a/deploy/selfhost/variables.env b/deploy/selfhost/variables.env index f74c838e7..0a47395c3 100644 --- a/deploy/selfhost/variables.env +++ b/deploy/selfhost/variables.env @@ -14,7 +14,7 @@ SENTRY_DSN="" GITHUB_CLIENT_SECRET="" DOCKERIZED=1 # deprecated CORS_ALLOWED_ORIGINS="" -ENVIRONMENT="production" +SENTRY_ENVIRONMENT="production" #DB SETTINGS PGHOST=plane-db