Skip to content

Commit

Permalink
Merge branch 'main' into ans_wagtail_charts_tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
anselmbradford authored Jan 29, 2025
2 parents b2c55c1 + 290b18c commit 946444e
Show file tree
Hide file tree
Showing 649 changed files with 5,052 additions and 54,615 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
!dump-data.sh
!Dockerfile
!frontend.sh
!index.sh
!initial-data.sh
!jest.config.js
!package.json
!refresh-data.sh
!test.sql.gz
!yarn.lock

# ...but DO ignore these others
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: backend

on:
workflow_dispatch:
paths:
- '**.py'
- 'requirements/**.txt'
- '**.html'
- '**.mo'
- '**.po'
pull_request:
paths:
- '**.py'
Expand All @@ -16,12 +10,6 @@ on:
- '**.mo'
- '**.po'
merge_group:
paths:
- '**.py'
- 'requirements/**.txt'
- '**.html'
- '**.mo'
- '**.po'

jobs:
backend:
Expand Down
53 changes: 40 additions & 13 deletions .github/workflows/build-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:

jobs:
Build:
if: "! github.event.pull_request.head.repo.fork"
runs-on: ubuntu-latest
env:
ARTIFACT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
Expand All @@ -20,25 +19,53 @@ jobs:
with:
node-version: '20.x'

- name: Install Act dependencies (if needed)
if: ${{ env.ACT }}
run: corepack enable

- name: Install dependencies
run: yarn

- name: Build frontend
run: yarn run build

- name: Run the build process with Docker
uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
image: ghcr.io/${{ github.repository }}-builder:main
options: -v ${{ github.workspace }}:/cfgov
run: |
source scl_source enable rh-python38
./call_create.sh
- name: Upload arifact
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull image to build artifact
run: docker pull ghcr.io/cfpb/cfgov-artifact-builder:latest

- name: Build artifact
run: |
docker run \
-v `pwd`:/cfgov \
ghcr.io/cfpb/cfgov-artifact-builder:latest
- name: Pull image to test artifact
run: docker pull ghcr.io/cfpb/cfgov-artifact-tester:latest

- name: Run built artifact as a Docker container
run: |
docker run \
--name cfgov \
-d \
-v `pwd`:/cfgov:ro \
-p 8000:80 \
--env-file docker/centos7/test.env \
ghcr.io/cfpb/cfgov-artifact-tester:latest
- name: Wait for artifact container to be ready
run: |
timeout 180s bash -c \
'until [ "$(docker inspect -f {{.State.Health.Status}} cfgov)" == "healthy" ]; do sleep 2; done'
# Don't upload artifacts to S3 if PR is against a fork.
- name: Upload artifact to S3
if: "! github.event.pull_request.head.repo.fork"
uses: keithweaver/[email protected]
with:
command: cp
Expand Down
41 changes: 22 additions & 19 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: Create and publish a Docker image that can be used to build a deployable zipfile
name: Maintain deployable zipfile Docker images

on:
push:
branches: ['main']
paths:
- 'docker/builder/**'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-builder
- 'docker/centos7/**'
workflow_dispatch:

jobs:
build-and-push-image:
Expand All @@ -25,20 +22,26 @@ jobs:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build deployable zipfile builder image
run: |
docker build docker/centos7 \
--target=cfgov-artifact-builder \
-t ghcr.io/cfpb/cfgov-artifact-builder:latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./docker/builder/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build deployable zipfile tester image
run: |
docker build docker/centos7 \
--target=cfgov-artifact-tester \
-t ghcr.io/cfpb/cfgov-artifact-tester:latest
- name: Push deployable zipfile builder image
run: |
docker push ghcr.io/cfpb/cfgov-artifact-builder:latest
- name: Push deployable zipfile tester image
run: |
docker push ghcr.io/cfpb/cfgov-artifact-tester:latest
6 changes: 0 additions & 6 deletions .github/workflows/filter-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ on:
- '**.mo'
- '**.po'
merge_group:
paths-ignore:
- '**.py'
- 'requirements/**.txt'
- '**.html'
- '**.mo'
- '**.po'

