This commit is contained in:
Alvin-Zilverstand committed 2026-11-21 22:35:38 +01:00
1 parent 0083ce81f9
commit 988690c252
9 files changed
-144

No files matched your search

-12
View File
@@ -1,12 +0,0 @@
# 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
-4
View File
@@ -1,4 +0,0 @@
# 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.
-10
View File
@@ -1,10 +0,0 @@
# 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.
-13
View File
@@ -1,13 +0,0 @@
# 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"]
-15
View File
@@ -1,15 +0,0 @@
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
)
-29
View File
@@ -1,29 +0,0 @@
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)
}
}
-3
View File
@@ -1,3 +0,0 @@
# Changelog
* 2026-11-21 – Initial repository scaffold for Chronos. API server, Docker Compose, and basic health endpoint implemented.
-46
View File
@@ -1,46 +0,0 @@
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
View File
@@ -1,12 +0,0 @@
# 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.