Skip to content

Commit

Permalink
Adjust code
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Oct 4, 2024
1 parent 48fb327 commit c5edd89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/executor/runnercode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down
7 changes: 5 additions & 2 deletions src/executor/runnersub.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c5edd89

Please sign in to comment.