Merge pull request #1187 from SkynetLabs/fix-transitioning-to-cli-command
fix transitioning to cli command
This commit is contained in:
commit
b26d2d2c3e
|
@ -4,11 +4,13 @@ RUN apk update && apk add dnsmasq
|
|||
|
||||
WORKDIR /usr/app
|
||||
|
||||
ENV PATH="/usr/app/bin:${PATH}"
|
||||
|
||||
# schedule critical checks to run every 5 minutes (any failures will disable server)
|
||||
RUN echo '*/5 * * * * /usr/app/cli/run critical > /dev/stdout' >> /etc/crontabs/root
|
||||
RUN echo '*/5 * * * * /usr/app/bin/cli run critical > /dev/stdout' >> /etc/crontabs/root
|
||||
|
||||
# schedule extended checks to run on every hour (optional checks, report only)
|
||||
RUN echo '0 * * * * /usr/app/cli/run extended > /dev/stdout' >> /etc/crontabs/root
|
||||
RUN echo '0 * * * * /usr/app/bin/cli run extended > /dev/stdout' >> /etc/crontabs/root
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
|
||||
|
@ -16,6 +18,7 @@ RUN yarn --frozen-lockfile
|
|||
|
||||
COPY src src
|
||||
COPY cli cli
|
||||
COPY bin bin
|
||||
|
||||
EXPOSE 3100
|
||||
ENV NODE_ENV production
|
||||
|
|
|
@ -3,12 +3,15 @@
|
|||
process.env.NODE_ENV = process.env.NODE_ENV || "production";
|
||||
|
||||
require("yargs/yargs")(process.argv.slice(2))
|
||||
.help()
|
||||
.demandCommand()
|
||||
.strict(true)
|
||||
.command(
|
||||
"enable",
|
||||
"Mark portal as enabled",
|
||||
() => {},
|
||||
() => {
|
||||
const db = require("./src/db");
|
||||
const db = require("../src/db");
|
||||
|
||||
db.set("disabled", false).write();
|
||||
}
|
||||
|
@ -18,7 +21,7 @@ require("yargs/yargs")(process.argv.slice(2))
|
|||
"Mark portal as disabled (provide meaningful reason)",
|
||||
() => {},
|
||||
({ reason }) => {
|
||||
const db = require("./src/db");
|
||||
const db = require("../src/db");
|
||||
|
||||
db.set("disabled", reason).write();
|
||||
}
|
||||
|
@ -49,10 +52,10 @@ require("yargs/yargs")(process.argv.slice(2))
|
|||
process.env.STATE_DIR = stateDir;
|
||||
|
||||
const util = require("util");
|
||||
const { getYesterdayISOString } = require("./src/utils");
|
||||
const createMiddleware = require("./src/checks/middleware");
|
||||
const db = require("./src/db");
|
||||
const checks = require(`./src/checks/${type}`);
|
||||
const { getYesterdayISOString } = require("../src/utils");
|
||||
const createMiddleware = require("../src/checks/middleware");
|
||||
const db = require("../src/db");
|
||||
const checks = require(`../src/checks/${type}`);
|
||||
const middleware = await createMiddleware();
|
||||
|
||||
const entry = {
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/ash
|
||||
|
||||
/usr/app/bin/cli disable $@
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/ash
|
||||
|
||||
/usr/app/bin/cli enable $@
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/ash
|
||||
|
||||
/usr/app/bin/cli run $0
|
|
@ -16,7 +16,7 @@ docker --version # sanity check
|
|||
sudo usermod -aG docker user
|
||||
|
||||
# Install docker-compose
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
docker-compose --version # sanity check
|
||||
|
||||
|
|
Reference in New Issue