Skip to content

Commit 35d6c50

Browse files
committed
actually do frontend re-deploys
1 parent 85a230d commit 35d6c50

File tree

4 files changed

+104
-10
lines changed

4 files changed

+104
-10
lines changed

dist/index.js

Lines changed: 66 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/coolify.ts

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ import {
2323
startApplicationByUuid,
2424
startServiceByUuid,
2525
updateEnvsByServiceUuid,
26-
updateServiceByUuid
26+
updateServiceByUuid,
27+
updateApplicationByUuid,
28+
deployByTagOrUuid
2729
} from './client/sdk.gen.js'
2830
import { TCPTunnelClient } from './tcp-tunnel.js'
2931

@@ -220,10 +222,13 @@ export default class Coolify {
220222
(service) => service.name === supabaseComponentName
221223
)
222224
let backendServiceUUID: string
225+
let isNewSupabaseService: boolean = false
223226
let createdNewSupabaseService: boolean = false
224227
if (existingSupabaseService && existingSupabaseService.uuid) {
225228
backendServiceUUID = existingSupabaseService.uuid
229+
isNewSupabaseService = false
226230
} else {
231+
isNewSupabaseService = true
227232
console.log(`Creating new supabase service ${supabaseComponentName}`)
228233
createdNewSupabaseService = true
229234
const updatedDockerCompose = await readFile(
@@ -369,7 +374,8 @@ export default class Coolify {
369374
supabase_url,
370375
supabase_anon_key,
371376
supabase_service_role_key,
372-
deploymentKey
377+
deploymentKey,
378+
isNewSupabaseService
373379
}
374380
}
375381
async cleanup({
@@ -435,7 +441,8 @@ export default class Coolify {
435441
supabase_url,
436442
supabase_anon_key,
437443
supabase_service_role_key,
438-
deploymentKey
444+
deploymentKey,
445+
isNewSupabaseService
439446
} = await this.getSupabaseServiceUUIDOrCreateNewOne({
440447
supabaseComponentName,
441448
ephemeral
@@ -469,15 +476,15 @@ export default class Coolify {
469476
serviceUUID: backendServiceUUID,
470477
deployToken: deploymentKey,
471478
checkedOutProjectDir,
472-
resetDb: true,
479+
resetDb: isNewSupabaseService,
473480
postgresPassword: postgres_password
474481
})
475482

476483
const existingFrontendApp = existingApplications.data?.find(
477484
(app) => app.name === frontendAppName
478485
)
479486
let appUUID = existingFrontendApp?.uuid
480-
if (!existingFrontendApp) {
487+
if (!existingFrontendApp || !appUUID) {
481488
//Create frontend service, deploy it
482489
const frontendApp = await createPrivateGithubAppApplication({
483490
client: this.client,
@@ -553,6 +560,29 @@ export default class Coolify {
553560
appUUID: appUUID
554561
})
555562
console.log('Frontend started')
563+
} else {
564+
//Update the commit SHA of the frontend app
565+
await updateApplicationByUuid({
566+
client: this.client,
567+
path: {
568+
uuid: appUUID
569+
},
570+
body: {
571+
git_commit_sha: gitCommitSha
572+
}
573+
})
574+
console.log(
575+
`Deploying frontend app ${appUUID} with commit ${gitCommitSha}`
576+
)
577+
await deployByTagOrUuid({
578+
client: this.client,
579+
query: {
580+
uuid: appUUID
581+
}
582+
})
583+
await this.waitUntilServiceOrAppisReady({
584+
appUUID: appUUID
585+
})
556586
}
557587

558588
return {

supabase-pawtograder.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,8 @@ services:
819819
- 'SUPABASE_SERVICE_ROLE_KEY=${SERVICE_SUPABASESERVICE_KEY}'
820820
- 'SUPABASE_DB_URL=postgresql://postgres:${SERVICE_PASSWORD_POSTGRES}@${POSTGRES_HOSTNAME:-supabase-db}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-postgres}'
821821
- 'VERIFY_JWT=${FUNCTIONS_VERIFY_JWT:-false}'
822+
- 'AWS_ACCESS_KEY_ID=${SERVICE_AWS_ACCESS_KEY_ID}'
823+
- 'AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}'
822824
volumes:
823825
- './volumes/functions:/home/deno/functions'
824826
- type: bind

0 commit comments

Comments
 (0)