diff --git a/.copilot/config.yml b/.copilot/config.yml new file mode 100644 index 00000000..5570cb64 --- /dev/null +++ b/.copilot/config.yml @@ -0,0 +1,4 @@ +repository: lite/lite-hmrc +builder: + name: paketobuildpacks/builder-jammy-full + version: 0.3.339 diff --git a/.copilot/image_build_run.sh b/.copilot/image_build_run.sh new file mode 100755 index 00000000..233cc20b --- /dev/null +++ b/.copilot/image_build_run.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Exit early if something goes wrong +set -x + +# Add commands below to run inside the container after all the other buildpacks have been applied \ No newline at end of file diff --git a/.copilot/phases/build.sh b/.copilot/phases/build.sh new file mode 100644 index 00000000..7e96b6b0 --- /dev/null +++ b/.copilot/phases/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +set -e + diff --git a/.copilot/phases/install.sh b/.copilot/phases/install.sh new file mode 100644 index 00000000..7e96b6b0 --- /dev/null +++ b/.copilot/phases/install.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +set -e + diff --git a/.copilot/phases/post_build.sh b/.copilot/phases/post_build.sh new file mode 100644 index 00000000..7e96b6b0 --- /dev/null +++ b/.copilot/phases/post_build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +set -e + diff --git a/.copilot/phases/pre_build.sh b/.copilot/phases/pre_build.sh new file mode 100644 index 00000000..fed34d03 --- /dev/null +++ b/.copilot/phases/pre_build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -e + +git_clone_base_url="https://codestar-connections.eu-west-2.amazonaws.com/git-http/730335529260/eu-west-2/192881c6-e3f2-41a9-9dcb-fcc87d8b90be/uktrade" + +git config --global credential.helper '!aws codecommit credential-helper $@' +git config --global credential.UseHttpPath true + +cat < ./.gitmodules +[submodule "django_db_anonymiser"] + path = django_db_anonymiser + url = $git_clone_base_url/django-db-anonymiser.git +EOF + +git submodule update --init --remote --recursive + +echo "done" diff --git a/Procfile b/Procfile index dc030945..0a7bb140 100644 --- a/Procfile +++ b/Procfile @@ -1,4 +1,3 @@ -# See gunicorn.conf.py for more configuration. web: python manage.py migrate && gunicorn conf.wsgi:application celeryworker: celery -A conf worker -l info celerybeat: celery -A conf beat -l info diff --git a/conf/settings.py b/conf/settings.py index b555bf84..b7134e6f 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -49,18 +49,21 @@ "django.contrib.messages", "django.contrib.staticfiles", "mail", - # healthcheck app is for custom healthchecks in this app, health_check is django-health-check - "healthcheck", "health_check", - "health_check.db", - "health_check.cache", - "health_check.storage", - "health_check.contrib.migrations", - "health_check.contrib.celery", - "health_check.contrib.celery_ping", "django_db_anonymiser.db_anonymiser", ] +if not IS_ENV_DBT_PLATFORM: + INSTALLED_APPS += [ + "healthcheck", + "health_check.db", + "health_check.cache", + "health_check.storage", + "health_check.contrib.migrations", + "health_check.contrib.celery", + "health_check.contrib.celery_ping", + ] + MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", @@ -230,6 +233,7 @@ environment=env.str("SENTRY_ENVIRONMENT"), integrations=[DjangoIntegration()], send_default_pii=True, + traces_sample_rate=env.float("SENTRY_TRACES_SAMPLE_RATE", 1.0), ) SENTRY_ENABLED = True else: @@ -322,8 +326,15 @@ def _build_redis_url(base_url, db_number, **query_args): } REDIS_BASE_URL = env("REDIS_BASE_URL", default=None) - CELERY_BROKER_URL = env("CELERY_BROKER_URL", default=None) - CELERY_RESULT_BACKEND = CELERY_BROKER_URL + REDIS_CELERY_DB = env("REDIS_CELERY_DB", default=0) + + if REDIS_BASE_URL: + is_redis_ssl = REDIS_BASE_URL.startswith("rediss://") + url_args = {"ssl_cert_reqs": "CERT_REQUIRED"} if is_redis_ssl else {} + + CELERY_BROKER_URL = _build_redis_url(REDIS_BASE_URL, REDIS_CELERY_DB, **url_args) + CELERY_RESULT_BACKEND = CELERY_BROKER_URL + CACHES = { "default": { "BACKEND": "django.core.cache.backends.redis.RedisCache", diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 00000000..8fdd9071 --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +python-3.9