From 461b1ce885262145f541ee3517dc5a16deae668c Mon Sep 17 00:00:00 2001 From: Kevin Ard Date: Fri, 9 Oct 2020 12:43:13 -0400 Subject: [PATCH] optional sqlite3 support: add dockerfile, docker-compose, and statuspage config --- Makefile | 3 +++ docker-compose.sqlite3.yml | 28 ++++++++++++++++++++++++++++ sqlite3.Dockerfile | 25 +++++++++++++++++++++++++ statuspage/js/config_sqlite3.js | 28 ++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 docker-compose.sqlite3.yml create mode 100644 sqlite3.Dockerfile create mode 100644 statuspage/js/config_sqlite3.js diff --git a/Makefile b/Makefile index 643b05b..093c522 100644 --- a/Makefile +++ b/Makefile @@ -25,3 +25,6 @@ test-%: docker: docker build --no-cache . -t $(DOCKER_IMAGE) + +docker_sqlite: + docker build --no-cache -t $(DOCKER_IMAGE):sqlite3 -f sqlite3.Dockerfile . \ No newline at end of file diff --git a/docker-compose.sqlite3.yml b/docker-compose.sqlite3.yml new file mode 100644 index 0000000..afced27 --- /dev/null +++ b/docker-compose.sqlite3.yml @@ -0,0 +1,28 @@ +version: "2.4" + +services: + #-- worker node + worker: + image: checkup:sqlite3 + volumes: + - ./checkup.json:/app/checkup.json + - ./checks:/app/checks + entrypoint: + - checkup + - every + - 10s + user: "1000:1000" + restart: always + + #-- client + checkup: + hostname: checkup + image: checkup:sqlite3 + ports: + - 3000:3000 + volumes: + - ./checkup.json:/app/checkup.json + - ./checks:/app/checks + - ./statuspage/js/config_sqlite3.js:/app/statuspage/js/config.js + user: "1000:1000" + restart: always diff --git a/sqlite3.Dockerfile b/sqlite3.Dockerfile new file mode 100644 index 0000000..ee66a12 --- /dev/null +++ b/sqlite3.Dockerfile @@ -0,0 +1,25 @@ +FROM golang:1.15-buster as builder + +COPY . /app +WORKDIR /app +RUN apt-get install make && make build-sqlite3 + +#---------------------------- +FROM golang:1.15-buster + +# install sqlite +RUN apt-get update && apt-get install sqlite3 && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY --from=builder /app/builds/checkup /usr/local/bin/checkup +ADD statuspage/ /app/statuspage + +RUN addgroup --gid 1000 app +RUN adduser --no-create-home --uid 1000 --gecos "" --gid 1000 --disabled-password app + +USER app + +EXPOSE 3000 +ENTRYPOINT ["checkup"] +CMD ["serve"] \ No newline at end of file diff --git a/statuspage/js/config_sqlite3.js b/statuspage/js/config_sqlite3.js new file mode 100644 index 0000000..742c430 --- /dev/null +++ b/statuspage/js/config_sqlite3.js @@ -0,0 +1,28 @@ +checkup.config = { + // How much history to show on the status page. Long durations and + // frequent checks make for slow loading, so be conservative. + // This value is in NANOSECONDS to mirror Go's time package. + "timeframe": 1 * time.Day, + + // How often, in seconds, to pull new checks and update the page. + "refresh_interval": 60, + + // Configure read-only access to stored checks. This configuration + // depends on your storage provider. Any credentials and other values + // here will be visible to everyone, so use keys with ONLY read access! + "storage": { + // Storage type (fs for local, s3 for AWS S3) + "type": "sqlite3", + // Local checkup server by default, set to github page if + // you're hosting your status page on GitHub. + // e.g. "https://sourcegraph.github.io/checkup/checks/" + "url": "/" + }, + + // The text to display along the top bar depending on overall status. + "status_text": { + "healthy": "Situation Normal", + "degraded": "Degraded Service", + "down": "Service Disruption" + } +};