jobs:
backend:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Helm testing
on:
pull_request:
paths:
- helm/**

jobs:
helm:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Helm
uses: azure/setup-helm@v4

- name: Install Helm dependencies
run: helm dependency update helm

- name: Lint Helm chart
run: helm lint --strict -f helm/values.local.yaml helm
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ cfgov/regulations3k/jinja2/regulations3k/regulations3k-service-worker.js.map
cfgov/regulations3k/jinja2/regulations3k/workbox-*.js
cfgov/regulations3k/jinja2/regulations3k/workbox-*.js.map

# Helm Charts #
helm/apache/
helm/charts/

# Apache #
##########
cfgov/apache/logs
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cfgov/retirement_api/data/
cfgov/static_built/
**/fixtures/
collectstatic/
helm/

# Ignore all HTML files:
*.html
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ ENV ALLOWED_HOSTS '["*"]'
# Copy the application code over
COPY cfgov ./cfgov/
COPY static.in ./static.in/
COPY refresh-data.sh .
COPY initial-data.sh .
COPY index.sh .
COPY test.sql.gz .

# Copy our static build over from node-builder
COPY --from=node-builder ${APP_HOME} ${APP_HOME}
Expand All @@ -170,4 +174,4 @@ RUN chown -R ${USERNAME}:${USERNAME} ${APP_HOME}
USER $USERNAME

# Run Gunicorn
CMD gunicorn cfgov.wsgi:application -b :8000
CMD gunicorn --reload cfgov.wsgi:application -b :8000
12 changes: 0 additions & 12 deletions cfgov/apache/conf.d/status.conf

This file was deleted.

2 changes: 1 addition & 1 deletion cfgov/apache/conf.modules.d/00-base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule socache_dbm_module modules/mod_socache_dbm.so
LoadModule socache_memcache_module modules/mod_socache_memcache.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule status_module modules/mod_status.so
# LoadModule status_module modules/mod_status.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule unique_id_module modules/mod_unique_id.so
Expand Down
1 change: 0 additions & 1 deletion cfgov/apache/conf/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ PassEnv APACHE_UPLOADS_F_ALIAS
PassEnv APACHE_HTTPS_FORWARDED_HOST
PassEnv APACHE_PORT
PassEnv LIMIT_REQUEST_BODY
PassEnv APACHE_STATUS_ALLOW_FROM

# These values are needed for running in containerized Apache
PassEnv APACHE_USER
Expand Down
24 changes: 24 additions & 0 deletions cfgov/apache/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM httpd:2.4-alpine

# Copy the Apache configuration file
COPY ./conf /usr/local/apache2/conf
COPY ./conf.d /usr/local/apache2/conf.d
COPY ./conf.modules.d /usr/local/apache2/conf.modules.d

# Add Apache ENV variables
ENV APACHE_PORT="80"
ENV APACHE_USER="www-data"
ENV APACHE_GROUP="www-data"
ENV APACHE_SERVER_ROOT="/usr/local/apache2/"
ENV APACHE_UPLOADS_F_ALIAS="/src/consumerfinance.gov/cfgov/f/"
ENV STATIC_PATH="/tmp"
ENV ERROR_LOG="/proc/self/fd/2"
ENV ACCESS_LOG="/proc/self/fd/1"
ENV LIMIT_REQUEST_BODY="0"
ENV APACHE_STATUS_ALLOW_FROM="127.0.0.1"
ENV APACHE_PROCESS_COUNT="4"
ENV CFGOV_APPLICATION_HOST="localhost"

EXPOSE 80

CMD ["httpd-foreground"]
Loading

0 comments on commit 946444e

Please sign in to comment.