Skip to content
Closed
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
15 changes: 7 additions & 8 deletions .github/workflows/database-profile-reliability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 10
services:
mysql:
image: mysql:8.4
postgres:
image: postgres:16
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: loops_profile_tests
POSTGRES_PASSWORD: postgres
POSTGRES_DB: loops_profile_tests
ports:
- 3306:3306
- 5432:5432
options: >-
--health-cmd="mysqladmin ping --host=127.0.0.1 --user=root"
--health-cmd="pg_isready --host=127.0.0.1 --username=postgres"
--health-interval=5s
--health-timeout=3s
--health-retries=30
Expand All @@ -49,7 +48,7 @@ jobs:
- uses: ./.github/actions/setup-js
- name: Verify profile queries and lifecycle decisions without database writes
env:
LOOPS_ACTIVATION_READONLY_TEST_URL: mysql://root@127.0.0.1:3306/loops_profile_tests
LOOPS_ACTIVATION_READONLY_TEST_URL: postgres://postgres:postgres@127.0.0.1:5432/loops_profile_tests
run: >-
bun test
scripts/loops/activation.test.ts
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-self-hosting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ jobs:
docker compose up -d
echo "Waiting for services to initialize..."

- name: Wait for MySQL to be healthy
- name: Wait for PostgreSQL to be healthy
run: |
echo "Waiting for MySQL..."
timeout 120 bash -c 'until docker inspect cap-mysql --format="{{.State.Health.Status}}" 2>/dev/null | grep -q "healthy"; do sleep 2; done'
echo "MySQL is healthy"
echo "Waiting for PostgreSQL..."
timeout 120 bash -c 'until docker inspect cap-postgres --format="{{.State.Health.Status}}" 2>/dev/null | grep -q "healthy"; do sleep 2; done'
echo "PostgreSQL is healthy"

- name: Wait for MinIO to be healthy
run: |
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
- name: Test database has tables
run: |
echo "Testing database..."
tables=$(docker exec cap-mysql mysql -ucap -pcap-local-pwd-123 cap -e "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='cap';" -s -N 2>/dev/null)
tables=$(docker exec cap-postgres psql -U cap -d cap -tAc "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public';" 2>/dev/null)
if [ "$tables" -gt 0 ]; then
echo "✓ Database has $tables tables (migrations ran successfully)"
else
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/validate-migration-journal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,26 @@ jobs:
run: |
JOURNAL_PATH="packages/database/migrations/meta/_journal.json"

# Get the journal from previous commit
git fetch origin
# Compare against the journal on the branch this PR targets
git fetch origin "${{ github.base_ref }}"
BASE_REF="origin/${{ github.base_ref }}"

# Check if journal exists in previous commit
if git show 34cd664a1215:$JOURNAL_PATH > /dev/null 2>&1; then
git show 34cd664a1215:$JOURNAL_PATH > base.json
if git show "$BASE_REF:$JOURNAL_PATH" > /dev/null 2>&1; then
git show "$BASE_REF:$JOURNAL_PATH" > base.json
else
echo '{"version":"5","dialect":"mysql","entries":[]}' > base.json
echo '{"version":"7","dialect":"postgresql","entries":[]}' > base.json
fi

# Get current journal
cp $JOURNAL_PATH current.json

BASE_DIALECT=$(jq -r '.dialect' base.json)
CURRENT_DIALECT=$(jq -r '.dialect' current.json)
if [ "$BASE_DIALECT" = "mysql" ] && [ "$CURRENT_DIALECT" = "postgresql" ]; then
echo "::notice file=$JOURNAL_PATH,title=Database Rebaseline::Migrations were rebaselined from MySQL to PostgreSQL; skipping the append-only comparison."
exit 0
fi

# Check version and dialect haven't changed
BASE_VERSION=$(jq -r '.version' base.json)
CURRENT_VERSION=$(jq -r '.version' current.json)
Expand All @@ -39,8 +46,6 @@ jobs:
exit 1
fi

BASE_DIALECT=$(jq -r '.dialect' base.json)
CURRENT_DIALECT=$(jq -r '.dialect' current.json)
if [ "$BASE_DIALECT" != "$CURRENT_DIALECT" ]; then
echo "::error file=$JOURNAL_PATH,line=3,title=Dialect Changed::Migration journal dialect cannot be changed (was: $BASE_DIALECT, now: $CURRENT_DIALECT)"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Additionally, `unused_must_use = "deny"` applies to all Rust code: every `Result
- TypeScript / JS / JSON / CSS: **tab indent** and **double-quoted** strings, enforced by Biome (see `biome.json`). Do not configure per-file overrides.
- Rust: `rustfmt` default style + the denied clippy lints in the Pre-Generation Invariants above.
- Naming: files kebab‑case (`user-menu.tsx`); React/Solid components PascalCase; hooks `useX`; Rust modules snake_case; crates kebab‑case.
- Runtime: Node 20, Bun 1.4.0, Rust 1.88+, Docker for MySQL/MinIO.
- Runtime: Node 20, Bun 1.4.0, Rust 1.88+, Docker for PostgreSQL/MinIO.

(See **Pre-Generation Invariants** at the top of this file for the comments policy and the denied clippy/Biome patterns. Those are the source of truth — do not duplicate or weaken them here.)

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Before anything else, make sure you have the following installed:
Keep the root `react` and `react-dom` development dependencies aligned with `apps/mobile`. They keep Expo native dependencies deduplicated under Bun’s hoisted linker, while the web app retains its separately resolved React version.

Run `bun install`, then run `bun run env-setup` to generate a `.env` file configured for your environment.
It will ask you which apps you intend to run, whether you'd like to use Docker to run S3 (MinIO) and MySQL locally,
It will ask you which apps you intend to run, whether you'd like to use Docker to run S3 (MinIO) and PostgreSQL locally,
and allow you to provide overrides as needed.

Then run `bun run cap-setup` to install native dependencies such as FFmpeg.
Expand All @@ -62,5 +62,5 @@ and `%programfiles%/so.cap.desktop.dev/recordings` on Windows.

### `@cap/web` (cap.so website)

When running `bun run dev` or `bun run dev:web`, a MySQL database and MinIO S3 server will also be using Docker.
When running `bun run dev` or `bun run dev:web`, a PostgreSQL database and MinIO S3 server will also be using Docker.
If you want to _only_ run the `@cap/web` NextJS app, `cd` into `./apps/web` and run `bun run dev`.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ See the [self-hosting guide](https://cap.so/docs/self-hosting) for email setup,

## Local Development

Cap is a Turborepo monorepo with Rust, TypeScript, Tauri, SolidStart, Next.js, Drizzle, MySQL, Tailwind CSS, and shared media crates.
Cap is a Turborepo monorepo with Rust, TypeScript, Tauri, SolidStart, Next.js, Drizzle, PostgreSQL, Tailwind CSS, and shared media crates.

Requirements:

- Node.js 20 or newer
- Bun 1.4.0
- Rust 1.88 or newer
- Docker for MySQL, MinIO, and local services
- Docker for PostgreSQL, MinIO, and local services

Install and set up the repo:

Expand Down
Loading