Skip to content

Commit 9cd50e0

Browse files
DPC-5117 solid queue as separate service (#2915)
## 🎫 Ticket https://jira.cms.gov/browse/DPC-5117 ## 🛠 Changes - Solid Queue initialization moved from puma to Proc files - Async portal added to check_healthy on deploy - Check healthy script unused parameter removed; check for target removed for async - Docker entrypoint includes separate async section ## ℹ️ Context We want to separate our rails and SolidQueue processes for the portal to reduce resource contention. Locally, we continue to run in same container. Coupled with changes in [dpc-ops](CMSgov/dpc-ops#919). ## 🧪 Validation Successfully deployed to test: https://github.com/CMSgov/dpc-app/actions/runs/22322110206
1 parent d8b62b8 commit 9cd50e0

File tree

8 files changed

+47
-12
lines changed

8 files changed

+47
-12
lines changed

.github/workflows/check_healthy.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,25 @@ jobs:
1717
matrix:
1818
include:
1919
- service: api
20-
script_params: api-1 api api frontend v9
20+
script_params: api-1 api frontend v9
2121
skip: false
2222
- service: attribution
23-
script_params: attribution attribution attribution backend v9
23+
script_params: attribution attribution backend v9
2424
skip: false
2525
- service: aggregation
26-
script_params: aggregation aggregation aggregation backend v9
26+
script_params: aggregation aggregation backend v9
2727
skip: false
2828
- service: web
29-
script_params: web-v2-1 web web frontend v9
29+
script_params: web-v2-1 web frontend v9
3030
skip: ${{ inputs.env == 'prod' }}
3131
- service: admin
32-
script_params: web-admin-1 web-admin web-admin frontend v9
32+
script_params: web-admin-1 web-admin frontend v9
3333
skip: ${{ inputs.env == 'prod' }}
34-
- service: portal
35-
script_params: web-portal-1 dpc-portal web-portal frontend v9
34+
- service: web-portal
35+
script_params: web-portal-1 web-portal frontend v9
36+
skip: ${{ inputs.env == 'prod' || inputs.env == 'sandbox' }}
37+
- service: async-portal
38+
script_params: none async-portal frontend v9
3639
skip: ${{ inputs.env == 'prod' || inputs.env == 'sandbox' }}
3740
steps:
3841
- name: "Checkout code"

dpc-portal/Procfile.dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
web: bundle exec rails server -b 0.0.0.0 -p 3100
2+
solidqueue: bundle exec rails solid_queue:start
23
cpigw: env PORT=4567 ruby spec/support/fake_cpi_gateway.rb

dpc-portal/Procfile.nonprod_async

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
solidqueue: bundle exec rails solid_queue:start
2+
cpigw: env PORT=4567 ruby spec/support/fake_cpi_gateway.rb

dpc-portal/bin/nonprod_async

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env sh
2+
3+
echo "Testing removal of foreman log prefix (should be json)"
4+
export LOG_STR='06:21:25 web.1 | {"level": "debug", "time": "blahblahblah"}'
5+
export EVERYTHING_AFTER_PIPE_REGEX='s/[^|]*|//'
6+
echo $LOG_STR | sed $EVERYTHING_AFTER_PIPE_REGEX
7+
8+
echo "Starting Procfile.nonprod_async"
9+
exec foreman start -f Procfile.nonprod_async "$@" | sed $EVERYTHING_AFTER_PIPE_REGEX

dpc-portal/config/application.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Application < Rails::Application
2727

2828
config.active_support.to_time_preserves_timezone = :zone
2929
config.active_job.queue_adapter = :solid_queue
30+
config.solid_queue.supervisor_pidfile = 'tmp/solid_queue_pidfile'
3031

3132
# Ensure mailer jobs get sent to a specialized queue.
3233
config.action_mailer.deliver_later_queue_name = "portal"

dpc-portal/config/puma.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,3 @@
4343

4444
# Allow puma to be restarted by `bin/rails restart` command.
4545
plugin :tmp_restart
46-
plugin :solid_queue

dpc-portal/docker/entrypoint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ set -e
66
if [ -f tmp/pids/server.pid ]; then
77
rm tmp/pids/server.pid
88
fi
9+
if [ -f tmp/solid_queue_pidfile ]; then
10+
echo "Removing solid queue pidfile"
11+
rm tmp/solid_queue_pidfile
12+
fi
913

1014
if [ "$1" == "portal" ]; then
1115
# Start the database service (and make accessible outside the Docker container)
@@ -24,4 +28,14 @@ if [ "$1" == "portal" ]; then
2428
echo "Starting in non-production"
2529
./bin/nonprod
2630
fi
31+
elif [ "$1" == "async" ]; then
32+
echo "Starting Solid Queue..."
33+
if [[ "$ENV" == "production" ]]; then
34+
echo "Starting in production"
35+
bundle exec rails solid_queue:start
36+
# For local, SolidQueue starts in same container
37+
elif [[ "$ENV" != "local" ]]; then
38+
echo "Starting in non-production"
39+
./bin/nonprod_async
40+
fi
2741
fi

scripts/check-deployment-status.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ set -euxo pipefail
44

55
ENV="$1" # env
66
TARGET_GROUP="dpc-${ENV}-${2}" # target
7-
SVC_NAME="dpc-${ENV}-${4}" # service
8-
CLUSTER_NAME="dpc-${ENV}-${5}" # cluster
9-
SVC_VERSION="$6" # service version
7+
SVC_NAME="dpc-${ENV}-${3}" # service
8+
CLUSTER_NAME="dpc-${ENV}-${4}" # cluster
9+
SVC_VERSION="$5" # service version
1010

11-
if [ $7 == 'true' ]; then
11+
if [ $6 == 'true' ]; then
1212
echo "Skipping $SVC_NAME"
1313
exit 0
1414
fi
@@ -80,6 +80,12 @@ echo "ECS service ${SVC_NAME}-${SVC_VERSION} stable"
8080
echo "---"
8181
echo "1. Checking for existing Target Group: $TARGET_GROUP"
8282

83+
if [ $2 == "none" ]; then
84+
echo "Skipping Target Group Check as no Target Group defined"
85+
echo "Deployment successful and application layer confirmed healthy."
86+
exit 0
87+
fi
88+
8389
set +e
8490
TARGET_GROUP_ARN=$(aws elbv2 describe-target-groups \
8591
--names "$TARGET_GROUP" \

0 commit comments

Comments
 (0)