From c5edd894b007bbaf2628031367ef95dd896b80f7 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sat, 5 Oct 2024 02:16:37 +0700 Subject: [PATCH] Adjust code --- src/executor/runnercode.js | 1 - src/executor/runnersub.js | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/executor/runnercode.js b/src/executor/runnercode.js index ba4345d..245543f 100644 --- a/src/executor/runnercode.js +++ b/src/executor/runnercode.js @@ -47,7 +47,6 @@ export async function runConfigCodeFeatures(key, value, writeLog, domaindata, ss await sshExec(`cd ~/tmp && mkdir -p ~/.pyenv/versions/${parg.version}`); await sshExec(`wget -O python.tar.zst "${parg.binary}" && tar -axf python.tar.zst && rm $_`); await sshExec(`mv ~/tmp/python/install/* ~/.pyenv/versions/${parg.version} || true ; rm -rf ~/tmp/python`); - await sshExec(`(cd ~/.pyenv/versions/${parg.version}/bin && ln -s python3 python) || true`); await sshExec("cd ~/public_html", false); } else if (parg.version !== "system") { await sshExec(`pyenv install ${parg.version} -s`); diff --git a/src/executor/runnersub.js b/src/executor/runnersub.js index 2a2119a..3d2589b 100644 --- a/src/executor/runnersub.js +++ b/src/executor/runnersub.js @@ -352,7 +352,7 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec, await featureRunner("root public_html/public"); } await writeLog("$> Removing docker compose services if exists"); - await sshExec(`docker compose ${addFlags} down --remove-orphans --rmi all || true`); + await sshExec(`docker compose ${addFlags} down --remove-orphans || true`); await writeLog("$> Configuring NGINX forwarding for docker"); let d = await dockerExec.executeServices(services, htmlDir, subdomain, writeLog); await writeLog("$> Writing docker compose services"); @@ -444,9 +444,12 @@ export async function runConfigSubdomain(config, domaindata, subdomain, sshExec, } if (source.credentials?.github?.ssh) { const configFileContent = `Host github.com\n\tStrictHostKeyChecking no\n\tIdentityFile ~/.ssh/id_github_com\n`; - await writeLog("$> writing SSH private key for cloning github.com repository"); + await writeLog("$> writing SSH keys for cloning github.com repository"); await sshExec(`mkdir -p ~/.ssh; touch $HOME/.ssh/{id_github_com,config}; chmod 0600 $HOME/.ssh/*`, false); await sshExec(`echo "${Buffer.from(source.credentials.github.ssh).toString('base64')}" | base64 --decode > $HOME/.ssh/id_github_com`, false); + if (source.credentials.github.sshPub) { + await sshExec(`echo "${Buffer.from(source.credentials.github.sshPub).toString('base64')}" | base64 --decode > $HOME/.ssh/id_github_com.pub`, false); + } // delete old config https://stackoverflow.com/a/36111659/3908409 await sshExec(`sed 's/^Host/\\n&/' $HOME/.ssh/config | sed '/^Host '"github.com"'$/,/^$/d;/^$/d' > $HOME/.ssh/config`, false); await sshExec(`echo "${Buffer.from(configFileContent).toString('base64')}" | base64 --decode >> ~/.ssh/config`, false);