Features:
- Rust support 🦀 (Thanks to @pepoviola)
- Add a default rewrite rule to PHP apps (to index.php)
- Able to control upgrades in a straightforward way

Fixes:
- Improved upgrade scripts
- Simplified prechecks before deployment
- Fixed path deployments
- Fixed already defined apps redirections
- Better error handling - still needs a lot of improvement here!
This commit is contained in:
Andras Bacsai
2021-04-15 22:40:44 +02:00
committed by GitHub
parent 166a573392
commit bad84289c4
56 changed files with 899 additions and 661 deletions

View File

@@ -5,31 +5,36 @@ const { docker } = require('../../../libs/docker')
module.exports = async function (fastify) {
fastify.post('/', async (request, reply) => {
if (!await verifyUserId(request.headers.authorization)) {
reply.code(500).send({ error: 'Invalid request' })
return
}
const configuration = setDefaultConfiguration(request.body)
try {
if (!await verifyUserId(request.headers.authorization)) {
reply.code(500).send({ error: 'Invalid request' })
return
}
const configuration = setDefaultConfiguration(request.body)
const services = (await docker.engine.listServices()).filter(r => r.Spec.Labels.managedBy === 'coolify' && r.Spec.Labels.type === 'application')
let foundDomain = false
const services = (await docker.engine.listServices()).filter(r => r.Spec.Labels.managedBy === 'coolify' && r.Spec.Labels.type === 'application')
let foundDomain = false
for (const service of services) {
const running = JSON.parse(service.Spec.Labels.configuration)
if (running) {
if (
running.publish.domain === configuration.publish.domain &&
running.repository.id !== configuration.repository.id
) {
foundDomain = true
for (const service of services) {
const running = JSON.parse(service.Spec.Labels.configuration)
if (running) {
if (
running.publish.domain === configuration.publish.domain &&
running.repository.id !== configuration.repository.id &&
running.publish.path === configuration.publish.path
) {
foundDomain = true
}
}
}
if (fastify.config.DOMAIN === configuration.publish.domain) foundDomain = true
if (foundDomain) {
reply.code(500).send({ message: 'Domain already in use.' })
return
}
return { message: 'OK' }
} catch (error) {
throw { error, type: 'server' }
}
if (fastify.config.DOMAIN === configuration.publish.domain) foundDomain = true
if (foundDomain) {
reply.code(500).send({ message: 'Domain already in use.' })
return
}
return { message: 'OK' }
})
}