Skip to content

Commit

Permalink
Merge pull request #17 from entur/node-upgrade
Browse files Browse the repository at this point in the history
Node upgrade and cron.yaml fix
  • Loading branch information
tysseng authored Oct 11, 2023
2 parents f0c8246 + a528c9b commit c220655
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 52 deletions.
13 changes: 0 additions & 13 deletions cron.yaml

This file was deleted.

115 changes: 81 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"author": "Entur AS",
"type": "module",
"engines": {
"node": "16",
"npm": "8"
"node": "18",
"npm": "9"
},
"scripts": {
"start": "node dist/server.js",
Expand Down Expand Up @@ -51,7 +51,7 @@
"jest": "^27.4.4",
"nodemon": "^2.0.6",
"prettier": "^2.2.0",
"ts-node": "^10.4.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}
}
24 changes: 22 additions & 2 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,28 @@ function deploy {
echo " 🧵 Linting ..."
npm run lint

echo " 🚢 Deploying BFF Kafka to $ENV ..."
npm run build:$ENV && gcloud app deploy app-$ENV.yaml cron.yaml --project=$PROJECT --quiet
echo " 🚢 Deploying BFF Kafka to $ENV ..."
npm run build:$ENV && gcloud app deploy app-$ENV.yaml --project=$PROJECT --quiet

echo " ⏰ Creating cron jobs ..."
# The urls below do not exist in the app. Instead, all urls are accepted and url inspected in http.ts.
# Cron-triggered calls bypass the firewall btw.

KEEPALIVE_JOB="bff-kafka-keepalive"
if gcloud scheduler jobs list --project=$PROJECT | grep -c $KEEPALIVE_JOB; then
echo " 🗑️ Deleting existing keep-alive cron job $HAS_KAFKA_KEEPALIVE..."
gcloud scheduler jobs delete $KEEPALIVE_JOB --quiet --location="us-central1" --project=$PROJECT
fi
echo " 👷🏻‍♀️ Creating keep-alive cron job ..."
gcloud scheduler jobs create app-engine $KEEPALIVE_JOB --service="bff-kafka" --schedule="every 5 mins" --relative-url="/bff-kafka/keepalive" --http-method=GET --description="Tic, toc, I'm a clock. I prevent bff-kafka from idle timeouts." --project=$PROJECT

HEARTBEAT_JOB="bff-kafka-heartbeat"
if gcloud scheduler jobs list --project=$PROJECT | grep -c $HEARTBEAT_JOB; then
echo " 🗑️ Deleting existing heartbeat cron job ..."
gcloud scheduler jobs delete $HEARTBEAT_JOB --quiet --location="us-central1" --project=$PROJECT
fi
echo " 👷🏻‍♀️ Creating heartbeat cron job ..."
gcloud scheduler jobs create app-engine $HEARTBEAT_JOB --service="bff-kafka" --schedule="every 1 mins" --relative-url="/bff-kafka/heartbeat" --http-method=GET --description="Can you feel a heartbeat, Doctor? No, he's dead, Jim." --project=$PROJECT

echo " 💬 Posting message to Slack ..."
slack_message $ENV
Expand Down

0 comments on commit c220655

Please sign in to comment.