Skip to content

Commit

Permalink
deploy seed_command (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys authored Dec 25, 2024
1 parent 0d5a3e3 commit eebcf1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions fly.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ GDF.extend(class extends GDF {
if (this.remix) {
this.flyRemixSecrets(this.flyApp)
this.flyHealthCheck('/healthcheck')
if (this.postgres) this.flyRelease(`${this.npx} prisma migrate deploy`)
}

if (this.prisma && this.postgres) this.flyRelease(`${this.npx} prisma migrate deploy`)

// set secrets for AdonisJS apps
if (this.adonisjs) this.flyAdonisJsSecrets(this.flyApp)

Expand Down Expand Up @@ -240,7 +241,11 @@ GDF.extend(class extends GDF {
flyRelease(command) {
if (this.flyToml.includes('[deploy]')) return

this.flyToml += `\n[deploy]\n release_command = ${JSON.stringify(command)}`
this.flyToml += `\n[deploy]\n release_command = ${JSON.stringify(command)}\n`

if (this.prismaSeed) {
this.flyToml += ' seed_command = "npx prisma db seed"\n'
}

fs.writeFileSync(this.flyTomlFile, this.flyToml)
}
Expand Down
2 changes: 1 addition & 1 deletion templates/Dockerfile.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ COPY --from=build /app/dist /app/dist
ENV PORT=4321
ENV HOST=0.0.0.0
<% } else if (svelte && !entrypoint) { -%>
<% } else if (svelte && !prisma) { -%>
COPY --from=build /app/build /app/build
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app
Expand Down
3 changes: 2 additions & 1 deletion test/frameworks/remix-blues/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ swap_size_mb = 512
path = "/healthcheck"

[deploy]
release_command = "npx prisma migrate deploy"
release_command = "npx prisma migrate deploy"
seed_command = "npx prisma db seed"

0 comments on commit eebcf1e

Please sign in to comment.