Skip to content

Commit 449a35b

Browse files
committed
Initial commit
0 parents  commit 449a35b

236 files changed

Lines changed: 58601 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copy this file to .env and fill in the two required values, then run:
2+
#
3+
# docker compose up -d
4+
# docker compose logs init # prints admin credentials on first run
5+
#
6+
# Open http://localhost:8080 and log in.
7+
8+
# ── Required ──────────────────────────────────────────────────────────────────
9+
10+
# PostgreSQL password — choose something strong for production.
11+
POSTGRES_PASSWORD=change_me
12+
13+
# AES-256 key used to encrypt stored webhook secrets.
14+
# Must be exactly 64 lowercase hex characters (32 bytes).
15+
# Generate with: openssl rand -hex 32
16+
WEBHOOK_SECRET_ENCRYPTION_KEY=replace_with_64_lowercase_hex_chars
17+
18+
# ── Optional: first-run admin account ────────────────────────────────────────
19+
# These are only used the first time the stack starts (if no admin user exists).
20+
# Defaults: admin@localhost / change-me-now
21+
# Uncomment and set to use custom credentials from the start.
22+
23+
# SEED_ADMIN_EMAIL=admin@example.com
24+
# SEED_ADMIN_PASSWORD=a-strong-password
25+
26+
# ── Optional: HTTPS / reverse proxy ──────────────────────────────────────────
27+
# Set to true when terminating TLS in front of this stack (nginx, Caddy, etc.).
28+
# COOKIE_SECURE=true
29+
30+
# ── Optional: demo mode ───────────────────────────────────────────────────────
31+
# Show demo credentials on the login screen. Requires a rebuild of the admin
32+
# image (docker compose up --build) to take effect.
33+
# VITE_SHOW_DEMO_ACCOUNT=false

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Normalize all text files to LF in the repository.
2+
# This project targets Linux (Docker, CI) so LF is the canonical line ending.
3+
* text=auto eol=lf
4+
5+
# Windows batch/cmd files must keep CRLF or they break on Windows.
6+
*.bat text eol=crlf
7+
*.cmd text eol=crlf

.github/pull_request_template.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Summary
2+
3+
4+
## Type of change
5+
6+
- [ ] Bug fix
7+
- [ ] New feature
8+
- [ ] Breaking change (existing behaviour changes)
9+
- [ ] Documentation / tooling
10+
11+
## Test plan
12+
13+
- [ ] Existing tests pass (`cargo test`, `npm test`)
14+
- [ ] New tests added where appropriate
15+
- [ ] Tested manually against a running stack
16+
17+
## API changes
18+
19+
If this PR modifies the HTTP API, update `alon_sentinel/docs/api/openapi-v1.yaml` and note the changes here.

