revert: drop google oauth emulator (deferred)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -19,11 +19,10 @@ Starts all local services, creates the database, writes env files, runs migratio
|
||||
|
||||
1. Starts `postgresql`, `redis-server`, and `clickhouse-server` via `service`
|
||||
2. Starts ElasticMQ in the background on `:9324` (skipped if already running)
|
||||
3. Starts the Google OAuth emulator in the background on `:4002` (skipped if already running)
|
||||
4. Creates the `autumn` Postgres database if it does not exist
|
||||
5. Writes `server/.env` (skips if already present) and `vite/.env` from `vite/.env.example`
|
||||
6. Runs `bun db:migrate`
|
||||
7. Launches server `:8080`, vite `:3000`, checkout `:3001`, and workers via `scripts/dev.ts`
|
||||
3. Creates the `autumn` Postgres database if it does not exist
|
||||
4. Writes `server/.env` (skips if already present) and `vite/.env` from `vite/.env.example`
|
||||
5. Runs `bun db:migrate`
|
||||
6. Launches server `:8080`, vite `:3000`, checkout `:3001`, and workers via `scripts/dev.ts`
|
||||
|
||||
## Static team-wide env vars
|
||||
|
||||
@@ -52,7 +51,6 @@ Set these in the process environment before running `bun dev:agent` and they wil
|
||||
| Redis | 6379 | Used for `CACHE_URL` and `CACHE_URL_US_EAST` |
|
||||
| ElasticMQ | 9324 | Local SQS replacement, queue: `autumn.fifo` |
|
||||
| ClickHouse | 8123 | Used for `TINYBIRD_CLICKHOUSE_URL` |
|
||||
| Google OAuth emulator | 4002 | Local emulator for Google sign-in |
|
||||
| Server | 8080 | Autumn API server |
|
||||
| Vite | 3000 | Frontend dev server |
|
||||
| Checkout | 3001 | Checkout app dev server |
|
||||
@@ -86,10 +84,3 @@ If you change ports after `server/.env` has already been generated, delete it fi
|
||||
```bash
|
||||
rm server/.env vite/.env && bun dev:agent 8181 3100
|
||||
```
|
||||
|
||||
## Google OAuth (local emulator)
|
||||
|
||||
The Google OAuth emulator starts automatically at `:4002` during `bun dev:agent`. Sign in with Google works out of the box using the test user:
|
||||
|
||||
- Email: `testuser@example.com`
|
||||
- Password: any (the emulator accepts all logins)
|
||||
|
||||
@@ -33,51 +33,16 @@ if ! pgrep -f 'elasticmq.*\.jar' >/dev/null 2>&1; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- 3. Google OAuth emulator ---
|
||||
if ! pgrep -f 'emulate.*google' >/dev/null 2>&1; then
|
||||
log "Starting Google OAuth emulator on :4002"
|
||||
sudo mkdir -p /var/log/autumn && sudo chmod 0777 /var/log/autumn
|
||||
lsof -ti:4002 | xargs kill -9 2>/dev/null || true
|
||||
_GOOGLE_SEED_PORT="${AGENT_SERVER_PORT:-8080}"
|
||||
cat > /tmp/google-oauth-seed.yaml <<EOF
|
||||
google:
|
||||
users:
|
||||
- email: testuser@example.com
|
||||
name: Test User
|
||||
oauth_clients:
|
||||
- client_id: my-client-id.apps.googleusercontent.com
|
||||
client_secret: GOCSPX-secret
|
||||
redirect_uris:
|
||||
- http://localhost:${_GOOGLE_SEED_PORT}/api/auth/callback/google
|
||||
EOF
|
||||
nohup npx emulate --service google --seed /tmp/google-oauth-seed.yaml \
|
||||
>/var/log/autumn/google-oauth-emulator.log 2>&1 &
|
||||
disown || true
|
||||
log "Waiting for Google OAuth emulator to be ready"
|
||||
EMULATOR_READY=0
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf -o /dev/null http://localhost:4002; then
|
||||
EMULATOR_READY=1
|
||||
break
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
if [ "$EMULATOR_READY" -eq 0 ]; then
|
||||
echo "[agent-services] ERROR: Google OAuth emulator did not become ready after 15s. Check /var/log/autumn/google-oauth-emulator.log" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# --- 4. Ensure Postgres DB exists ---
|
||||
# --- 3. Ensure Postgres DB exists ---
|
||||
DB_NAME="autumn"
|
||||
sudo -u postgres psql -tc "SELECT 1 FROM pg_database WHERE datname = '$DB_NAME'" 2>/dev/null \
|
||||
| grep -q 1 || sudo -u postgres createdb "$DB_NAME"
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';" >/dev/null 2>&1 || true
|
||||
|
||||
# --- 5. Write env files (no-op if server/.env already exists) ---
|
||||
# --- 4. Write env files (no-op if server/.env already exists) ---
|
||||
bun scripts/setup/writeAgentEnv.ts
|
||||
|
||||
# --- 6. DB migrations ---
|
||||
# --- 5. DB migrations ---
|
||||
log "Running migrations"
|
||||
bun db:generate >/dev/null 2>&1 || true
|
||||
bun db:migrate
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
google:
|
||||
users:
|
||||
- email: testuser@example.com
|
||||
name: Test User
|
||||
oauth_clients:
|
||||
- client_id: my-client-id.apps.googleusercontent.com
|
||||
client_secret: GOCSPX-secret
|
||||
redirect_uris:
|
||||
- http://localhost:8080/api/auth/callback/google
|
||||
@@ -70,8 +70,6 @@ CLIENT_URL=http://localhost:${vitePort}
|
||||
STRIPE_WEBHOOK_URL=http://localhost:${serverPort}
|
||||
|
||||
# Static team-wide (pass-through from process.env)
|
||||
GOOGLE_CLIENT_ID=my-client-id.apps.googleusercontent.com
|
||||
GOOGLE_CLIENT_SECRET=GOCSPX-secret
|
||||
${passLines}
|
||||
|
||||
# Environment
|
||||
|
||||
Reference in New Issue
Block a user