Skip to content

Commit 3cd90aa

Browse files
author
Kevin Ard
committed
deployment: optional support for sqlite
adds optional dockerfile and docker-compose with sqlite support/config. adds make target for alternate build. addresses #140
1 parent 77e7567 commit 3cd90aa

File tree

5 files changed

+96
-0
lines changed

5 files changed

+96
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.github
2+
builds
3+
checks
4+
checkup.json

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ test-%:
2525

2626
docker:
2727
docker build --no-cache . -t $(DOCKER_IMAGE)
28+
29+
docker_sqlite:
30+
docker build --no-cache -t $(DOCKER_IMAGE):sqlite3 -f sqlite3.Dockerfile .

docker-compose.sqlite3.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: "2.4"
2+
3+
services:
4+
#-- worker node
5+
worker:
6+
image: checkup:sqlite3
7+
volumes:
8+
- ./checkup.json:/app/checkup.json
9+
- ./checks:/app/checks
10+
entrypoint:
11+
- checkup
12+
- every
13+
- 10s
14+
user: "1000:1000"
15+
restart: always
16+
17+
#-- client
18+
checkup:
19+
hostname: checkup
20+
image: checkup:sqlite3
21+
ports:
22+
- 3000:3000
23+
volumes:
24+
- ./checkup.json:/app/checkup.json
25+
- ./checks:/app/checks
26+
- ./statuspage/js/config_sqlite3.js:/app/statuspage/js/config.js
27+
user: "1000:1000"
28+
restart: always

sqlite3.Dockerfile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#---------------------------- Build
2+
FROM golang:1.14-alpine as builder
3+
4+
COPY . /app
5+
WORKDIR /app
6+
RUN apk add --no-cache make gcc musl-dev && \
7+
rm -rf /var/cache/apk/* && \
8+
make build-sqlite3
9+
10+
#---------------------------- Deploy
11+
FROM alpine:3.4
12+
13+
RUN apk --update upgrade && \
14+
apk add --no-cache sqlite ca-certificates && \
15+
rm -f /usr/bin/sqlite3 && \
16+
rm -rf /var/cache/apk/*
17+
18+
RUN mkdir /lib64 && \
19+
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
20+
21+
WORKDIR /app
22+
23+
COPY --from=builder /app/builds/checkup /usr/local/bin/checkup
24+
ADD statuspage/ /app/statuspage
25+
26+
RUN addgroup -g 1000 app
27+
RUN adduser -g "" -G app -D -H -u 1000 app
28+
29+
USER app
30+
31+
EXPOSE 3000
32+
ENTRYPOINT ["checkup"]
33+
CMD ["serve"]

statuspage/js/config_sqlite3.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
checkup.config = {
2+
// How much history to show on the status page. Long durations and
3+
// frequent checks make for slow loading, so be conservative.
4+
// This value is in NANOSECONDS to mirror Go's time package.
5+
"timeframe": 1 * time.Day,
6+
7+
// How often, in seconds, to pull new checks and update the page.
8+
"refresh_interval": 60,
9+
10+
// Configure read-only access to stored checks. This configuration
11+
// depends on your storage provider. Any credentials and other values
12+
// here will be visible to everyone, so use keys with ONLY read access!
13+
"storage": {
14+
// Storage type (fs for local, s3 for AWS S3)
15+
"type": "sqlite3",
16+
// Local checkup server by default, set to github page if
17+
// you're hosting your status page on GitHub.
18+
// e.g. "https://sourcegraph.github.io/checkup/checks/"
19+
"url": "/"
20+
},
21+
22+
// The text to display along the top bar depending on overall status.
23+
"status_text": {
24+
"healthy": "Situation Normal",
25+
"degraded": "Degraded Service",
26+
"down": "Service Disruption"
27+
}
28+
};

0 commit comments

Comments
 (0)