Skip to content
Closed

Dev #24

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
28 changes: 18 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Deploy

on:
push:
branches: ["main"]
branches: ["main", "develop"]
paths:
- "server/**"
- ".github/workflows/deploy.yml"
Expand Down Expand Up @@ -34,13 +34,13 @@ jobs:
build:
name: "Build Docker Image 🐳"
concurrency:
group: build-deploy
group: build-deploy-${{ github.ref_name }}
cancel-in-progress: true

needs: changes
if: needs.changes.outputs.backend == 'true' || github.event_name == 'workflow_dispatch'
timeout-minutes: 20
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
Expand All @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@v6

- name: Set up Docker Buildx
uses: useblacksmith/setup-docker-builder@v1
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
Expand All @@ -74,7 +74,7 @@ jobs:
type=sha
type=raw,value=latest,enable={{is_default_branch}}

- uses: useblacksmith/build-push-action@v2
- uses: docker/build-push-action@v6
id: push
with:
push: true
Expand All @@ -97,7 +97,7 @@ jobs:
type=sha
type=raw,value=latest,enable={{is_default_branch}}

- uses: useblacksmith/build-push-action@v2
- uses: docker/build-push-action@v6
id: push-playwright
with:
push: true
Expand All @@ -111,9 +111,13 @@ jobs:
IPINFO_ACCESS_TOKEN=${{ secrets.IPINFO_ACCESS_TOKEN }}

deploy-sandbox:
name: "Deploy to Sandbox πŸ§ͺ"
name: "Deploy to Sandbox πŸ§ͺ (Preview)"
needs: [changes, build]
if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped') && (needs.changes.outputs.backend == 'true' || github.event_name == 'workflow_dispatch')
if: >-
always() &&
github.ref_name == 'develop' &&
(needs.build.result == 'success' || needs.build.result == 'skipped') &&
(needs.changes.outputs.backend == 'true' || github.event_name == 'workflow_dispatch')
uses: ./.github/workflows/deploy-environment.yml
with:
environment: sandbox
Expand All @@ -131,8 +135,12 @@ jobs:

deploy-production:
name: "Deploy to Production πŸš€"
needs: [changes, build, deploy-sandbox]
if: always() && !failure() && !cancelled() && (needs.build.result == 'success' || needs.build.result == 'skipped') && (needs.changes.outputs.backend == 'true' || github.event_name == 'workflow_dispatch')
needs: [changes, build]
if: >-
always() &&
github.ref_name == 'main' &&
(needs.build.result == 'success' || needs.build.result == 'skipped') &&
(needs.changes.outputs.backend == 'true' || github.event_name == 'workflow_dispatch')
uses: ./.github/workflows/deploy-environment.yml
with:
environment: production
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permissions:
jobs:
fmt:
name: "Terraform: Lint πŸ“"
runs-on: blacksmith-2vcpu-ubuntu-2404
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:
jobs:
changes:
name: "Detect changes"
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-latest
outputs:
clients: ${{ steps.filter.outputs.clients }}
steps:
Expand All @@ -34,7 +34,7 @@ jobs:
needs: changes
if: needs.changes.outputs.clients == 'true'
timeout-minutes: 15
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-latest

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
jobs:
changes:
name: "Detect changes"
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-latest
outputs:
server: ${{ steps.filter.outputs.server }}
migrations: ${{ steps.filter.outputs.migrations }}
Expand All @@ -39,7 +39,7 @@ jobs:
needs: changes
if: needs.changes.outputs.server == 'true'
timeout-minutes: 15
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
name: "Server: Tinybird Schema 🐦"
needs: changes
if: needs.changes.outputs.tinybird == 'true'
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-latest
services:
tinybird:
image: tinybirdco/tinybird-local:latest
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
name: "Server: Migration Check πŸ“š"
needs: changes
if: needs.changes.outputs.migrations == 'true' && github.event_name == 'pull_request'
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-latest
steps:
- name: Check for disallowed files
id: check
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
name: "Server: Tests 🐍"
needs: changes
if: needs.changes.outputs.server == 'true'
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ubuntu-latest
timeout-minutes: 15
env:
POLAR_ENV: testing
Expand Down
2 changes: 1 addition & 1 deletion clients/apps/web/vercel.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"buildCommand": "cd ../.. && turbo run build --filter=web",
"ignoreCommand": "if [ \"$VERCEL_GIT_COMMIT_REF\" != \"main\" ]; then exit 0; fi; npx turbo-ignore",
"ignoreCommand": "if [ \"$VERCEL_GIT_COMMIT_REF\" != \"main\" ] && [ \"$VERCEL_GIT_COMMIT_REF\" != \"develop\" ]; then exit 0; fi; npx turbo-ignore",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding develop to the ignoreCommand is a good practice to prevent unnecessary deployments from the develop branch, aligning with typical CI/CD workflows where only main or specific release branches trigger production deployments.

  "ignoreCommand": "if [ \"$VERCEL_GIT_COMMIT_REF\" != \"main\" ] && [ \"$VERCEL_GIT_COMMIT_REF\" != \"develop\" ]; then exit 0; fi; npx turbo-ignore"

"rewrites": [
{
"source": "/_mintlify/api/:path+",
Expand Down
12 changes: 8 additions & 4 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ RUN apk add --no-cache curl jq

RUN --mount=type=secret,id=IPINFO_ACCESS_TOKEN \
mkdir /data && \
TOKEN=$(cat /run/secrets/IPINFO_ACCESS_TOKEN) && \
EXPECTED_SHA256=$(curl -fsSL "https://ipinfo.io/data/free/country_asn.mmdb/checksums?token=${TOKEN}" | jq -r '.checksums.sha256') && \
curl -fsSL "https://ipinfo.io/data/free/country_asn.mmdb?token=${TOKEN}" -o /data/country_asn.mmdb && \
echo "${EXPECTED_SHA256} /data/country_asn.mmdb" | sha256sum -c -
if [ -f /run/secrets/IPINFO_ACCESS_TOKEN ]; then \
TOKEN=$(cat /run/secrets/IPINFO_ACCESS_TOKEN) && \
EXPECTED_SHA256=$(curl -fsSL "https://ipinfo.io/data/free/country_asn.mmdb/checksums?token=${TOKEN}" | jq -r '.checksums.sha256') && \
curl -fsSL "https://ipinfo.io/data/free/country_asn.mmdb?token=${TOKEN}" -o /data/country_asn.mmdb && \
echo "${EXPECTED_SHA256} /data/country_asn.mmdb" | sha256sum -c - ; \
else \
echo "WARNING: IPINFO_ACCESS_TOKEN not provided, skipping IPInfo database download" ; \
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When IPINFO_ACCESS_TOKEN is not provided, the /data directory is created but remains empty. The COPY command at a later stage (COPY --from=download-ipinfo /data /data) will still succeed, but the application will receive an empty directory. This is actually handled correctly by the application code (server/polar/app.py lines 147-154), which gracefully handles the FileNotFoundError. However, it would be clearer to create a marker file or document this behavior explicitly in a comment to indicate that the empty directory is intentional for builds without the token.

Suggested change
echo "WARNING: IPINFO_ACCESS_TOKEN not provided, skipping IPInfo database download" ; \
echo "WARNING: IPINFO_ACCESS_TOKEN not provided, skipping IPInfo database download" && \
# Create a marker file so that the empty /data directory is clearly intentional
touch /data/IPINFO_DATABASE_NOT_DOWNLOADED ; \

Copilot uses AI. Check for mistakes.
fi

# Stage 4: Final production image
FROM --platform=$BUILDPLATFORM python:3.14-slim AS production
Expand Down
Loading