diff --git a/package-lock.json b/package-lock.json index 94308d4..f1082e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "domcloud-bridge", - "version": "0.59.0", + "version": "0.60.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "domcloud-bridge", - "version": "0.59.0", + "version": "0.60.0", "license": "MIT", "dependencies": { "cli": "^1.0.1", diff --git a/package.json b/package.json index b7b3c0c..d51fb1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "domcloud-bridge", - "version": "0.59.0", + "version": "0.60.0", "description": "Deployment runner for DOM Cloud", "main": "app.js", "engines": { diff --git a/src/executor/runnercode.js b/src/executor/runnercode.js index 97d64a7..623ecfc 100644 --- a/src/executor/runnercode.js +++ b/src/executor/runnercode.js @@ -13,13 +13,10 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss let arg; switch (key) { case 'restart': - await writeLog("$> Restarting passenger processes"); - await writeLog(await logmanExec.restartPassenger(domaindata)); + await writeLog("$> Restarting passenger processes"); + await writeLog(await logmanExec.restartPassenger(domaindata)); break; case 'docker': - await sshExec(`export XDG_RUNTIME_DIR=/run/user/$(id -u)`, false); - await sshExec(`export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock`, false); - await sshExec(`export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus`, false); if (value === '' || value === 'on') { await writeLog("$> Enabling docker features"); await writeLog(await dockerExec.enableDocker(domaindata['Username'])); @@ -27,6 +24,7 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss await sshExec(`echo "export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock" >> ~/.bashrc;`); await sshExec(`mkdir -p ~/.config/docker; echo '{"exec-opts": ["native.cgroupdriver=cgroupfs"]}' > ~/.config/docker/daemon.json`); await sshExec(`dockerd-rootless-setuptool.sh install`); + await sshExec(`export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock`, false); } else if (value === 'off') { await writeLog("$> Disabling docker features"); await sshExec(`dockerd-rootless-setuptool.sh uninstall`); diff --git a/src/executor/runnersub.js b/src/executor/runnersub.js index 3d7e8dd..64c35d8 100644 --- a/src/executor/runnersub.js +++ b/src/executor/runnersub.js @@ -347,9 +347,6 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec, if (config.source || config.commands || config.services) { await sshExec(`shopt -s dotglob`, false); await sshExec(`export DOMAIN='${subdomain}'`, false); - // enable managing systemd for linger user - await sshExec(`export XDG_RUNTIME_DIR=/run/user/$(id -u)`, false); - await sshExec(`export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus`, false); await sshExec(`mkdir -p ${subdomaindata['Home directory']}/public_html && cd "$_"`); } @@ -470,22 +467,15 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec, } if (config.services) { + const addFlags = typeof config.services == 'string' ? `-f ${config.services} --progress quiet` : '--progress quiet'; await writeLog("$> Removing docker compose services if exists"); - if (typeof config.services == 'string') { - await sshExec(`docker compose -f ${config.services} --progress quiet down --remove-orphans --rmi all || true`); - } else { - await sshExec(`docker compose --progress-plain quiet --remove-orphans --rmi all || true`); - } + await sshExec(`docker compose ${addFlags} down --remove-orphans --rmi all || true`); await writeLog("$> Configuring NGINX forwarding for docker"); let d = await dockerExec.executeServices(config.services, subdomaindata['Home directory'] + '/public_html', subdomain, writeLog); await writeLog("$> Writing docker compose services"); await writeLog(d.split('\n').map(x => ` ${x}`).join('\n')); await writeLog("$> Applying compose services"); - if (typeof config.services == 'string') { - await sshExec(`docker compose -f ${config.services} --progress quiet up --build --detach`); - } else { - await sshExec(`docker compose up --build --detach`); - } + await sshExec(`docker compose ${addFlags} up --build --detach`); await sshExec(`docker ps`); } diff --git a/sudoutil.js b/sudoutil.js index b44e4ac..cab8181 100755 --- a/sudoutil.js +++ b/sudoutil.js @@ -277,7 +277,7 @@ switch (cli.args.shift()) { break; case 'SHELL_INTERACTIVE': arg = cli.args.shift(); - var su = spawn(env.BASH_SU, [arg, '-s', env.BASH_PATH, '-P', '-l'], { + var su = spawn("machinectl", ['-q', 'shell', arg + '@'], { stdio: 'inherit' }); su.on('close', function (code) {