Skip to content

Commit

Permalink
add changes required for dbt platform
Browse files Browse the repository at this point in the history
Fix repository name

Downgrade paketobuildpacks/builder-jammy-full

trigger build

add prebuild script to get submodules

Downgrade Paketo buildpack to get older version of Python

Bump buildpack

Bump buildpack

Add runtime.txt file with Python version

Remove runtime.txt

chore: specify required python version in pyroject.toml

chore: specify required python version in pyroject.toml in single quotes

chore: specify version of python in runtime.txt

chore: add pipenv install --deploy to pre_build phase

chore: remove pipenv install deploy from pre build phase

update python version in runtime

bump builder version

revert back to python 3.8

update python version to 3.9

update pipfile.lock

remove typed-ast package

Remove comment as this is seen as a deployable process

Add debugging for failed build

Improve debugging

Print what's in /layers for debugging

Debug pack

Debug in image_build_run.sh

Test full version of Python configuration

Remove debugging

revert debug changes

update pipfile.lock

disable health checks that aren't working

Add required Redis flags

re-enable health check for storage

remove redit config from settings file

disable storage healthcheck

test: remove all healthchecks other than the main one

renable celery health checks

Debug plugins

remove plugins log line

add additional debug lines

disable celery plugins

remove debug logging and commented out code

run linter

re-add redis config

Try serving assets relative from the project root

Enable Sentry APM

Remove unused runtime.txt

Revert "Remove unused runtime.txt"

This reverts commit 0e7e489.

Revert health checks and static asset path

Remove typed-ast

update pipfile.lock

remove comments from phases

revert pipfile

re-add health checks when not in dbt platform
  • Loading branch information
emileswarts authored and james-francis-MT committed Sep 17, 2024
1 parent 6b5510e commit 2911de0
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 11 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/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 <<EOF > ./.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"
1 change: 0 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -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
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",
]

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",
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

0 comments on commit 2911de0

Please sign in to comment.