Note
This website is created from the EPFL's next.js starter kit
A simple next.js monitoring solution based on Prometheus.
- Status — EPFL SI
- Summary
- Requirements
- Getting Started
- Deploy with Kubernetes
- Usage of short-lived website
- Bun ≥ 1.2
- A Microsoft Entra ID app registration with the following redirect URI:
http://localhost:3000/api/auth/callback/microsoft-entra-id - Access rights to the team
epfl_statusin keybase - Be member of group "status-admins" in groups.epfl.ch
First, to use the projet locally, you need to clone the projet Here the command below.
git clone git@github.com:epfl-si/status.git
cd status # Go to the root of the projectFirst, you need to get secrets for email credentials.
Move to /devkit/alertmanager
Copy config.yml.example and rename it to config.yml
In this YML file, there is at the top, a "global" attributes with smtp variables as below
global:
smtp_smarthost: ''
smtp_auth_username: ''
smtp_auth_password: ''
smtp_require_tls: true
smtp_from: '' # smtp_from have the same value as smtp_auth_usernameFill empty values with secrets from following files : /keybase/team/epfl_status/secrets.yml
Now,to have Prometheus, Alertmanager and Blackbox Exporter containers, you need to move to the devkit folder and to start the docker compose as below.
cd devkit # Go to the /devkit
docker compose up -d # Start the docker composeIf you want to restart the Dev kit, just stop and restart the docker compose by using theses following commands
cd devkit # Go to the /devkit if you're not already
docker compose down # Stop the docker compose
docker compose up -d # Start the docker composeBefore starting the web application, copy the .env.example and rename it .env.local.
cd .. # Go back to the root of the project
cp .env.example .env.local
vi .env.local # fill in .env.local using nano, vi, vim, or your favorite text editorThe file look like this
AUTH_SECRET=
ENTRA_ID=
ENTRA_SECRET=
ENTRA_ISSUER=https://login.microsoftonline.com/<tenant-id>/v2.0
PROMETHEUS_API_URL="http://localhost:9090"
ALERTMANAGER_API_URL="http://localhost:9093"
BLACKBOX_API_URL="http://localhost:9115"
ADMIN_GROUPS="status-admin_AppGrpU" # Separated by a comma without space, like "<group_name>_AppGrpU,<group_name_2>_AppGrpU"Then, replace and fill variables with correct values.
Note
All theses secrets can be find to the team epfl_status folder in keybase (secrets.yml file)
| Variable | Description |
|---|---|
| AUTH_SECRET | Change with a random secret for Auth.js session encryption (openssl rand -base64 32) |
| ENTRA_ID | Change with EntraID application (client) ID |
| ENTRA_SECRET | Change with EntraID client secret |
| ENTRA_ISSUER | Change <tenant-id> with your tenant id in `https://login.microsoftonline.com//v2.0** |
| PROMETHEUS_API_URL | Change only on test / prod environment. Keep it with devkit usage |
| ALERTMANAGER_API_URL | Change only on test / prod environment. Keep it with devkit usage |
| BLACKBOX_API_URL | Change only on test / prod environment. Keep it with devkit usage |
| ADMIN_GROUPS | Don't need to be changes since this group exist |
Finally, you can install all dependencies and start the web application by using theses commands.
cd .. # Go back to the root of the project if you're not yet
bun install
bun devYou can open and use the web application at http://localhost:3000.
Duplicate twice secrets.yaml.exemple and name it secrets-test.yaml and secrets-test.yaml
replace all values betwwen "<" and ">" with test or prod values from keybase (/keybase/team/epfl_status/secrets.yml)
First, you need to authenticate to OpenShift in your terminal
oc login --web --server=https://api.ocpitst0001.xaas.epfl.ch:6443This command will open your navigator. You need to fill your credentials and after logged in, you can close your navigator. After that, if you're not in svc0041t-status-test project, you need to change it
oc project svc0041t-status-testNext, push your secrets to OpenShift
kubectl apply -f secrets-test.yamlTo conclude, push the deployment configuration
kubectl apply -f deployment-test.yamlFirst, you need to authenticate to OpenShift in your terminal
oc login --web --server=https://api.ocpitsp0001.xaas.epfl.ch:6443This command will open your navigator. You need to fill your credentials and after logged in, you can close your navigator. After that, if you're not in svc0041p-status-prod project, you need to change it
oc project svc0041p-status-prodNext, push your secrets
kubectl apply -f secrets-prod.yamlTo conclude, push the deployment configuration
kubectl apply -f deployment-prod.yamlTo test alerting, we're setup a "short lived website" that's able to be deploy and delete easily.
For this, there is a file called deployment-testserver.yaml.
First, you need to authenticate to OpenShift in your terminal
oc login --web --server=https://api.ocpitsp0001.xaas.epfl.ch:6443This command will open your navigator. You need to fill your credentials and after logged in, you can close your navigator. After that, if you're not in svc0041p-status-prod project, you need to change it
oc project svc0041p-status-prodTo deploy the short-lived website, you need to execute the command below.
kubectl apply -f deployment-testserver.yamlAll you have to do for deleting is the command below.
kubectl delete -f deployment-testserver.yaml