ci: add disable daily DB refresh flag

This commit is contained in:
Nicolas Giard 2024-01-03 21:24:44 -05:00 committed by GitHub
parent f7708c9411
commit b3c0b30838
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 6 deletions

View file

@ -17,6 +17,11 @@ on:
default: true
required: true
type: boolean
sandboxNoDbRefresh:
description: 'Sandbox Disable Daily DB Refresh'
default: false
required: true
type: boolean
legacySandbox:
description: 'Deploy to Legacy Sandbox'
default: false
@ -325,7 +330,7 @@ jobs:
npm ci
cd ../..
echo "Start Deploy..."
node ./dev/deploy-to-container/cli.js --branch ${{ github.ref_name }} --domain dev.ietf.org --appversion ${{ env.PKG_VERSION }} --commit ${{ github.sha }} --ghrunid ${{ github.run_id }}
node ./dev/deploy-to-container/cli.js --branch ${{ github.ref_name }} --domain dev.ietf.org --appversion ${{ env.PKG_VERSION }} --commit ${{ github.sha }} --ghrunid ${{ github.run_id }} --nodbrefresh ${{ github.event.inputs.sandboxNoDbRefresh }}
- name: Cleanup old docker resources
env:

View file

@ -175,6 +175,9 @@ async function main () {
Image: 'ghcr.io/ietf-tools/datatracker-db:latest',
name: `dt-db-${branch}`,
Hostname: `dt-db-${branch}`,
Labels: {
...argv.nodbrefresh ?? { nodbrefresh: '1' }
},
HostConfig: {
NetworkMode: 'shared',
RestartPolicy: {
@ -194,6 +197,9 @@ async function main () {
Env: [
`CELERY_PASSWORD=${mqKey}`
],
Labels: {
...argv.nodbrefresh ?? { nodbrefresh: '1' }
},
HostConfig: {
Memory: 4 * (1024 ** 3), // in bytes
NetworkMode: 'shared',
@ -222,6 +228,9 @@ async function main () {
`CELERY_ROLE=${conConf.role}`,
'UPDATE_REQUIREMENTS_FROM=requirements.txt'
],
Labels: {
...argv.nodbrefresh ?? { nodbrefresh: '1' }
},
HostConfig: {
Binds: [
'dt-assets:/assets',
@ -254,7 +263,8 @@ async function main () {
appversion: `${argv.appversion}` ?? '0.0.0',
commit: `${argv.commit}` ?? 'unknown',
ghrunid: `${argv.ghrunid}` ?? '0',
hostname
hostname,
...argv.nodbrefresh ?? { nodbrefresh: '1' }
},
HostConfig: {
Binds: [

View file

@ -24,7 +24,8 @@ async function main () {
const containersToRestart = []
for (const container of containers) {
if (
container.Names.some(n => n.startsWith('/dt-db-'))
container.Names.some(n => n.startsWith('/dt-db-')) &&
container.Labels?.nodbrefresh !== '1'
) {
console.info(`Terminating DB container ${container.Id}...`)
dbContainersToCreate.push(container.Names.find(n => n.startsWith('/dt-db-')).substring(1))
@ -37,9 +38,11 @@ async function main () {
v: true
})
} else if (
container.Names.some(n => n.startsWith('/dt-app-')) ||
container.Names.some(n => n.startsWith('/dt-celery-')) ||
container.Names.some(n => n.startsWith('/dt-beat-'))
(
container.Names.some(n => n.startsWith('/dt-app-')) ||
container.Names.some(n => n.startsWith('/dt-celery-')) ||
container.Names.some(n => n.startsWith('/dt-beat-'))
) && container.Labels?.nodbrefresh !== '1'
) {
if (container.State === 'running') {
const appContainer = dock.getContainer(container.Id)