forked from finos/waltz-integration-juju
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes a github action for refreshing the EC2 deployment through SSH and checking the public instance status after the deployment is complete.
- Loading branch information
1 parent
6b8049b
commit 0b271dd
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Refresh EC2 FINOS Waltz deployment | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Runs everyday at 00:00. (see https://crontab.guru) | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
build: | ||
name: Trigger Juju refresh on EC2 Deployment | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Refresh Deployment | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
set -x | ||
# Running juju status will show us the current revisions of the charms. | ||
juju status --relations | ||
juju refresh finos-waltz --channel edge | ||
juju refresh waltz-ingress --channel stable | ||
# Running juju status will show us the current revisions of the charms. | ||
juju status --relations | ||
- name: Check Waltz Public Instance status | ||
run: | | ||
wait_for_curl() { | ||
url="$1" | ||
for i in {1..30}; do | ||
status=$(curl -s -o /dev/null -w "%{http_code}" "$url") | ||
if [ "$status" = "200" ]; then | ||
break | ||
fi | ||
if [ "$i" -eq 30 ]; then | ||
echo "Failed to get 200 response status from $url. Got status $status." | ||
exit 1 | ||
fi | ||
sleep 10 | ||
done | ||
} | ||
wait_for_curl "http://demo.waltz.finos.org/" | ||
echo "Waltz is reachable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# FINOS Waltz Juju EC2 deployment - Periodic refresh | ||
|
||
The [Refresh EC2 FINOS Waltz deployment](../.github/workflows/refresh_deployment.yaml) job will run periodically for a configured Juju EC2 deployment and will refresh the Waltz and Ingress charms to their latest revision. This job requires a few Secrets to be defined in the project repository (`Settings > Secrets > Actions > Repository secrets` or using the `gh secret set` command): | ||
|
||
- `SSH_USER`: The username to use when connecting to the EC2 instance. | ||
- `SSH_HOST`: The hostname of the EC2 instance. | ||
- `SSH_KEY`: The private SSH key to use when connecting to the EC2 instance. | ||
|
||
Once the above repository secrets have been set, the job should succeed. A manual job can also be triggered by going to `Actions > Refresh EC2 FINOS Waltz deployment > Run workflow`. | ||
|
||
The Github CLI commands for setting the secrets are: | ||
|
||
```bash | ||
gh -R finos/waltz-integration-juju secret set SSH_USER | ||
gh -R finos/waltz-integration-juju secret set SSH_HOST | ||
gh -R finos/waltz-integration-juju secret set SSH_KEY < ~/.ssh/id_rsa | ||
``` | ||
|
||
The CLI will prompt you to paste the `SSH_USER` and `SSH_HOST` secrets in the terminal, while `SSH_KEY` will load the private key from the specified location. |