Merge pull request #8392 from Budibase/fix/startup
Startup fixes + remove bucket default names
This commit is contained in:
commit
332f0eb52f
|
@ -79,11 +79,11 @@ spec:
|
||||||
- name: MINIO_URL
|
- name: MINIO_URL
|
||||||
value: {{ .Values.services.objectStore.url }}
|
value: {{ .Values.services.objectStore.url }}
|
||||||
- name: PLUGIN_BUCKET_NAME
|
- name: PLUGIN_BUCKET_NAME
|
||||||
value: {{ .Values.services.objectStore.pluginBucketName | default "plugins" | quote }}
|
value: {{ .Values.services.objectStore.pluginBucketName | quote }}
|
||||||
- name: APPS_BUCKET_NAME
|
- name: APPS_BUCKET_NAME
|
||||||
value: {{ .Values.services.objectStore.appsBucketName | default "apps" | quote }}
|
value: {{ .Values.services.objectStore.appsBucketName | quote }}
|
||||||
- name: GLOBAL_CLOUD_BUCKET_NAME
|
- name: GLOBAL_CLOUD_BUCKET_NAME
|
||||||
value: {{ .Values.services.objectStore.globalBucketName | default "global" | quote }}
|
value: {{ .Values.services.objectStore.globalBucketName | quote }}
|
||||||
- name: PORT
|
- name: PORT
|
||||||
value: {{ .Values.services.apps.port | quote }}
|
value: {{ .Values.services.apps.port | quote }}
|
||||||
{{ if .Values.services.worker.publicApiRateLimitPerSecond }}
|
{{ if .Values.services.worker.publicApiRateLimitPerSecond }}
|
||||||
|
|
|
@ -78,11 +78,11 @@ spec:
|
||||||
- name: MINIO_URL
|
- name: MINIO_URL
|
||||||
value: {{ .Values.services.objectStore.url }}
|
value: {{ .Values.services.objectStore.url }}
|
||||||
- name: PLUGIN_BUCKET_NAME
|
- name: PLUGIN_BUCKET_NAME
|
||||||
value: {{ .Values.services.objectStore.pluginBucketName | default "plugins" | quote }}
|
value: {{ .Values.services.objectStore.pluginBucketName | quote }}
|
||||||
- name: APPS_BUCKET_NAME
|
- name: APPS_BUCKET_NAME
|
||||||
value: {{ .Values.services.objectStore.appsBucketName | default "apps" | quote }}
|
value: {{ .Values.services.objectStore.appsBucketName | quote }}
|
||||||
- name: GLOBAL_CLOUD_BUCKET_NAME
|
- name: GLOBAL_CLOUD_BUCKET_NAME
|
||||||
value: {{ .Values.services.objectStore.globalBucketName | default "global" | quote }}
|
value: {{ .Values.services.objectStore.globalBucketName | quote }}
|
||||||
- name: PORT
|
- name: PORT
|
||||||
value: {{ .Values.services.worker.port | quote }}
|
value: {{ .Values.services.worker.port | quote }}
|
||||||
- name: MULTI_TENANCY
|
- name: MULTI_TENANCY
|
||||||
|
|
|
@ -55,7 +55,12 @@ export const doWithLock = async (opts: LockOptions, task: any) => {
|
||||||
let lock
|
let lock
|
||||||
try {
|
try {
|
||||||
// aquire lock
|
// aquire lock
|
||||||
let name: string = `${tenancy.getTenantId()}_${opts.name}`
|
let name: string
|
||||||
|
if (opts.systemLock) {
|
||||||
|
name = opts.name
|
||||||
|
} else {
|
||||||
|
name = `${tenancy.getTenantId()}_${opts.name}`
|
||||||
|
}
|
||||||
if (opts.nameSuffix) {
|
if (opts.nameSuffix) {
|
||||||
name = name + `_${opts.nameSuffix}`
|
name = name + `_${opts.nameSuffix}`
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,6 @@ module.exports = server.listen(env.PORT || 0, async () => {
|
||||||
eventEmitter.emitPort(env.PORT)
|
eventEmitter.emitPort(env.PORT)
|
||||||
fileSystem.init()
|
fileSystem.init()
|
||||||
await redis.init()
|
await redis.init()
|
||||||
await initPro()
|
|
||||||
|
|
||||||
// run migrations on startup if not done via http
|
// run migrations on startup if not done via http
|
||||||
// not recommended in a clustered environment
|
// not recommended in a clustered environment
|
||||||
|
@ -180,8 +179,11 @@ module.exports = server.listen(env.PORT || 0, async () => {
|
||||||
// check for version updates
|
// check for version updates
|
||||||
await installation.checkInstallVersion()
|
await installation.checkInstallVersion()
|
||||||
|
|
||||||
// done last - this will never complete
|
// done last - these will never complete
|
||||||
await automations.init()
|
let promises = []
|
||||||
|
promises.push(automations.init())
|
||||||
|
promises.push(initPro())
|
||||||
|
await Promise.all(promises)
|
||||||
})
|
})
|
||||||
|
|
||||||
const shutdown = () => {
|
const shutdown = () => {
|
||||||
|
|
|
@ -116,8 +116,8 @@ exports.externalTrigger = async function (
|
||||||
|
|
||||||
exports.rebootTrigger = async () => {
|
exports.rebootTrigger = async () => {
|
||||||
// reboot cron option is only available on the main thread at
|
// reboot cron option is only available on the main thread at
|
||||||
// startup and only usable in self host
|
// startup and only usable in self host and single tenant environments
|
||||||
if (env.isInThread() || !env.SELF_HOSTED) {
|
if (env.isInThread() || !env.SELF_HOSTED || env.MULTI_TENANCY) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// iterate through all production apps, find the reboot crons
|
// iterate through all production apps, find the reboot crons
|
||||||
|
|
|
@ -97,6 +97,7 @@ const migrateWithLock = async (options?: MigrationOptions) => {
|
||||||
type: LockType.TRY_ONCE,
|
type: LockType.TRY_ONCE,
|
||||||
name: LockName.MIGRATIONS,
|
name: LockName.MIGRATIONS,
|
||||||
ttl: 1000 * 60 * 15, // auto expire the migration lock after 15 minutes
|
ttl: 1000 * 60 * 15, // auto expire the migration lock after 15 minutes
|
||||||
|
systemLock: true,
|
||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
await migrations.runMigrations(MIGRATIONS, options)
|
await migrations.runMigrations(MIGRATIONS, options)
|
||||||
|
|
|
@ -28,4 +28,8 @@ export interface LockOptions {
|
||||||
* The suffix to add to the lock name for additional uniqueness
|
* The suffix to add to the lock name for additional uniqueness
|
||||||
*/
|
*/
|
||||||
nameSuffix?: string
|
nameSuffix?: string
|
||||||
|
/**
|
||||||
|
* This is a system-wide lock - don't use tenancy in lock key
|
||||||
|
*/
|
||||||
|
systemLock?: boolean
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ const migrateWithLock = async (options?: MigrationOptions) => {
|
||||||
type: LockType.TRY_ONCE,
|
type: LockType.TRY_ONCE,
|
||||||
name: LockName.MIGRATIONS,
|
name: LockName.MIGRATIONS,
|
||||||
ttl: 1000 * 60 * 15, // auto expire the migration lock after 15 minutes
|
ttl: 1000 * 60 * 15, // auto expire the migration lock after 15 minutes
|
||||||
|
systemLock: true,
|
||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
await migrations.runMigrations(MIGRATIONS, options)
|
await migrations.runMigrations(MIGRATIONS, options)
|
||||||
|
|
Loading…
Reference in New Issue