.github/workflows/ci.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
rust:
18+
name: Rust
19+
runs-on: ubuntu-latest
20+
21+
services:
22+
postgres:
23+
image: postgres:17
24+
env:
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
POSTGRES_DB: alon_sentinel_test
28+
ports:
29+
- 5432:5432
30+
options: >-
31+
--health-cmd pg_isready
32+
--health-interval 10s
33+
--health-timeout 5s
34+
--health-retries 5
35+
36+
env:
37+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/alon_sentinel_test
38+
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/alon_sentinel_test
39+
40+
defaults:
41+
run:
42+
working-directory: alon_sentinel
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- uses: dtolnay/rust-toolchain@stable
48+
with:
49+
toolchain: "1.95"
50+
components: rustfmt, clippy
51+
52+
- uses: Swatinem/rust-cache@v2
53+
with:
54+
workspaces: alon_sentinel
55+
56+
- name: Check formatting
57+
run: cargo fmt --check
58+
59+
- name: Install sqlx-cli
60+
run: cargo install sqlx-cli --version 0.8.6 --no-default-features --features postgres,rustls
61+
62+
- name: Run migrations
63+
run: sqlx migrate run --source migrations
64+
65+
- name: Clippy
66+
run: cargo clippy -- -D warnings
67+
68+
- name: Check SQLx query metadata
69+
run: cargo sqlx prepare --workspace --check -- --all-targets --all-features
70+
71+
- name: Test
72+
run: cargo test
73+
74+
frontend:
75+
name: Frontend
76+
runs-on: ubuntu-latest
77+
78+
defaults:
79+
run:
80+
working-directory: alon_sentinel_admin
81+
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- uses: actions/setup-node@v4
86+
with:
87+
node-version: 22
88+
cache: npm
89+
cache-dependency-path: alon_sentinel_admin/package-lock.json
90+
91+
- name: Install dependencies
92+
run: npm ci
93+
94+
- name: Build
95+
run: npm run build
96+
97+
- name: Test
98+
run: npm test

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Environment
2+
.env
3+
4+
# Rust build artifacts
5+
target/
6+
target_*/
7+
target-*/
8+
!**/target-service/
9+
10+
# Frontend build output
11+
dist/
12+
13+
# Node dependencies
14+
node_modules/
15+
16+
# Log files written by the API/worker (LOG_DIR default: ./logs)
17+
logs/
18+
*.log
19+
20+
# Benchmark run outputs — keep the directory stub, ignore result files
21+
benchmark/results/*
22+
!benchmark/results/.gitkeep
23+
!benchmark/results/scale_5000-monitors-ok_20260530_102907.txt
24+
!benchmark/results/scale_5000-monitors-ok_20260530_102907.samples.csv
25+
!benchmark/results/scale_10000-monitors-ok_20260530_132819.txt
26+
!benchmark/results/scale_10000-monitors-ok_20260530_132819.samples.csv
27+
!benchmark/results/scale_10000-monitors-fail-storm_20260530_141940.txt
28+
!benchmark/results/scale_10000-monitors-fail-storm_20260530_141940.samples.csv
29+
!benchmark/results/compare_1000m_20260529_133334.txt
30+
!benchmark/results/compare_4000m_20260530_075023.txt
31+
32+
# OS artifacts
33+
.DS_Store
34+
Thumbs.db
35+
36+
# Editor directories
37+
.vscode/
38+
.idea/
39+
*.swp
40+
*.swo
41+

CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Changelog
2+
3+
All notable changes to Alon Sentinel are documented here.
4+
5+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
Alon Sentinel follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
The `/v1` API surface carries documented stability guarantees: additive changes
9+
ship within `v1`; breaking changes require a new major version (`/v2`).
10+
11+
---
12+
13+
## [1.0.0] — 2026-05-23
14+
15+
Initial public release.
16+
17+
### Added
18+
19+
**Monitor types**
20+
- HTTP — status code, response body, JSON path assertions, header assertions, response time threshold, and SSL expiry checks
21+
- SSL — certificate validity and days-until-expiry threshold
22+
- DNS — record resolution and expected-value matching
23+
- TCP — port reachability
24+
- Heartbeat — passive ping endpoint for cron jobs and background services
25+
26+
**Site-centric model**
27+
- Sites group monitors around the service they protect
28+
- Per-site operational timeline across 24 h, 7 d, 30 d, and 90 d windows
29+
- Shared incident history, notifications, and public status output per site
30+
31+
**Incident lifecycle**
32+
- Failures open incidents automatically; recoveries resolve them
33+
- Configurable check history retention
34+
35+
**Public status pages**
36+
- Per-site public pages reflecting current health and open incidents
37+
- Degraded and outage states surfaced to end users or customers
38+
39+
**Notifications**
40+
- Slack, Discord, webhook, and email channels
41+
- Per-site channel overrides for routing alerts independently
42+
43+
**API and authentication**
44+
- Versioned REST API under `/v1` with OpenAPI specification
45+
- Machine-to-machine API clients with scoped bearer tokens (`sites:read`, `sites:write`)
46+
- Role-based admin users: viewer, operator, admin
47+
- In-process per-IP rate limiting on authentication endpoints
48+
49+
**Deployment**
50+
- Docker Compose stack: PostgreSQL, API server, background worker, React admin UI behind nginx
51+
- Trusted-proxy mode for `X-Forwarded-For` support behind a reverse proxy
52+
- Lease-based worker coordination — no external queue required
53+
54+
---
55+
56+
[1.0.0]: https://github.com/Nekic9/alon_systems/releases/tag/v1.0.0

COMMERCIAL.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Licensing
2+
3+
Alon Sentinel is licensed under the GNU Affero General Public License v3.0 or
4+
later.
5+
6+
This page is a plain-language summary. The controlling terms are in
7+
[`LICENSE`](LICENSE).
8+
9+
## What the AGPL Allows
10+
11+
- Use Alon Sentinel for personal, internal, commercial, and hosted deployments.
12+
- Copy, modify, and redistribute the software under the AGPL.
13+
- Charge for hosting, support, or distribution if you comply with the AGPL.
14+
15+
## Source Availability
16+
17+
If you modify Alon Sentinel and let users interact with it over a network, the
18+
AGPL requires you to offer those users access to the Corresponding Source for
19+
your modified version.
20+
21+
## Separate Terms
22+
23+
No separate commercial license is required for AGPL-compliant use.
24+
25+
If you need different licensing terms, contact the maintainer.
26+
27+
## Contact
28+
29+
For licensing questions:
30+
31+
**Email:** tomislav.nekic12@gmail.com

CONTRIBUTING.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Contributing
2+
3+
Thank you for your interest in contributing to Alon Sentinel.
4+
5+
## Contributor License Grant
6+
7+
By submitting a pull request, issue, patch, documentation change, suggestion,
8+
or any other contribution to this repository, you agree that:
9+
10+
1. Your contribution is your original work, or you otherwise have the right to
11+
submit it under these terms.
12+
2. You grant Tomislav Nekic and the Alon Sentinel project a perpetual,
13+
worldwide, non-exclusive, royalty-free, irrevocable license to use,
14+
reproduce, modify, prepare derivative works of, publicly display,
15+
publicly perform, and distribute your contribution as part of Alon Sentinel
16+
under the GNU Affero General Public License v3.0 or later.
17+
3. This grant allows the contribution to be used under the same AGPL terms as
18+
the rest of the project.
19+
4. This grant does not transfer copyright ownership. You keep your own rights
20+
to use your contribution for any purpose.
21+
22+
This lightweight contributor license grant keeps contributions usable under the
23+
project license.
24+
If you cannot agree to this, please do not submit a contribution. Open an issue
25+
to discuss the idea instead.
26+
27+
## How to contribute
28+
29+
- **Bug reports:** open a GitHub issue with steps to reproduce and expected vs.
30+
actual behavior.
31+
- **Feature requests:** open an issue describing the use case, not just the
32+
requested feature.
33+
- **Pull requests:** open an issue first for anything non-trivial so we can
34+
align before you invest time.
35+
36+
## Code style
37+
38+
- Rust: `cargo fmt` and `cargo clippy` must pass before submitting.
39+
- TypeScript: `npm run lint` must pass.
40+
- Keep changes focused: one concern per PR.
41+
42+
## What gets accepted
43+
44+
Priority is given to:
45+
46+
- Bug fixes with a clear reproduction case
47+
- Performance improvements with measurements
48+
- Documentation improvements
49+
50+
Features may be declined if they conflict with the product direction or belong
51+
outside the project's scope. When in doubt, ask first.

0 commit comments

Comments
 (0)