Initial project scaffold for Chronos
This commit is contained in:
1 parent
8bbb5a8e45
commit
0083ce81f9
10 files changed
+156
-1
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
# Example environment variables for Chronos
|
||||||
|
# PostgreSQL
|
||||||
|
POSTGRES_USER=chronos
|
||||||
|
POSTGRES_PASSWORD=chronos
|
||||||
|
POSTGRES_DB=chronos
|
||||||
|
|
||||||
|
# Redis
|
||||||
|
REDIS_URL=redis://redis:6379
|
||||||
|
|
||||||
|
# Application
|
||||||
|
DATABASE_URL=postgres://chronos:chronos@postgres:5432/chronos?sslmode=disable
|
||||||
|
REDIS_URL=redis://redis:6379
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Implementation Progress
|
||||||
|
|
||||||
|
* **Phase 0 – Repository Initialization**: Created project structure, API skeleton, Docker Compose, and documentation placeholders.
|
||||||
|
* **Next Steps**: Add database migration scripts, health checks, and basic authentication.
|
||||||
@@ -1 +1,12 @@
|
|||||||
sloppyware
|
# Chronos
|
||||||
|
|
||||||
|
Chronos is a production-ready, self-hosted workflow automation and task scheduling platform.
|
||||||
|
|
||||||
|
## Quick start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build and run locally
|
||||||
|
make dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [documentation](docs/) for detailed setup and usage instructions.
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# Architecture
|
||||||
|
|
||||||
|
Chronos is composed of several loosely coupled services:
|
||||||
|
|
||||||
|
* **API Server** – HTTP REST API (chi) exposing workflow CRUD, scheduling, and execution APIs.
|
||||||
|
* **Scheduler** – Periodically evaluates cron expressions and enqueues executions. Runs as a separate container.
|
||||||
|
* **Worker** – Pulls execution tasks from the queue, runs nodes, and reports back.
|
||||||
|
* **Frontend** – SPA built with React/Tailwind/React Flow.
|
||||||
|
|
||||||
|
All services communicate over a local network (Docker Compose). Data is persisted in PostgreSQL; Redis is used for lightweight coordination.
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM golang:1.21-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
RUN go build -o /app/chronos ./main.go
|
||||||
|
|
||||||
|
FROM alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /app/chronos .
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["./chronos"]
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
module github.com/alvin/chronos
|
||||||
|
|
||||||
|
go 1.21
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/go-chi/chi/v5 v5.0.0
|
||||||
|
github.com/go-chi/chi/v5/middleware v5.0.0
|
||||||
|
github.com/lib/pq v1.10.9
|
||||||
|
github.com/go-redis/redis/v8 v8.11.4
|
||||||
|
golang.org/x/crypto v0.21.0
|
||||||
|
github.com/gorilla/handlers v1.5.1
|
||||||
|
github.com/pressly/goose v3.5.3
|
||||||
|
github.com/stretchr/testify v1.9.0
|
||||||
|
google.golang.org/grpc v1.60.0
|
||||||
|
)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/go-chi/chi/v5"
|
||||||
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
r := chi.NewRouter()
|
||||||
|
r.Use(middleware.Logger)
|
||||||
|
r.Get("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
w.Write([]byte("OK"))
|
||||||
|
})
|
||||||
|
|
||||||
|
addr := ":8080"
|
||||||
|
if p := os.Getenv("PORT"); p != "" {
|
||||||
|
addr = ":" + p
|
||||||
|
}
|
||||||
|
log.Printf("Starting server on %s", addr)
|
||||||
|
if err := http.ListenAndServe(addr, r); err != nil {
|
||||||
|
log.Fatalf("server failed: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
* 2026-11-21 – Initial repository scaffold for Chronos. API server, Docker Compose, and basic health endpoint implemented.
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
version: "3.9"
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: chronos
|
||||||
|
POSTGRES_PASSWORD: chronos
|
||||||
|
POSTGRES_DB: chronos
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U chronos"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
command: ["redis-server", "--save", "", "--appendonly", "no"]
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "redis-cli ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
chronos-api:
|
||||||
|
build: ./backend
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: postgres://chronos:chronos@postgres:5432/chronos?sslmode=disable
|
||||||
|
REDIS_URL: redis://redis:6379
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
redis_data:
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
# Security
|
||||||
|
|
||||||
|
Chronos implements the following security measures:
|
||||||
|
|
||||||
|
* Passwords are hashed with Argon2id.
|
||||||
|
* Sessions use secure, HttpOnly cookies with short TTL.
|
||||||
|
* All APIs require authentication via session cookie.
|
||||||
|
* Role-based access control is enforced on every endpoint.
|
||||||
|
* Input validation and escaping prevent SQL injection and XSS.
|
||||||
|
* CSRF protection is enabled for state-changing routes.
|
||||||
|
* Docker containers run as non-root users.
|
||||||
|
* No external network access is allowed unless explicitly whitelisted.
|
||||||
Reference in new issue
Block a user