v1.0.10 (#39)
Fixes: - Default Nuxt port changed to 3000 (thanks to @yurgeman). - Cleanup old images effectively. - More attempts on container startups (3->6). - Always clean up server logs on restart/redeploy.
This commit is contained in:
@@ -2,9 +2,12 @@ const { docker } = require('../../docker')
|
||||
const { execShellAsync } = require('../../common')
|
||||
const Deployment = require('../../../models/Deployment')
|
||||
|
||||
async function purgeImagesContainers () {
|
||||
async function purgeImagesContainers (configuration) {
|
||||
const { name, tag } = configuration.build.container
|
||||
await execShellAsync('docker container prune -f')
|
||||
await execShellAsync('docker image prune -f --filter=label!=coolify-reserve=true')
|
||||
const IDsToDelete = (await execShellAsync(`docker images ls --filter=reference='${name}' --filter=before='${name}:${tag}' --format '{{json .ID }}'`)).trim().replace(/"/g, '').split('\n')
|
||||
if (IDsToDelete.length !== 0) for (const id of IDsToDelete) await execShellAsync(`docker rmi -f ${id}`)
|
||||
await execShellAsync('docker image prune -f')
|
||||
}
|
||||
|
||||
async function cleanupStuckedDeploymentsInDB () {
|
||||
|
@@ -1,19 +1,16 @@
|
||||
const dayjs = require('dayjs')
|
||||
|
||||
const { cleanupTmp } = require('../common')
|
||||
|
||||
const { saveAppLog } = require('../logging')
|
||||
const copyFiles = require('./deploy/copyFiles')
|
||||
const buildContainer = require('./build/container')
|
||||
const deploy = require('./deploy/deploy')
|
||||
const Deployment = require('../../models/Deployment')
|
||||
const { purgeImagesContainers } = require('./cleanup')
|
||||
const { updateServiceLabels } = require('./configuration')
|
||||
|
||||
async function queueAndBuild (configuration, imageChanged) {
|
||||
const { id, organization, name, branch } = configuration.repository
|
||||
const { domain } = configuration.publish
|
||||
const { deployId, nickname, workdir } = configuration.general
|
||||
const { deployId, nickname } = configuration.general
|
||||
await new Deployment({
|
||||
repoId: id, branch, deployId, domain, organization, name, nickname
|
||||
}).save()
|
||||
@@ -25,8 +22,6 @@ async function queueAndBuild (configuration, imageChanged) {
|
||||
{ repoId: id, branch, deployId, organization, name, domain },
|
||||
{ repoId: id, branch, deployId, organization, name, domain, progress: 'done' })
|
||||
await updateServiceLabels(configuration)
|
||||
cleanupTmp(workdir)
|
||||
await purgeImagesContainers()
|
||||
}
|
||||
|
||||
module.exports = { queueAndBuild }
|
||||
|
@@ -10,7 +10,7 @@ const baseServiceConfiguration = {
|
||||
replicas: 1,
|
||||
restart_policy: {
|
||||
condition: 'any',
|
||||
max_attempts: 3
|
||||
max_attempts: 6
|
||||
},
|
||||
update_config: {
|
||||
parallelism: 1,
|
||||
|
Reference in New Issue
Block a user