Skip to content

Commit

Permalink
Merge branch 'main' into jamesbursa/1686-load-legacy-to-staging
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbursa committed May 6, 2024
2 parents 1fd0be3 + 58dd9ec commit 5969154
Show file tree
Hide file tree
Showing 107 changed files with 1,588 additions and 214 deletions.
40 changes: 40 additions & 0 deletions .github/linters/scripts/check-wiki-pages-linked-to-summary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /bin/bash
# Usage: ./scripts/check-wiki-pages-linked-to-summary.sh
# Checks that all pages in the documentation/wiki/ sub-directory are linked to SUMMARY.md

REPO_ROOT="../.."
WIKI_DIR="${REPO_ROOT}/documentation/wiki"
TEMP_DIR="./tmp"
WIKI_FILES="${TEMP_DIR}/wiki-files.txt"
SUMMARY_FILES="${TEMP_DIR}/summary-files.txt"
MISSING_FILES="${TEMP_DIR}/missing-from-summary.txt"
mkdir -p tmp # create tmp directory

# list all of the markdown files in the wiki directory
find "${WIKI_DIR}" -name "*.md" |\
# make file paths relative to the root of the wiki directory
sed -E "s|${WIKI_DIR}/(.*)|\1|" |\
# filter out the SUMMARY.md file
grep -Ev '(SUMMARY.md)' |\
# sort the files alphabetically and write to a temporary file
sort > $WIKI_FILES

# list all of the markdown files linked in the SUMMARY.md file
grep -oE '\((.*\.md)\)' "${WIKI_DIR}/SUMMARY.md" |\
# remove the extra parantheses around the markdown files
sed -E "s|\((.+)\)|\1|" |\
# sort the files alphabetically and write to a temporary file
sort > $SUMMARY_FILES

# find files that are in the wiki but not in the summary
comm -2 -3 $WIKI_FILES $SUMMARY_FILES > $MISSING_FILES

# if there are missing files exit with a non-zero code and print them
if [[ -z "$(cat ${MISSING_FILES})" ]]; then
echo "All files added to summary"
exit 0
else
echo "The following files need to be added to documentation/wiki/SUMMARY.md:"
cat $MISSING_FILES
exit 1
fi
4 changes: 2 additions & 2 deletions .github/workflows/cd-analytics-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false

- name: Configure AWS credentials
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false

- name: Configure AWS credentials
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-api-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false

- name: Configure AWS credentials
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false

- name: Configure AWS credentials
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-frontend-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false

- name: Configure AWS credentials
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false

- name: Configure AWS credentials
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: ./.github/workflows/deploy.yml
strategy:
matrix:
envs: ${{ github.event_name == 'release' && fromJSON('["prod"]') || github.ref_name == 'main' && fromJSON('["dev", "staging"]') || fromJSON('["dev"]') }}
envs: ${{ github.event_name == 'release' && fromJSON('["prod"]') || github.ref_name == 'main' && fromJSON('["dev"]') || fromJSON('["dev"]') }} # temporarily removing staging from matrix. See: https://github.com/HHS/simpler-grants-gov/issues/1919
with:
app_name: "frontend"
environment: ${{ matrix.envs }}
4 changes: 2 additions & 2 deletions .github/workflows/ci-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false
- name: Run infra-lint-terraform
run: |
Expand All @@ -56,7 +56,7 @@ jobs:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false
- name: Validate
run: make infra-validate-modules
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/ci-wiki-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Checks that all of the markdown files in /documentation/wiki/
# have been added to documenation/wiki/SUMMARY.md
name: CI - Check wiki links

on:
pull_request:
paths:
- documentation/wiki/**
- .github/workflows/ci-wiki-links.yml
- .github/linters/scripts/check-wiki-pages-linked-to-summary.sh

defaults:
run:
working-directory: ./.github/linters # ensures that this job runs from the ./linters sub-directory

jobs:
check-wiki-links:
name: Check wiki links in SUMMARY.md
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check all wiki files are linked in SUMMARY.md
run: ./scripts/check-wiki-pages-linked-to-summary.sh
2 changes: 1 addition & 1 deletion .github/workflows/infra-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.7.1
terraform_version: 1.8.2
terraform_wrapper: false

- uses: actions/setup-go@v3
Expand Down
24 changes: 24 additions & 0 deletions analytics/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ version: '3'

services:

grants-analytics-db:
image: postgres:15-alpine
container_name: grants-analytics-db
command: postgres -c "log_lock_waits=on" -N 1000 -c "fsync=off"
env_file: ./local.env
ports:
- "5432:5432"
volumes:
- grantsanalyticsdbdata:/var/lib/postgresql/data

grants-analytics:
build:
context: .
Expand All @@ -13,3 +23,17 @@ services:
volumes:
- .:/analytics
- ~/.ssh:/home/${RUN_USER:-analytics}/.ssh
depends_on:
- grants-analytics-db

grants-metabase:
image: metabase/metabase:latest
container_name: grants-metabase
volumes:
- /dev/urandom:/dev/random:ro
ports:
- 3100:3000
env_file: ./local.env

volumes:
grantsanalyticsdbdata:
30 changes: 30 additions & 0 deletions analytics/local.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
############################
# DB Environment Variables #
############################

# These are used by the Postgres image to create the admin user
POSTGRES_USER=app
POSTGRES_PASSWORD=secret123

# Set DB_HOST to localhost if accessing a non-dockerized database
DB_HOST=grants-analytics-db
DB_NAME=app
DB_USER=app
DB_PASSWORD=secret123
DB_SSL_MODE=allow

# When an error occurs with a SQL query,
# whether or not to hide the parameters which
# could contain sensitive information.
HIDE_SQL_PARAMETER_LOGS=TRUE

##################################
# Metabase Environment Variables #
##################################

MB_DB_TYPE=postgres
MB_DB_DBNAME=app
MB_DB_PORT=5432
MB_DB_USER=app
MB_DB_PASS=secret123
MB_DB_HOST=grants-analytics-db
Loading

0 comments on commit 5969154

Please sign in to comment.