coolify/install/update.js
Andras Bacsai 767c65ab10
v1.0.2 (#10)
- Fix restart_policy in Service config.
- Tweaked the upgrade process a bit. REVERTED.
- Refactor and cosmetic surgery here and there.
- Track Service config changes and allow redeploy if it changes.
2021-03-30 23:35:22 +02:00

23 lines
770 B
JavaScript

require('dotenv').config()
const { program } = require('commander')
const shell = require('shelljs')
const user = shell.exec('whoami', { silent: true }).stdout.replace('\n', '')
program.version('0.0.1')
program
.option('-d, --debug', 'Debug outputs.')
.option('-c, --check', 'Only checks configuration.')
.option('-t, --type <type>', 'Deploy type.')
program.parse(process.argv)
if (user !== 'root') {
console.error(`Please run as root! Current user: ${user}`)
process.exit(1)
}
if (program.type === 'upgrade') {
shell.exec('docker service rm coollabs-coolify_coolify')
shell.exec('set -a && source .env && set +a && envsubst < install/coolify-template.yml | docker stack deploy -c - coollabs-coolify', { silent: !program.debug, shell: '/bin/bash' })
}