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
9 changes: 5 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ HMAC_MAX_SKEW=300
REDIS_URL=redis://redis:6379/0

# ---- AWS / S3 ----
# DEV: points to local MinIO. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are also
# used as MinIO root credentials — change them from the defaults before exposing MinIO.
# PROD: leave S3_ENDPOINT_URL empty and S3_USE_PATH_STYLE=false.
# DEV: points to the local LocalStack container (S3 API on :4566). LocalStack
# accepts any credentials in dev. The bucket is created automatically at startup
# (see localstack/init-s3.sh).
# PROD: leave S3_ENDPOINT_URL empty and set S3_USE_PATH_STYLE=false.
AWS_ACCESS_KEY_ID=minioadmin
AWS_SECRET_ACCESS_KEY=minioadmin
AWS_REGION=us-east-1
S3_BUCKET=nome-do-bucket
S3_ENDPOINT_URL=http://minio:9000
S3_ENDPOINT_URL=http://localstack:4566
S3_USE_PATH_STYLE=true

# ---- CloudFront ----
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: github/codeql-action/init@v3
- uses: github/codeql-action/init@v4
with:
languages: python

# Python does not require a build step — go straight to analysis.
- uses: github/codeql-action/analyze@v3
- uses: github/codeql-action/analyze@v4
with:
category: "/language:python"
10 changes: 4 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ jobs:
test:
name: Tests
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: actions/setup-python@v5
- uses: actions/setup-python@v7
with:
python-version: "3.12"
python-version: "3.14"
cache: pip

- name: Install dependencies
Expand All @@ -51,7 +49,7 @@ jobs:
environment: production

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Configure SSH
run: |
Expand Down
23 changes: 10 additions & 13 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ on:
tags:
- "v*.*.*"

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"

jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Run tests inside worker container
run: |
Expand All @@ -23,7 +20,7 @@ jobs:
-v "$(pwd)/worker:/app/worker" \
-v "$(pwd)/tests:/app/tests" \
-w /app \
python:3.12-slim \
python:3.14-slim \
bash -c "
apt-get update >/dev/null && apt-get install -y --no-install-recommends wget ca-certificates gcc python3-dev >/dev/null 2>&1 && rm -rf /var/lib/apt/lists/* &&
pip install --quiet -r api/requirements.txt -r worker/requirements.txt -r tests/requirements.txt &&
Expand All @@ -36,11 +33,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Docker meta for API
id: meta-api
uses: docker/metadata-action@v5
uses: docker/metadata-action@v6
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/make-it-static-api
tags: |
Expand All @@ -50,7 +47,7 @@ jobs:

- name: Docker meta for Worker
id: meta-worker
uses: docker/metadata-action@v5
uses: docker/metadata-action@v6
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/make-it-static-worker
tags: |
Expand All @@ -59,19 +56,19 @@ jobs:
type=semver,pattern={{major}}.{{minor}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push API image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: ./api
push: true
Expand All @@ -82,7 +79,7 @@ jobs:
cache-to: type=gha,mode=max

- name: Build and push Worker image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: ./worker
push: true
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ on:
pull_request:
branches: ["main"]

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"

jobs:
test:
name: pytest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: actions/setup-python@v5
- uses: actions/setup-python@v7
with:
python-version: "3.12"
python-version: "3.14"
cache: pip

- name: Install dependencies
Expand All @@ -30,7 +27,7 @@ jobs:

- name: Lint with pylint
run: |
pip install "pylint==3.3.*"
pip install "pylint==4.1.*"
pylint api worker tests

- name: Run tests
Expand All @@ -42,7 +39,7 @@ jobs:
--cov-report=xml

- name: Upload coverage report
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
if: always()
with:
name: coverage-report
Expand Down
20 changes: 9 additions & 11 deletions .opencode/skills/docker-dev/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ docker network create make-it-static-network
cp .env.example .env
```

## Dev environment (with MinIO)
## Dev environment (with LocalStack)

```bash
docker compose up --build
Expand All @@ -25,9 +25,8 @@ Services:
| Service | Address | Notes |
|---------|---------|-------|
| API | http://localhost:8123 | FastAPI on port 8123 |
| Site preview | http://localhost:8080 | nginx serving from MinIO |
| MinIO console | http://localhost:9001 | login: `minioadmin` / `minioadmin` |
| MinIO S3 API | http://localhost:9000 | Path-style URLs |
| Site preview | http://localhost:8080 | nginx proxying to LocalStack |
| LocalStack S3 API | http://localhost:4566 | Path-style URLs; bucket auto-created at startup |

### Verify it's working
```bash
Expand All @@ -41,10 +40,9 @@ docker compose logs -f worker
```

### Browse uploaded files
The dev S3 (LocalStack) has no web console — use `awslocal` inside the container:
```bash
# Via MinIO console: http://localhost:9001/browser/my-static-site
# Or CLI:
docker compose exec minio mc ls local/my-static-site --recursive
docker compose exec localstack awslocal s3 ls s3://my-static-site --recursive
```

## Production environment (real S3 + CloudFront)
Expand All @@ -54,7 +52,7 @@ docker compose -f docker-compose.prod.yml up -d --build
```

Differences from dev:
- **No MinIO** — uses real AWS S3.
- **No LocalStack** — uses real AWS S3.
- **No nginx preview** — CloudFront serves the bucket.
- API exposed only on `127.0.0.1:8000` (Caddy/nginx handles TLS externally).

Expand All @@ -73,9 +71,9 @@ ORIGIN_HOST=staging.yourdomain.com
## Critical gotchas

- **External network required**: `make-it-static-network` must exist before any `docker compose` command. Compose declares it as `external: true` and fails if missing.
- **MinIO credentials**: `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` double as MinIO root credentials in dev. Change defaults if exposing MinIO.
- **Bucket auto-creation**: The `minio-init` service creates the bucket on startup in dev only.
- **Path-style URLs**: Dev uses `S3_USE_PATH_STYLE=true` because MinIO doesn't support virtual-hosted style.
- **Dev credentials**: LocalStack accepts any credentials in dev; `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY` are passed to boto3 but ignored by LocalStack.
- **Bucket auto-creation**: `localstack/init-s3.sh` (mounted into the container at `/etc/localstack/init/ready.d/`) creates the bucket and an anonymous-read policy on startup in dev only.
- **Path-style URLs**: Dev uses `S3_USE_PATH_STYLE=true` for LocalStack; real AWS uses virtual-hosted style.
- **`.env` is gitignored**: Never commit secrets.

## Dockerfiles
Expand Down
4 changes: 2 additions & 2 deletions .opencode/skills/security/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ cp .env.example .env

### Secrets that MUST be changed in production
- `HMAC_SECRET`: Generate with `openssl rand -hex 32`. Shared with all clients.
- `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY`: MinIO root credentials in dev; real AWS in prod.
- `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY`: any value works in dev (LocalStack ignores them); real AWS in prod.

### Dev vs Prod S3 configuration
| Env | `S3_ENDPOINT_URL` | `S3_USE_PATH_STYLE` | `AWS_ACCESS_KEY_ID` |
|-----|-------------------|---------------------|---------------------|
| Dev | `http://minio:9000` | `true` | `minioadmin` |
| Dev | `http://localstack:4566` | `true` | (any) |
| Prod | **empty** | `false` | Real AWS key |

## CORS
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# resolution for site-packages) so pylint can resolve those imports.

[MAIN]
py-version = 3.12
py-version = 3.14
init-hook = 'import sys, os; sys.path[:0] = [os.path.join(os.getcwd(), "api"), os.path.join(os.getcwd(), "worker")]'

# Use multiple processes to speed up Pylint (0 = auto-detect, capped at 4).
Expand Down
Loading