lasthourcloud/install/update.js
Andras Bacsai bad84289c4
v1.0.6 (#30)
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!
2021-04-15 22:40:44 +02:00

22 lines
799 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)
const options = program.opts()
if (user !== 'root') {
console.error(`Please run as root! Current user: ${user}`)
process.exit(1)
}
if (options.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: !options.debug, shell: '/bin/bash' })
}