fix transitioning to cli command
This commit is contained in:
parent
ebb34a54a2
commit
b768ca9973
|
@ -4,11 +4,13 @@ RUN apk update && apk add dnsmasq
|
||||||
|
|
||||||
WORKDIR /usr/app
|
WORKDIR /usr/app
|
||||||
|
|
||||||
|
ENV PATH="/usr/app/bin:${PATH}"
|
||||||
|
|
||||||
# schedule critical checks to run every 5 minutes (any failures will disable server)
|
# 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)
|
# 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 ./
|
COPY package.json yarn.lock ./
|
||||||
|
|
||||||
|
@ -16,6 +18,7 @@ RUN yarn --frozen-lockfile
|
||||||
|
|
||||||
COPY src src
|
COPY src src
|
||||||
COPY cli cli
|
COPY cli cli
|
||||||
|
COPY bin bin
|
||||||
|
|
||||||
EXPOSE 3100
|
EXPOSE 3100
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
|
|
|
@ -3,12 +3,15 @@
|
||||||
process.env.NODE_ENV = process.env.NODE_ENV || "production";
|
process.env.NODE_ENV = process.env.NODE_ENV || "production";
|
||||||
|
|
||||||
require("yargs/yargs")(process.argv.slice(2))
|
require("yargs/yargs")(process.argv.slice(2))
|
||||||
|
.help()
|
||||||
|
.demandCommand()
|
||||||
|
.strict(true)
|
||||||
.command(
|
.command(
|
||||||
"enable",
|
"enable",
|
||||||
"Mark portal as enabled",
|
"Mark portal as enabled",
|
||||||
() => {},
|
() => {},
|
||||||
() => {
|
() => {
|
||||||
const db = require("./src/db");
|
const db = require("../src/db");
|
||||||
|
|
||||||
db.set("disabled", false).write();
|
db.set("disabled", false).write();
|
||||||
}
|
}
|
||||||
|
@ -18,7 +21,7 @@ require("yargs/yargs")(process.argv.slice(2))
|
||||||
"Mark portal as disabled (provide meaningful reason)",
|
"Mark portal as disabled (provide meaningful reason)",
|
||||||
() => {},
|
() => {},
|
||||||
({ reason }) => {
|
({ reason }) => {
|
||||||
const db = require("./src/db");
|
const db = require("../src/db");
|
||||||
|
|
||||||
db.set("disabled", reason).write();
|
db.set("disabled", reason).write();
|
||||||
}
|
}
|
||||||
|
@ -49,9 +52,9 @@ require("yargs/yargs")(process.argv.slice(2))
|
||||||
process.env.STATE_DIR = stateDir;
|
process.env.STATE_DIR = stateDir;
|
||||||
|
|
||||||
const util = require("util");
|
const util = require("util");
|
||||||
const { getYesterdayISOString } = require("./src/utils");
|
const { getYesterdayISOString } = require("../src/utils");
|
||||||
const createMiddleware = require("./src/checks/middleware");
|
const createMiddleware = require("../src/checks/middleware");
|
||||||
const db = require("./src/db");
|
const db = require("../src/db");
|
||||||
const checks = require(`./src/checks/${type}`);
|
const checks = require(`./src/checks/${type}`);
|
||||||
const middleware = await createMiddleware();
|
const middleware = await createMiddleware();
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/ash
|
||||||
|
|
||||||
|
cli disable $@
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/ash
|
||||||
|
|
||||||
|
cli enable $@
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/ash
|
||||||
|
|
||||||
|
cli run $0
|
|
@ -16,7 +16,7 @@ docker --version # sanity check
|
||||||
sudo usermod -aG docker user
|
sudo usermod -aG docker user
|
||||||
|
|
||||||
# Install docker-compose
|
# 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
|
sudo chmod +x /usr/local/bin/docker-compose
|
||||||
docker-compose --version # sanity check
|
docker-compose --version # sanity check
|
||||||
|
|
||||||
|
|
Reference in New Issue