Skip to content

Commit 8def579

Browse files
authored
Merge branch 'main' into repo-sync
2 parents 7c5dd76 + 85bb052 commit 8def579

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
web: NODE_ENV=production node server.js
22

3-
release: NODE_ENV=production node script/purge-redis-pages.js
3+
release: NODE_ENV=production script/release-heroku

script/release-heroku

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
# [start-readme]
4+
#
5+
# Light Bash wrapper for the Heroku release command, which sometimes fails
6+
# unexpectedly in staging environments when a Node installation is missing
7+
#
8+
# [end-readme]
9+
10+
# Check for node but don't fail immediately if it's not present
11+
./script/check-for-node
12+
EXIT_STATUS=$?
13+
14+
# If node is missing...
15+
if [[ "$EXIT_STATUS" -ne "0" ]]; then
16+
# Fail hard if this is our Heroku production app or if Redis is configured
17+
if [[ "$HEROKU_PRODUCTION_APP" == "true" || -n "$REDIS_URL" ]]; then
18+
echo "Error: cannot execute the release script without Node.js, which is fatal."
19+
echo "Exiting..."
20+
exit $EXIT_STATUS
21+
# Otherwise succeed with only a warning
22+
else
23+
echo "Warning: although Node.js is missing, it is non-critical."
24+
echo "Exiting..."
25+
exit 0
26+
fi
27+
fi
28+
29+
# Execute the release script and exit with its status
30+
node script/purge-redis-pages.js
31+
exit $?

0 commit comments

Comments
 (0)