Skip to content

Commit ff12c22

Browse files
authored
New Deploy Logic (#114)
* Migrate to uv * GHA and Makefile * New deployment logic * GHA * tqdm outputs to stderr turns out * Add cron to GHA
1 parent 6f6798a commit ff12c22

14 files changed

+79
-344
lines changed

.github/workflows/deploy.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy to static server
2+
3+
on:
4+
push:
5+
branches:
6+
- ep2024
7+
schedule:
8+
- cron: "*/10 * * * *" # every 10 minutes
9+
workflow_dispatch:
10+
11+
jobs:
12+
tests:
13+
name: Run tests
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
17+
steps:
18+
- name: Check out repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python 3
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.13'
25+
26+
- name: Setup uv
27+
uses: astral-sh/setup-uv@v5
28+
29+
- name: Install dependencies from uv.lock
30+
run: make deps/install
31+
32+
- name: Download data
33+
run: uv run make download > /dev/null 2>&1
34+
env:
35+
PRETALX_TOKEN: ${{ secrets.PRETALX_TOKEN }}
36+
37+
- name: Transform data
38+
run: uv run make transform > /dev/null 2>&1
39+
40+
- name: Setup SSH
41+
uses: webfactory/[email protected]
42+
with:
43+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
44+
45+
- name: Adjust known_hosts
46+
run: ssh-keyscan "static.europython.eu" > ~/.ssh/known_hosts
47+
48+
- name: Deploy
49+
run: uv run make deploy FORCE_DEPLOY=true

Dockerfile

Lines changed: 0 additions & 15 deletions
This file was deleted.

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Variables for the project
2+
# =========================
3+
CONFERENCE ?= ep2024
4+
DATA_DIR ?= ./data/public/$(CONFERENCE)/
5+
6+
# Variables for remote host
7+
# =========================
8+
VPS_USER ?= static_content_user
9+
VPS_HOST ?= static.europython.eu
10+
VPS_PATH ?= /home/$(VPS_USER)/content/programapi/$(CONFERENCE)/releases
11+
REMOTE_CMD=ssh $(VPS_USER)@$(VPS_HOST)
12+
13+
# Variables for deploy
14+
# ==========================
15+
TIMESTAMP ?= $(shell date +%Y%m%d%H%M%S)
16+
FORCE_DEPLOY ?= false
17+
118
dev:
219
uv sync --dev
320

@@ -21,6 +38,16 @@ endif
2138

2239
all: download transform
2340

41+
ifeq ($(FORCE_DEPLOY), true)
42+
deploy: TARGET = $(VPS_PATH)/$(TIMESTAMP)
43+
deploy:
44+
@echo "\n\n**** Deploying branch '$(CONFERENCE)' to $(TARGET)...\n\n"
45+
$(REMOTE_CMD) "mkdir -p $(TARGET)"
46+
rsync -avz --delete $(DATA_DIR) $(VPS_USER)@$(VPS_HOST):$(TARGET)
47+
$(REMOTE_CMD) "cd $(VPS_PATH) && ln -snf $(TIMESTAMP) current"
48+
@echo "\n\n**** Deployment complete.\n\n"
49+
endif
50+
2451
test:
2552
uv run pytest
2653

deploy/.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

deploy/Makefile

Lines changed: 0 additions & 11 deletions
This file was deleted.

deploy/docker-compose.yml.j2

Lines changed: 0 additions & 28 deletions
This file was deleted.

deploy/env.example

Lines changed: 0 additions & 1 deletion
This file was deleted.

deploy/hosts.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

deploy/init-letsencrypt.sh.j2

Lines changed: 0 additions & 80 deletions
This file was deleted.

deploy/nginx.conf.j2

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)