forked from Cal-CS-61A-Staff/howamidoing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shipitfile.js
37 lines (34 loc) · 1.13 KB
/
shipitfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* eslint-disable global-require */
module.exports = (shipit) => {
// Load shipit-deploy tasks
require("shipit-deploy")(shipit);
shipit.initConfig({
deploy: {
servers: "[email protected]",
key: "~/.ssh/id_rsa",
},
});
shipit.task("default", async () => {
// await shipit.local("yarn build");
await shipit.copyToRemote("./deploy", "/home/ff/ee16a/status_check");
const rawgrep = await shipit.remote("ps ax|grep gunicorn");
const lines = rawgrep[0].stdout.split("\n");
const toKill = [];
for (const line of lines) {
if (line.includes("status_check")) {
toKill.push(line.trim().split(" ")[0]);
}
}
for (const pid of toKill) {
// eslint-disable-next-line no-await-in-loop
try {
await shipit.remote(`kill ${pid}`);
} catch (e) {
// ignore
}
}
shipit.remote("nohup /home/ff/ee16a/.local/bin/gunicorn"
+ " status_check.deploy.app:app -b"
+ " 0.0.0.0:21618");
});
};