Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/alembic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Alembic Upgrade Head
on: pull_request

jobs:
alembic_upgrade_head:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:15
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U runner"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: runner
POSTGRES_DB: main
POSTGRES_HOST_AUTH_METHOD: trust

steps:
- uses: actions/checkout@v4

- name: Wait for PostgreSQL to be ready
run: |
until pg_isready -h localhost -p 5432 -U runner; do
echo "Waiting for PostgreSQL..."
sleep 1
done

- name: Install dependencies
run: |
sudo apt-get install python3.11 python3.11-venv
python3.11 -m pip install --upgrade pip
python3.11 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt

# This will fail if there are divergent heads and alembic gets confused;
# e.g., un-sanitarily merging main into a dev branch.
- name: Run alembic upgrade head
run: |
source ./venv/bin/activate
cd src
alembic upgrade head
4 changes: 2 additions & 2 deletions .github/workflows/pytest_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Unit Tests
on: pull_request

jobs:
test:
unit_tests:
runs-on: ubuntu-latest
timeout-minutes: 5

Expand Down Expand Up @@ -31,4 +31,4 @@ jobs:
- name: Run unit tests
run: |
source ./venv/bin/activate
pytest ./tests/unit -v
pytest ./tests/unit -v
1 change: 0 additions & 1 deletion config/cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
# run the daily script at 1am every morning
# TODO: make sure timezone is PST
crontab -l | { cat; echo "0 1 * * * /home/csss-site/csss-site-backend/src/cron/daily.py"; } | crontab -

14 changes: 0 additions & 14 deletions config/csss-site.service

This file was deleted.

10 changes: 0 additions & 10 deletions config/export_secrets.sh

This file was deleted.

30 changes: 0 additions & 30 deletions config/nginx.conf

This file was deleted.

2 changes: 0 additions & 2 deletions config/sudoers.conf

This file was deleted.

28 changes: 0 additions & 28 deletions config/update_config.sh

This file was deleted.

8 changes: 0 additions & 8 deletions deploy.sh

This file was deleted.

135 changes: 0 additions & 135 deletions fresh_setup.sh

This file was deleted.

12 changes: 6 additions & 6 deletions gunicorn_start.sh → junicorn_start_dev.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash

NAME=csss-site
DIR=/home/csss-site/csss-site-backend/src
USER=csss-site
GROUP=csss-site
DIR= # fill this out yourself
USER= # fill this out yourself
GROUP= # fill this out yourself
WORKERS=2 # TODO: should we increase this?
WORKER_CLASS=uvicorn.workers.UvicornWorker
VENV=/home/csss-site/.venv/bin/activate
BIND=unix:/var/www/gunicorn.sock
VENV= # fill this out yourself
BIND= # e.g., unix:/var/www/gunicorn.sock
LOG_LEVEL=error

cd $DIR
source $VENV

exec gunicorn main:app \
gunicorn main:app \
--name $NAME \
--workers $WORKERS \
--worker-class $WORKER_CLASS \
Expand Down