Skip to content

Commit

Permalink
Merge pull request #281 from uktrade/dev-migration
Browse files Browse the repository at this point in the history
DBT Platform Migration
  • Loading branch information
depsiatwal authored Nov 11, 2024
2 parents b8e4a96 + 9cd82bf commit ffcb02d
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .copilot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
repository: lite/lite-hmrc
builder:
name: paketobuildpacks/builder-jammy-full
version: 0.3.339
6 changes: 6 additions & 0 deletions .copilot/image_build_run.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions .copilot/phases/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

set -e

4 changes: 4 additions & 0 deletions .copilot/phases/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

set -e

4 changes: 4 additions & 0 deletions .copilot/phases/post_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

set -e

18 changes: 18 additions & 0 deletions .copilot/phases/pre_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -e

git_clone_base_url="https://codestar-connections.eu-west-2.amazonaws.com/git-http/$AWS_ACCOUNT_ID/eu-west-2/$CODESTAR_CONNECTION_ID/uktrade"

git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true

cat <<EOF > ./.gitmodules
[submodule "django_db_anonymiser"]
path = django_db_anonymiser
url = $git_clone_base_url/django-db-anonymiser.git
EOF

git submodule update --init --recursive

echo "done"
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 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
dump-and-anonymise: python manage.py dump-and-anonymise
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ which is capable of sending lite-hmrc formatted emails. Details of how this sho
be used are present in the help text for the command.

# Linting

- Code formatting and conventions

[Black](https://black.readthedocs.io/en/stable/) and isort are used in this project to enforce a consistent code style.
Expand Down
31 changes: 21 additions & 10 deletions conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"healthcheck",
"health_check.contrib.migrations",
]

if not IS_ENV_DBT_PLATFORM:
INSTALLED_APPS += [
"health_check.db",
"health_check.cache",
"health_check.storage",
"health_check.contrib.celery",
"health_check.contrib.celery_ping",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.9.19

0 comments on commit ffcb02d

Please sign in to comment.