Skip to content

Commit 0dbbdc6

Browse files
committed
Initial commit
0 parents  commit 0dbbdc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5234
-0
lines changed

.env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Hetzner S3
2+
S3_ENDPOINT_URL=https://nbg1.your-objectstorage.com
3+
S3_ACCESS_KEY=
4+
S3_SECRET_KEY=
5+
S3_BUCKET=openstage
6+
7+
# Dataverse (optional for local dev)
8+
DATAVERSE_API_TOKEN=
9+
DATAVERSE_SERVER_URL=https://dataverse.harvard.edu
10+
11+
# Per-case Dataverse dataset persistent IDs (one DOI per case)
12+
# DATASET_PERSISTENT_ID_EU=doi:10.7910/DVN/XXXXXX
13+
# DATASET_PERSISTENT_ID_DE=doi:10.7910/DVN/YYYYYY

.github/workflows/cleanup.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Cleanup Orphaned Servers
2+
on:
3+
schedule:
4+
- cron: '0 6 * * *'
5+
6+
jobs:
7+
cleanup:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Install hcloud
11+
run: |
12+
curl -sL https://github.com/hetznercloud/cli/releases/latest/download/hcloud-linux-amd64.tar.gz | tar xz
13+
sudo mv hcloud /usr/local/bin/
14+
15+
- name: Delete orphaned servers
16+
env:
17+
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}
18+
run: |
19+
hcloud server list -l purpose=backstage-pipeline -o json | jq -r '.[].id' | while read id; do
20+
CREATED=$(hcloud server describe $id -o json | jq -r '.created')
21+
AGE_HOURS=$(( ($(date +%s) - $(date -d "$CREATED" +%s)) / 3600 ))
22+
if [ $AGE_HOURS -gt 12 ]; then
23+
echo "Deleting orphaned server $id (age: ${AGE_HOURS}h)"
24+
hcloud server delete $id
25+
fi
26+
done

.github/workflows/docs.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "docs/**"
8+
- "mkdocs.yml"
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: true
19+
20+
jobs:
21+
deploy:
22+
runs-on: ubuntu-latest
23+
environment:
24+
name: github-pages
25+
url: ${{ steps.deployment.outputs.page_url }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: astral-sh/setup-uv@v6
30+
31+
- run: uv sync --extra docs
32+
33+
- run: uv run mkdocs build --strict
34+
35+
- uses: actions/upload-pages-artifact@v3
36+
with:
37+
path: site/
38+
39+
- id: deployment
40+
uses: actions/deploy-pages@v4
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Monthly Pipeline
2+
on:
3+
schedule:
4+
- cron: '0 2 1 * *'
5+
workflow_dispatch:
6+
inputs:
7+
cases:
8+
description: 'Comma-separated cases to run (default: eu)'
9+
default: 'eu'
10+
server_type:
11+
description: 'Hetzner server type'
12+
default: 'cx32'
13+
14+
jobs:
15+
launch:
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: deploy/terraform
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: hashicorp/setup-terraform@v3
24+
25+
- name: Terraform Init
26+
run: terraform init
27+
28+
- name: Terraform Apply
29+
run: |
30+
terraform apply -auto-approve \
31+
-var="hcloud_token=${{ secrets.HCLOUD_TOKEN }}" \
32+
-var="s3_endpoint=${{ secrets.S3_ENDPOINT_URL }}" \
33+
-var="s3_access_key=${{ secrets.S3_ACCESS_KEY }}" \
34+
-var="s3_secret_key=${{ secrets.S3_SECRET_KEY }}" \
35+
-var="s3_bucket=${{ secrets.S3_BUCKET }}" \
36+
-var="github_token=${{ secrets.PIPELINE_GITHUB_TOKEN }}" \
37+
-var="dataverse_token=${{ secrets.DATAVERSE_API_TOKEN }}" \
38+
-var="dataverse_url=${{ secrets.DATAVERSE_SERVER_URL }}" \
39+
-var="dataset_persistent_id_eu=${{ secrets.DATASET_PERSISTENT_ID_EU }}" \
40+
-var="cases=${{ github.event.inputs.cases || 'eu' }}" \
41+
-var="server_type=${{ github.event.inputs.server_type || 'cx32' }}"

.github/workflows/notify.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Pipeline Notification
2+
on:
3+
repository_dispatch:
4+
types: [pipeline-complete]
5+
6+
jobs:
7+
notify:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Log pipeline result
11+
run: |
12+
echo "Pipeline status: ${{ github.event.client_payload.status }}"
13+
echo "Date: ${{ github.event.client_payload.date }}"
14+
15+
- name: Send email on failure
16+
if: github.event.client_payload.status == 'failure'
17+
uses: dawidd6/action-send-mail@v3
18+
with:
19+
server_address: ${{ secrets.SMTP_SERVER }}
20+
server_port: ${{ secrets.SMTP_PORT }}
21+
username: ${{ secrets.SMTP_USERNAME }}
22+
password: ${{ secrets.SMTP_PASSWORD }}
23+
subject: "backstage pipeline FAILED"
24+
body: |
25+
Pipeline run on ${{ github.event.client_payload.date }} failed.
26+
Check S3 logs at logs/${{ github.event.client_payload.date }}/run.log
27+
to: ${{ secrets.NOTIFICATION_EMAIL }}
28+
from: ${{ secrets.SMTP_FROM }}

0 commit comments

Comments
 (0)