Skip to content

Commit

Permalink
Merge pull request #5339 from uktrade/DPM-118-dbt-platform-deploy-con…
Browse files Browse the repository at this point in the history
…figuration

DPM-118 dbt platform deploy configuration
  • Loading branch information
acodeninja authored Apr 8, 2024
2 parents 478e285 + 01fa4c1 commit a4c1ab1
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 2 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: data-hub-api
builder:
name: paketobuildpacks/builder-jammy-full
version: 0.3.339
43 changes: 43 additions & 0 deletions .copilot/image_build_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

# Exit early if something goes wrong
set -e

# Add commands below to run inside the container after all the other buildpacks have been applied
export ADMIN_OAUTH2_ENABLED="True"
export ADMIN_OAUTH2_BASE_URL=""
export ADMIN_OAUTH2_TOKEN_FETCH_PATH="/o/token/"
export ADMIN_OAUTH2_USER_PROFILE_PATH="/o/v1/user/me/"
export ADMIN_OAUTH2_AUTH_PATH="/o/authorize/"
export ADMIN_OAUTH2_CLIENT_ID="client-id"
export ADMIN_OAUTH2_CLIENT_SECRET="client-secret"
export ADMIN_OAUTH2_LOGOUT_PATH="/o/logout"
export ACTIVITY_STREAM_ACCESS_KEY_ID="some-id"
export ACTIVITY_STREAM_SECRET_ACCESS_KEY="some-secret"
export DATABASE_URL="postgresql://postgres:datahub@postgres/datahub"
export DEBUG="True"
export DJANGO_SECRET_KEY="changeme"
export DJANGO_SETTINGS_MODULE="config.settings.local"
export ES_INDEX_PREFIX="test_index"
export ES5_URL="http://localhost:9200"
export OPENSEARCH_URL="http://localhost:9200"
export OPENSEARCH_INDEX_PREFIX="test_index"
export PAAS_IP_ALLOWLIST="1.2.3.4"
export AWS_DEFAULT_REGION="eu-west-2"
export AWS_ACCESS_KEY_ID="foo"
export AWS_SECRET_ACCESS_KEY="bar"
export DEFAULT_BUCKET="baz"
export SSO_ENABLED="True"
export STAFF_SSO_BASE_URL="http://sso.invalid/"
export STAFF_SSO_AUTH_TOKEN="sso-token"
export DIT_EMAIL_DOMAINS="trade.gov.uk,digital.trade.gov.uk"
export DATA_HUB_FRONTEND_ACCESS_KEY_ID="frontend-key-id"
export DATA_HUB_FRONTEND_SECRET_ACCESS_KEY="frontend-key"
export ES_APM_ENABLED="False"
export ES_APM_SERVICE_NAME="datahub"
export ES_APM_SECRET_TOKEN=""
export ES_APM_SERVER_URL="http://localhost:8200"
export ES_APM_ENVIRONMENT="circleci"
export REDIS_BASE_URL="redis://localhost:6379"

python manage.py collectstatic --noinput
6 changes: 6 additions & 0 deletions .copilot/phases/build.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 -e

# Add commands below to run as part of the build phase
6 changes: 6 additions & 0 deletions .copilot/phases/install.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 -e

# Add commands below to run as part of the install phase
6 changes: 6 additions & 0 deletions .copilot/phases/post_build.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 -e

# Add commands below to run as part of the post_build phase
6 changes: 6 additions & 0 deletions .copilot/phases/pre_build.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 -e

# Add commands below to run as part of the pre_build phase
10 changes: 8 additions & 2 deletions web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ if [ -z "$SKIP_OPENSEARCH_MAPPING_MIGRATIONS" ] && [ "${CF_INSTANCE_INDEX:-0}" =
./manage.py migrate_search
fi

python manage.py collectstatic --noinput
python app.py
if [ -n "${COPILOT_ENVIRONMENT_NAME}" ]; then
echo "Running in DBT Platform"
python app.py
else
echo "Running in Cloud Foundry"
python manage.py collectstatic --noinput
python app.py
fi

0 comments on commit a4c1ab1

Please sign in to comment.