Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
user www;
worker_processes auto; # it will be determinate automatically by the number of core

error_log /var/log/nginx/error.log warn;
#pid /var/run/nginx/nginx.pid; # it permit you to use /etc/init.d/nginx reload|restart|stop|start

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
access_log /var/log/nginx/access.log;
keepalive_timeout 3000;
server {
listen 80;
root /www;
index index.html index.htm;
server_name localhost;
client_max_body_size 32m;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/lib/nginx/html;
}
}
}
4 changes: 4 additions & 0 deletions Docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
timestamp=`date +%Y/%m/%d-%H:%M:%S`
echo "Crond run at $timestamp"
tinystatus /tinystatus/checks.csv /tinystatus/incidents.txt > /www/index.html
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM alpine:3.14.1

RUN apk update && apk add bash curl netcat-openbsd nginx busybox-initscripts

EXPOSE 80
ADD Docker/run.sh /run.sh
RUN mkdir -p /tinystatus/
ADD tinystatus /usr/local/bin/tinystatus
RUN chmod +x /run.sh /usr/local/bin/tinystatus
ADD checks.csv /tinystatus/checks.csv
ADD incidents.txt /tinystatus/incidents.txt
RUN echo '* * * * * /run.sh > /var/log/run.log' > /etc/crontabs/root
RUN touch /var/log/run.log
RUN mkdir -p /run/nginx/
RUN adduser -D -g 'www' www
RUN mkdir /www
RUN chown -R www:www /var/lib/nginx
RUN chown -R www:www /www
RUN mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
ADD Docker/nginx.conf /etc/nginx/nginx.conf

CMD [ "sh", "-c", "crond && nginx -g 'daemon off;'" ]

18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,21 @@ Command can be:
There are also `http4`, `http6`, `ping4`, `ping6`, `port4`, `port6` for IPv4 or IPv6 only check.
Note: `port4` and `port6` require OpenBSD `nc` binary.

## Docker

Build the static webpage Docker Image (Image size is about 15.8 MB).
```
docker build -t tinystatus .
```

Run the Docker Container.
```
docker run -d -p 80:80 --name tinystatus tinystatus
```

Stop and remove the Docker Container

```
docker stop tinystatus && docker rm tinystatus
```