diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..36f965c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM golang:latest AS builder + +WORKDIR /app + +COPY . . + +RUN go mod download + +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ + go build -o uptimemonitor \ + -ldflags "-X uptimemonitor/pkg/version.Version=$(git describe --tags)" \ + ./cmd/uptimemonitor + +FROM alpine:latest + +WORKDIR /app + +RUN apk add --no-cache ca-certificates + +COPY --from=builder /app/uptimemonitor . + +EXPOSE 3000 + +CMD ["./uptimemonitor"] \ No newline at end of file diff --git a/README.md b/README.md index c71d33a..e42615c 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ chmod +x uptimemonitor ./uptimemonitor -addr=":3000" ``` +You can also use provided `Dockerfile` and `docker-compose.yml` for reference to +run the app using Docker. + ## First run When you first run the application you will be asked to create a new account, @@ -85,3 +88,13 @@ small donation- please use Github Sponsors. The donations of $50 a month and above will be featured in a sponsors area inside the application dashboard. + +## Roadmap + +- Monitor status badges +- Change password +- Manage users +- Timezones +- Reset password via cli +- Add "Test Webhook" button with fake incident +- Sort monitors option (with localstorage sync) by created_at/name(domain) diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 8b4e57a..0000000 --- a/TODO.md +++ /dev/null @@ -1,29 +0,0 @@ -# TODO - -What's left to do: - -- [ ] Get app version from git tag -- [ ] Add documentation -- [ ] Document how to install -- [ ] Document webhook parsing and available variables -- [ ] Release 🎉 - -Optional: - -- [ ] Monitor status -- [ ] Change password -- [ ] Add users -- [ ] Remove users -- [ ] Change user passwords -- [ ] Timezones -- [ ] Reset password via cli -- [ ] Use the same form for creation and editing of monitor -- [ ] Save check response -- [ ] Add check response modal (div#modals + append when clicked + destroy when - clicked) -- [ ] Mobile breadcrumbs (dropdown/select) -- [ ] Add "Test Webhook" button with fake incident -- [ ] Sort monitors option (with localstorage sync) by created_at/name(domain) -- [ ] Session expiration -- [ ] Test check timeout -- [ ] Loading placeholders (skeletons) diff --git a/cmd/uptimemonitor/main.go b/cmd/uptimemonitor/main.go index 3f9cab6..15e6a7a 100644 --- a/cmd/uptimemonitor/main.go +++ b/cmd/uptimemonitor/main.go @@ -23,12 +23,16 @@ var ( ) func main() { - flag.StringVar(&dsn, "dsn", "uptimemonitor.sqlite?_journal_mode=WAL&_busy_timeout=5000&_synchronous=FULL&_txlock=immediate", "database server name") + flag.StringVar(&dsn, "dsn", "data/uptimemonitor.sqlite?_journal_mode=WAL&_busy_timeout=5000&_synchronous=FULL&_txlock=immediate", "database server name") flag.StringVar(&addr, "addr", ":3000", "server address") flag.BoolVar(&secure, "secure", true, "use https") flag.Parse() + if os.Getenv("SECURE") == "false" { + secure = false + } + store := store.New(dsn) service := service.New(store) handler := handler.New(store, service, secure) diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/data/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d96b85f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +# documentation: https://github.com/airlabspl/uptimemonitor/blob/master/README.md +# slogan: A self-hosted, simple web uptime monitor +# tags: uptime,downtime,monitor,self-hosted +# logo: svgs/uptime-monitor-dev.svg +# port: 3000 +services: + app: + build: + context: . + dockerfile: Dockerfile + environment: + - SECURE=false + ports: + - "3000:3000" + restart: always + volumes: + - ${COOLIFY_VOLUME_APP}:/app/data \ No newline at end of file