Skip to content

Commit a896ccd

Browse files
authored
Merge pull request #191 from caktus/develop
Prepare production release v1.9.0
2 parents 97766ab + 82ac074 commit a896ccd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+78836
-12944
lines changed

.github/workflows/deploy.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ jobs:
1414
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1515
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
with:
1919
fetch-depth: 0
2020
- name: Set env vars (production)
2121
if: endsWith(github.ref, '/main')
2222
run: |
2323
echo "ENV=production" >> $GITHUB_ENV
2424
echo "ENV_URL=https://nccopwatch.org/" >> $GITHUB_ENV
25-
- uses: actions/setup-python@v2
25+
- uses: actions/setup-python@v4
2626
with:
2727
python-version: '3.9'
2828
cache: 'pip'

.github/workflows/test.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
ports:
2626
- 5432:5432
2727
steps:
28-
- uses: actions/checkout@v2
29-
- uses: actions/setup-python@v2
28+
- uses: actions/checkout@v3
29+
- uses: actions/setup-python@v4
3030
with:
3131
python-version: '3.9'
3232
cache: 'pip'
@@ -36,7 +36,7 @@ jobs:
3636
sudo apt update
3737
sudo apt install -y --no-install-recommends postgresql-client-14
3838
python -m pip install pip-tools
39-
pip-sync requirements/base/base.txt requirements/test/test.txt
39+
pip-sync requirements/base/base.txt requirements/dev/dev.txt requirements/test/test.txt
4040
- name: Create NC database
4141
run: |
4242
psql $DATABASE_URL -c 'CREATE DATABASE traffic_stops_nc;'
@@ -49,3 +49,6 @@ jobs:
4949
DJANGO_SETTINGS_MODULE: traffic_stops.settings.dev
5050
DATABASE_URL: postgres://postgres:postgres@localhost:5432/traffic_stops
5151
DATABASE_URL_NC: postgres://postgres:postgres@localhost:5432/traffic_stops_nc
52+
- name: Test deploy image build
53+
run: |
54+
inv image.build

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ aws_ec2.yml
5353
deploy/roles
5454
docker-compose.override.yml
5555
htmlcov
56+
nc/notebooks/**/**.html
5657
acs*.json

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ repos:
2323
- id: check-yaml
2424
exclude: '^(deployment/|deploy)'
2525
- id: check-added-large-files
26+
args: ['--maxkb=8000']
2627
- id: check-json
2728
exclude: .devcontainer/devcontainer.json|.vscode/launch.json|frontend/.eslintrc.json
2829
- id: check-docstring-first

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM node:16-bullseye-slim as static_files
33
WORKDIR /code
44
ENV PATH /code/node_modules/.bin:$PATH
55
COPY frontend/package.json frontend/package-lock.json /code/
6+
RUN npm install -g npm@latest
67
RUN npm install --silent
78
COPY frontend/ /code/
89
RUN npm run build

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ dl-db-dump:
3333
export AWS_PROFILE=copwatch
3434
inv aws.configure-eks-kubeconfig
3535
inv staging pod.get-db-dump --db-var=DATABASE_URL_NC
36+
37+
refresh-view:
38+
@echo 'Migrating all databases'
39+
./migrate_all_dbs.sh
40+
@echo 'Refreshing the StopSummary materialized view'
41+
python manage.py refresh_pgviews --database=traffic_stops_nc

deploy/group_vars/all.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ cloudformation_stack:
5151
DatabaseUser: "{{ app_name }}_admin"
5252
DatabasePassword: "{{ admin_database_password }}"
5353
DatabaseName: "{{ app_name }}"
54-
DomainName: "{{ app_name }}.caktus-built.com"
54+
DomainName: nccopwatch.org
5555
DomainNameAlternates: ""
56-
AssetsUseCloudFront: "false"
56+
AssetsCloudFrontDomain: files.nccopwatch.org
57+
AssetsCloudFrontCertArn: arn:aws:acm:us-east-1:606178775542:certificate/379950bb-4b29-4308-8418-122674fe1076
58+
AssetsUseCloudFront: "true"
5759
tags:
5860
Environment: "{{ app_name }}"
5961

deploy/group_vars/k8s.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ k8s_container_resources:
3131
requests:
3232
memory: 256Mi
3333
cpu: 50m
34-
limits:
35-
cpu: 250m
3634
k8s_migrations_enabled: true
35+
k8s_migrations_timeout: 300 # 5 minutes
3736
k8s_migration_command:
3837
- bash
3938
- migrate_all_dbs.sh
@@ -62,10 +61,12 @@ env_database_url_nc: "postgres://{{ app_name }}_{{ env_name }}:{{ database_passw
6261
env_django_settings: "traffic_stops.settings.deploy"
6362
env_broker_url: redis://redis:6379/0
6463
env_cache_host: redis://redis:6379/1
65-
env_default_file_storage: "{{ app_name }}.storages.MediaBoto3Storage"
66-
env_media_storage_bucket_name: "{{ app_name }}-{{ env_name }}-assets"
64+
# Uploaded media files
65+
env_default_file_storage: "traffic_stops.storages.MediaBoto3Storage"
6766
env_aws_default_acl: public-read
68-
env_media_location: media/
67+
env_media_storage_bucket_name: trafficstops-stack-assetsbucket-y0dbtam3g132
68+
env_media_storage_custom_domain: files.nccopwatch.org
69+
env_media_location: ""
6970
# New Relic Account: forwardjustice-team@caktusgroup.com
7071
env_new_relic_app_name: "{{ k8s_namespace }}"
7172
env_new_relic_license_key: "{{ k8s_newrelic_license_key }}"
@@ -109,6 +110,7 @@ k8s_environment_variables:
109110
# *** Uploaded media
110111
DEFAULT_FILE_STORAGE: "{{ env_default_file_storage }}"
111112
MEDIA_STORAGE_BUCKET_NAME: "{{ env_media_storage_bucket_name }}"
113+
MEDIA_S3_CUSTOM_DOMAIN: "{{ env_media_storage_custom_domain }}"
112114
AWS_DEFAULT_ACL: "{{ env_aws_default_acl }}"
113115
AWS_DEFAULT_REGION: "{{ aws_region }}"
114116
MEDIA_LOCATION: "{{ env_media_location }}"

deploy/host_vars/staging.yml

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ k8s_domain_names:
66
env_contact_us_emails:
77
- forwardjustice-team@caktusgroup.com
88

9+
env_media_location: "staging/"
10+
911
database_password: !vault |
1012
$ANSIBLE_VAULT;1.1;AES256
1113
66636130383863366430366534663963316536393136316164336535613635353339646430306536

0 commit comments

Comments
 (0)