Skip to content

Commit

Permalink
Merge pull request #2 from fccn/igobranco/multiple-changes
Browse files Browse the repository at this point in the history
Multiple changes
  • Loading branch information
igobranco committed Feb 16, 2024
2 parents 139967e + 0c12e82 commit bc36dab
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 27 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yml
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 }}

33 changes: 18 additions & 15 deletions README.md
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 |
10 changes: 10 additions & 0 deletions deploy.sh
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
43 changes: 31 additions & 12 deletions site/index.html → maintenance-site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,30 @@
let currentLanguage = null;

// feature toggle. shows or hides the operation details
const showOpDetails = true;
const showOpDetails = false;

const intlTranslations = {
en: {
title: 'Under maintenance',
shortmessage: 'We are updating the NAU platform.<br>We promise it will be quick!',
esttime: 'Estimated time',
message: 'For additional information, please check out our user knowledge base at',
langchangemessage: 'Mudar língua para Português'
title: "Under maintenance",
// shortmessage: 'We are updating the NAU platform.<br>We promise it will be quick!',
shortmessage: "Please come back later, we'll try to be brief!",
esttime: "Estimated time",
message: "For additional information, please check out our user knowledge base at",
langchangemessage: "Mudar língua para Português",
technicalinfo: "Informação técnica do estado da NAU",
},
pt: {
title: 'Em manutenção',
shortmessage: 'Estamos a atualizar a plataforma NAU.<br>Prometemos que será rápido!',
esttime: 'Tempo estimado',
message: 'Para informações adicionais por favor o site de ajuda ao utilizador em',
langchangemessage: 'Change language to English'
// shortmessage: 'Estamos a atualizar a plataforma NAU.<br>Prometemos que será rápido!',
shortmessage: "Por favor volte mais tarde, tentaremos ser breves.",
esttime: "Tempo estimado",
message: "Para informações adicionais por favor o site de ajuda ao utilizador em",
langchangemessage: "Change language to English",
technicalinfo: "Technical information on the state of the NAU",
}
};

const intlElements = ['maintenance-title', 'maintenance-shortmessage', 'maintenance-esttime', 'maintenance-message'];
const intlElements = ['maintenance-title', 'maintenance-shortmessage', 'maintenance-esttime', 'maintenance-message', 'maintenance-technicalinfo'];

function getNavigatorLanguage() {
return navigator.language.split('-')[0] == 'pt' ? 'pt' : 'en';
Expand Down Expand Up @@ -187,7 +191,19 @@
color: var(--email-color);
}

.email a:hover {
.email,
.status {
font-size: 1.15rem;
color: var(--email-color);
}

.email a,
.status a {
color: var(--email-color);
}

.email a:hover,
.status a:hover {
color: #ffce35;
text-decoration-color: #ffce35;
}
Expand Down Expand Up @@ -315,6 +331,9 @@ <h1><span>
</li>
</ul>
</section>
<p class="status">
<a target="_blank" href="https://status.nau.edu.pt" id="maintenance-technicalinfo">Informação técnica do estado da NAU</a>
</p>
</div>
</body>

Expand Down

0 comments on commit bc36dab

Please sign in to comment.