diff options
author | Daniel Baumann <daniel@debian.org> | 2024-11-26 09:28:28 +0100 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-11-26 12:25:58 +0100 |
commit | a1882b67c41fe9901a0cd8059b5cc78a5beadec0 (patch) | |
tree | 2a24507c67aa99a15416707b2f7e645142230ed8 /extra/deploy-demo-server.js | |
parent | Initial commit. (diff) | |
download | uptime-kuma-upstream.tar.xz uptime-kuma-upstream.zip |
Adding upstream version 2.0.0~beta.0+dfsg.upstream/2.0.0_beta.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'extra/deploy-demo-server.js')
-rw-r--r-- | extra/deploy-demo-server.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/extra/deploy-demo-server.js b/extra/deploy-demo-server.js new file mode 100644 index 0000000..2cc196b --- /dev/null +++ b/extra/deploy-demo-server.js @@ -0,0 +1,60 @@ +require("dotenv").config(); +const { NodeSSH } = require("node-ssh"); +const readline = require("readline"); +const rl = readline.createInterface({ input: process.stdin, + output: process.stdout }); +const prompt = (query) => new Promise((resolve) => rl.question(query, resolve)); + +(async () => { + try { + console.log("SSH to demo server"); + const ssh = new NodeSSH(); + await ssh.connect({ + host: process.env.UPTIME_KUMA_DEMO_HOST, + port: process.env.UPTIME_KUMA_DEMO_PORT, + username: process.env.UPTIME_KUMA_DEMO_USERNAME, + privateKeyPath: process.env.UPTIME_KUMA_DEMO_PRIVATE_KEY_PATH + }); + + let cwd = process.env.UPTIME_KUMA_DEMO_CWD; + let result; + + const version = await prompt("Enter Version: "); + + result = await ssh.execCommand("git fetch --all", { + cwd, + }); + console.log(result.stdout + result.stderr); + + await prompt("Press any key to continue..."); + + result = await ssh.execCommand(`git checkout ${version} --force`, { + cwd, + }); + console.log(result.stdout + result.stderr); + + result = await ssh.execCommand("npm run download-dist", { + cwd, + }); + console.log(result.stdout + result.stderr); + + result = await ssh.execCommand("npm install --production", { + cwd, + }); + console.log(result.stdout + result.stderr); + + /* + result = await ssh.execCommand("pm2 restart 1", { + cwd, + }); + console.log(result.stdout + result.stderr);*/ + + } catch (e) { + console.log(e); + } finally { + rl.close(); + } +})(); + +// When done reading prompt, exit program +rl.on("close", () => process.exit(0)); |