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:
@@ -9,6 +9,7 @@ const { queueAndBuild } = require('../../../libs/applications')
|
||||
const { setDefaultConfiguration, precheckDeployment } = require('../../../libs/applications/configuration')
|
||||
const { docker } = require('../../../libs/docker')
|
||||
const cloneRepository = require('../../../libs/applications/github/cloneRepository')
|
||||
const { purgeImagesContainers } = require('../../../libs/applications/cleanup')
|
||||
|
||||
module.exports = async function (fastify) {
|
||||
// TODO: Add this to fastify plugin
|
||||
@@ -93,9 +94,9 @@ module.exports = async function (fastify) {
|
||||
reply.code(200).send({ message: 'Already in the queue.' })
|
||||
return
|
||||
}
|
||||
queueAndBuild(configuration, imageChanged)
|
||||
|
||||
reply.code(201).send({ message: 'Deployment queued.', nickname: configuration.general.nickname, name: configuration.build.container.name })
|
||||
await queueAndBuild(configuration, imageChanged)
|
||||
} catch (error) {
|
||||
const { id, organization, name, branch } = configuration.repository
|
||||
const { domain } = configuration.publish
|
||||
@@ -103,7 +104,6 @@ module.exports = async function (fastify) {
|
||||
await Deployment.findOneAndUpdate(
|
||||
{ repoId: id, branch, deployId, organization, name, domain },
|
||||
{ repoId: id, branch, deployId, organization, name, domain, progress: 'failed' })
|
||||
cleanupTmp(configuration.general.workdir)
|
||||
if (error.name === 'Error') {
|
||||
// Error during runtime
|
||||
await new ApplicationLog({ repoId: id, branch, deployId, event: `[ERROR 😖]: ${error.stack}` }).save()
|
||||
@@ -114,6 +114,9 @@ module.exports = async function (fastify) {
|
||||
if (reply.sent) await new ApplicationLog({ repoId: id, branch, deployId, event: `[ERROR 😖]: ${error.stack}` }).save()
|
||||
}
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
cleanupTmp(configuration.general.workdir)
|
||||
await purgeImagesContainers(configuration)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user