fixed accelerate and docker

This commit is contained in:
Zai Shi 2024-12-14 11:39:04 -08:00
parent fa6184c29b
commit 13279dfe56
3 changed files with 16 additions and 10 deletions

View File

@ -8,15 +8,14 @@
"with-env": "dotenv -c development --",
"with-env:prod": "dotenv -c --",
"dev": "concurrently -n \"dev,codegen,prisma-studio\" -k \"next dev --port 8102\" \"pnpm run codegen:watch\" \"pnpm run prisma-studio\"",
"build": "pnpm run codegen:prod && next build",
"build": "pnpm run codegen && next build",
"docker-build": "pnpm run codegen && next build --experimental-build-mode compile",
"self-host-seed-script": "tsup --config prisma/tsup.config.ts",
"analyze-bundle": "ANALYZE_BUNDLE=1 pnpm run build",
"start": "next start --port 8102",
"codegen-prisma": "pnpm run prisma generate",
"codegen-prisma:watch": "pnpm run prisma generate --watch",
"codegen": "pnpm run codegen-prisma && pnpm run generate-docs",
"codegen:prod": "pnpm run prisma generate --no-engine && pnpm run generate-docs",
"codegen": "pnpm run with-env bash -c 'if [ \"$STACK_ACCELERATE_ENABLED\" = \"true\" ]; then pnpm run prisma generate --no-engine && pnpm run generate-docs; else pnpm run codegen-prisma && pnpm run generate-docs; fi'",
"codegen:watch": "concurrently -n \"prisma,docs\" -k \"pnpm run codegen-prisma:watch\" \"pnpm run watch-docs\"",
"psql-inner": "psql $STACK_DATABASE_CONNECTION_STRING",
"psql": "pnpm run with-env pnpm run psql-inner",

View File

@ -128,21 +128,28 @@ async function seed() {
console.log(`Updated signUpEnabled for internal project: ${signUpEnabled}`);
}
const keySet = {
publishableClientKey: process.env.STACK_SEED_INTERNAL_PROJECT_PUBLISHABLE_CLIENT_KEY || throwErr('STACK_SEED_INTERNAL_PROJECT_PUBLISHABLE_CLIENT_KEY is not set'),
secretServerKey: process.env.STACK_SEED_INTERNAL_PROJECT_SECRET_SERVER_KEY || throwErr('STACK_SEED_INTERNAL_PROJECT_SECRET_SERVER_KEY is not set'),
superSecretAdminKey: process.env.STACK_SEED_INTERNAL_PROJECT_SUPER_SECRET_ADMIN_KEY || throwErr('STACK_SEED_INTERNAL_PROJECT_SUPER_SECRET_ADMIN_KEY is not set'),
};
await prisma.apiKeySet.upsert({
where: { projectId_id: { projectId: 'internal', id: apiKeyId } },
update: {},
update: {
...keySet,
},
create: {
id: apiKeyId,
projectId: 'internal',
description: "Internal API key set",
// These keys must match the values used in the Stack dashboard env to be able to login via the UI.
publishableClientKey: process.env.STACK_SEED_INTERNAL_PROJECT_PUBLISHABLE_CLIENT_KEY || throwErr('STACK_SEED_INTERNAL_PROJECT_PUBLISHABLE_CLIENT_KEY is not set'),
secretServerKey: process.env.STACK_SEED_INTERNAL_PROJECT_SECRET_SERVER_KEY || throwErr('STACK_SEED_INTERNAL_PROJECT_SECRET_SERVER_KEY is not set'),
superSecretAdminKey: process.env.STACK_SEED_INTERNAL_PROJECT_SUPER_SECRET_ADMIN_KEY || throwErr('STACK_SEED_INTERNAL_PROJECT_SUPER_SECRET_ADMIN_KEY is not set'),
expiresAt: new Date('2099-12-31T23:59:59Z'),
...keySet,
}
});
console.log('Updated internal API key set');
// Create optional default admin user if credentials are provided.
// This user will be able to login to the dashboard with both email/password and magic link.
if ((adminEmail && adminPassword) || adminGithubId) {

View File

@ -1,8 +1,8 @@
NEXT_PUBLIC_STACK_API_URL=http://localhost:8102
NEXT_PUBLIC_STACK_DASHBOARD_URL=http://localhost:8101
STACK_DATABASE_CONNECTION_STRING=postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@host.docker.internal:5432/stackframe
STACK_DIRECT_DATABASE_CONNECTION_STRING=postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@host.docker.internal:5432/stackframe
STACK_DATABASE_CONNECTION_STRING=postgres://postgres:password@host.docker.internal:5432/stackframe
STACK_DIRECT_DATABASE_CONNECTION_STRING=postgres://postgres:password@host.docker.internal:5432/stackframe
STACK_SERVER_SECRET=23-wuNpik0gIW4mruTz25rbIvhuuvZFrLOLtL7J4tyo