-
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.
Merge pull request #2 from fccn/igobranco/multiple-changes
Multiple changes
- Loading branch information
Showing
4 changed files
with
82 additions
and
27 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,23 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
ci: | ||
name: Deploy to Buckets | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Deploy to all environments | ||
run: deploy.sh | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ AWS_SECRET_ACCESS_KEY }} | ||
|
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 |
---|---|---|
@@ -1,28 +1,31 @@ | ||
# Maintenance NAU site | ||
This repository has the maintenance site. | ||
This repository has the maintenance site of [NAU](https://nau.edu.pt). | ||
|
||
The html, css and images are copied to a ceph bucket an showned to client if there is some error on NAU applications. | ||
This page is shown if there is an application error. | ||
|
||
## Update site for environment | ||
This page is hosted on Ceph S3 Bucket that the applications use when they need to show an error to the user. | ||
|
||
#### remove existing site | ||
Because the maintenance page is something different and out of scope of the applications (Open edX and NAU Richie) that make up [NAU](https://nau.edu.pt), then this repository was created. | ||
|
||
``` | ||
AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXX AWS_SECRET_ACCESS_KEY=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY s3cmd --host 10.0.12.62 --host-bucket nau-dev-shared --no-ssl rm "s3://nau-dev-shared/maintenance-site" --recursive | ||
## Update site | ||
|
||
Simply run the `deploy.sh` file, that updates the maintenance page for all environments. | ||
```bash | ||
AWS_ACCESS_KEY_ID=XXXX AWS_SECRET_ACCESS_KEY=YYYY deploy.sh | ||
``` | ||
|
||
#### put site | ||
Or alternatively, for each environment (DEV, STAGE and PROD), replace the access key and secret and the correct bucket name, and run: | ||
``` | ||
AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXX AWS_SECRET_ACCESS_KEY=YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY s3cmd --host 10.0.12.62 --host-bucket nau-dev-shared --no-ssl put site/* "s3://nau-dev-shared/maintenance-site/" --recursive --acl-public --no-mime-magic | ||
AWS_ACCESS_KEY_ID=XXXX AWS_SECRET_ACCESS_KEY=YYYY s3cmd --host rgw.nau.fccn.pt --host-bucket nau-dev-shared put maintenance-site/index.html "s3://nau-dev-shared/maintenance-site/index.html" --acl-public | ||
``` | ||
|
||
#### Verify site | ||
To check if it was putted ok use: | ||
https://shared.static.dev.nau.fccn.pt/maintenance-site/index.html | ||
After a push to master branch the Github Action will update automatically the maintenance page on each environment. | ||
|
||
### Stage environment | ||
For stage environment use previous commands but replace 'dev' keyword with 'stage'. | ||
## Verify site | ||
To check the current maintenance page open: | ||
|
||
### Prod environment | ||
For stage environment use previous commands but replace 'dev' keyword with 'prod'. | ||
| Environment | Proxy Link | Bucket Link | | ||
| ----------- | ---------- | ------------------ | | ||
| DEV | https://shared.static.dev.nau.fccn.pt/maintenance-site/index.html | https://rgw.nau.fccn.pt/nau-dev-shared/maintenance-site/index.html | | ||
| STAGE | https://shared.static.stage.nau.fccn.pt/maintenance-site/index.html | https://rgw.nau.fccn.pt/nau-stage-shared/maintenance-site/index.html | | ||
| PROD | https://shared.static.prod.nau.fccn.pt/maintenance-site/index.html | https://rgw.nau.fccn.pt/nau-prod-shared/maintenance-site/index.html | |
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,10 @@ | ||
#!/bin/bash -xe | ||
# Example to run: | ||
# AWS_ACCESS_KEY_ID=XXXX AWS_SECRET_ACCESS_KEY=YYYY ./deploy.sh | ||
|
||
declare -a environments=("nau-dev-shared" "nau-stage-shared" "nau-prod-shared") | ||
|
||
for environment in "${environments[@]}" | ||
do | ||
AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} s3cmd --host rgw.nau.fccn.pt --host-bucket $environment put maintenance-site/index.html s3://$environment/maintenance-site/index.html | ||
done |
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