Write the adopted team Rule before the server listens so deploy cannot feature the old draft body.
This commit is contained in:
1 parent
29a8d2b32b
commit
1ec1f48d35
8 files changed
+232
-86
No files matched your search
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Writes the adopted team Rule, including its document, before the server
|
||||
* listens. Container start runs the esbuild bundle of this file.
|
||||
*
|
||||
* Local:
|
||||
* node --env-file=.env --import tsx scripts/seed-team-rule.ts
|
||||
*/
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { seedTeamRule } from "../prisma/seed/teamRule";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const result = await seedTeamRule(prisma);
|
||||
// eslint-disable-next-line no-console -- boot CLI feedback
|
||||
console.log(
|
||||
`Seeded team Rule: ${result.action} ${result.title} (${result.id})`,
|
||||
);
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
+3
-2
@@ -18,7 +18,8 @@ chown -R node:node /app/data
|
||||
mkdir -p /tmp/next-cache
|
||||
chown -R node:node /tmp/next-cache
|
||||
|
||||
# Drop privileges, apply any pending migrations, then exec the server.
|
||||
# Drop privileges, apply any pending migrations, write the adopted team Rule
|
||||
# (document included) before anything listens, then exec the server.
|
||||
# Inner `exec` ensures SIGTERM from Cloudron reaches node for clean shutdown.
|
||||
exec gosu node:node sh -c \
|
||||
'prisma migrate deploy && exec node server.js'
|
||||
'prisma migrate deploy && node team-rule.bundle.cjs && exec node server.js'
|
||||
Reference in new issue
Block a user