Skip to content

Commit ae65540

Browse files
authored
Deployement: freeze uv run before alembic command (#117)
1 parent 02f7848 commit ae65540

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/cd-production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
INSTANCE_ID: ${{ secrets.EC2_INSTANCE_ID }}
3232
BUILD_DIRECTORY: ${{ secrets.BUILD_DIRECTORY }}
3333
run: |
34-
DEPLOY_CMD="cd ${BUILD_DIRECTORY} && git fetch --tags origin && git checkout --force ${{ github.sha }} && docker compose build && docker compose run --rm --entrypoint '' backend uv run alembic upgrade head && docker compose up -d --remove-orphans && docker image prune -f"
34+
DEPLOY_CMD="cd ${BUILD_DIRECTORY} && git fetch --tags origin && git checkout --force ${{ github.sha }} && docker compose build && docker compose run --rm --entrypoint '' backend uv run --frozen alembic upgrade head && docker compose up -d --remove-orphans && docker image prune -f"
3535
3636
CMD_ID=$(aws ssm send-command \
3737
--instance-ids "$INSTANCE_ID" \

.github/workflows/cd-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
INSTANCE_ID: ${{ secrets.STAGING_EC2_INSTANCE_ID }}
3131
BUILD_DIRECTORY: ${{ secrets.BUILD_DIRECTORY }}
3232
run: |
33-
DEPLOY_CMD='sudo -iu ec2-user bash -lc \"cd '"${BUILD_DIRECTORY}"' && git fetch origin && git reset --hard origin/main && docker compose build && docker compose run --rm --entrypoint \\\"\\\" backend uv run alembic upgrade head && docker compose up -d --remove-orphans && docker image prune -f\"'
33+
DEPLOY_CMD='sudo -iu ec2-user bash -lc \"cd '"${BUILD_DIRECTORY}"' && git fetch origin && git reset --hard origin/main && docker compose build && docker compose run --rm --entrypoint \\\"\\\" backend uv run --frozen alembic upgrade head && docker compose up -d --remove-orphans && docker image prune -f\"'
3434
3535
CMD_ID=$(aws ssm send-command \
3636
--instance-ids "$INSTANCE_ID" \

backend/scripts/prestart.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ set -e
44
set -x
55

66
# Let the DB start
7-
uv run python app/backend_pre_start.py
7+
uv run --frozen python app/backend_pre_start.py
88
echo "backend_pre_start.py completed"
99

1010
# Run migrations
11-
uv run alembic upgrade head
11+
uv run --frozen alembic upgrade head
1212
echo "alembic migration completed"
1313

1414
# Create initial data in DB
15-
uv run python app/initial_data.py
15+
uv run --frozen python app/initial_data.py
1616
echo "initial data added in db"

backend/scripts/tests-start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export ENVIRONMENT=testing
66

77
python app/tests_pre_start.py
88

9-
uv run alembic upgrade head
9+
uv run --frozen alembic upgrade head
1010
if [ $? -ne 0 ]; then
1111
echo 'Error: Test database migrations failed'
1212
exit 1

0 commit comments

Comments
 (0)