docs: Activepieces CE pilot report and throwaway pilot assets (PLATFM-18 D-E)
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
b0641758f2
commit
9629364dad
@@ -0,0 +1,25 @@
|
||||
# Activepieces pilot (PLATFM-18, D-E) — eldobható stack
|
||||
|
||||
A 2026-10-03/04-i pilot eszközei. **Nem projekt-stack**: nincs host-port, memóriakorlátos, a pilot után törölendő.
|
||||
A jelentés: `docs/activepieces-pilot-jelentes.md`.
|
||||
|
||||
## Tartalom
|
||||
|
||||
| Fájl | Szerep |
|
||||
|---|---|
|
||||
| `docker-compose.yml` | Activepieces 0.91.0 CE (app+worker egy konténerben), PostgreSQL (pgvector), Redis, checker-stub, TLS-célpont, ntfy-helyettesítő |
|
||||
| `setup.sh` | a szerveren fut: titkokat és tesztcertifikátumokat generál (`.env`, `tls/*.pem`), semmit nem ír ki |
|
||||
| `checker/checker.py` | a `mozdit-checker` stubja (D1 egységes válasz, csak `/check/tls`) |
|
||||
| `sink/sink.py` | ntfy-helyettesítő: rögzíti a POST-okat, `GET /received` listázza |
|
||||
| `initdb/10-automation.sql` | a tervezett `mozdit_automation` séma (D3) a pilot DB-ben |
|
||||
| `flow/evaluate.mjs` | az állapotgép (D4): két egymást követő eredmény után riaszt, egy helyreállítási üzenet, emlékeztető |
|
||||
| `flow/test_evaluate.mjs` | a fenti logika offline próbája (`node flow/test_evaluate.mjs`) |
|
||||
| `flow/pilot-flow.json` | az Activepieces-ből exportált flow (titkok nélkül, `IMPORT_FLOW` formában) |
|
||||
|
||||
## Futtatás (összefoglaló)
|
||||
|
||||
1. Port-ellenőrzés: nincs host-port; a Mac oldali alagút helyi portját ellenőrizd (`scripts/check-ports.sh 13080`).
|
||||
2. `rsync` a szerverre (`~/projects/ap-pilot/`), ott `./setup.sh`, majd `docker compose up -d`.
|
||||
3. Alagút a konténer IP-jére: `ssh -N -L 127.0.0.1:13080:<app IP>:80 sadmin@10.8.0.1`.
|
||||
4. Az első admin fiókot a felhasználó hozza létre a böngészőben. Az `AP_FRONTEND_URL` értéke `http://localhost:80` legyen, különben a worker nem éri el a piece-csomagokat (lásd a jelentést).
|
||||
5. Bontás: `docker compose down -v`, a mappa és a pull-olt image-ek törlése.
|
||||
@@ -0,0 +1,39 @@
|
||||
"""Pilot stub of mozdit-checker (design D1): /check/tls with the unified response.
|
||||
stdlib only; trusts the pilot CA so the self-signed test certificates validate."""
|
||||
import json, socket, ssl, sys, time
|
||||
from datetime import datetime, timezone
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
|
||||
def check_tls(host, port):
|
||||
now = datetime.now(timezone.utc)
|
||||
base = {"target": f"{host}:{port}", "check": "tls", "measured_at": now.isoformat()}
|
||||
try:
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.load_verify_locations("/certs/ca.pem")
|
||||
with socket.create_connection((host, port), timeout=5) as sock:
|
||||
with ctx.wrap_socket(sock, server_hostname=host) as tls:
|
||||
cert = tls.getpeercert()
|
||||
expires = datetime.fromtimestamp(ssl.cert_time_to_seconds(cert["notAfter"]), timezone.utc)
|
||||
days = (expires - now).days
|
||||
status = "critical" if days < 7 else "warning" if days < 21 else "ok"
|
||||
return {**base, "status": status, "values": {"days_left": days, "not_after": expires.isoformat()}}
|
||||
except Exception as exc: # unreachable or invalid -> critical per D5
|
||||
return {**base, "status": "critical", "values": {"error": str(exc)[:200]}}
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def _send(self, code, body):
|
||||
data = json.dumps(body).encode()
|
||||
self.send_response(code); self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(data))); self.end_headers(); self.wfile.write(data)
|
||||
def do_GET(self):
|
||||
url = urlparse(self.path); q = parse_qs(url.query)
|
||||
if url.path == "/health": return self._send(200, {"ok": True})
|
||||
if url.path == "/check/tls":
|
||||
host = (q.get("host") or [""])[0]; port = int((q.get("port") or ["443"])[0])
|
||||
if not host: return self._send(400, {"error": "host required"})
|
||||
return self._send(200, check_tls(host, port))
|
||||
self._send(404, {"error": "not found"})
|
||||
def log_message(self, *a): pass
|
||||
|
||||
HTTPServer(("0.0.0.0", 8000), Handler).serve_forever()
|
||||
@@ -0,0 +1,124 @@
|
||||
# Throwaway Activepieces Community Edition pilot (PLATFM-18, D-E). Not a project stack:
|
||||
# no host ports (reached through an SSH tunnel to the container IP), memory-capped,
|
||||
# removed after the pilot. Names: mozdit-appilot-*.
|
||||
x-common: &common
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: json-file
|
||||
options: { max-size: "20m", max-file: "2" }
|
||||
networks: [mozdit-appilot-network]
|
||||
|
||||
services:
|
||||
app:
|
||||
<<: *common
|
||||
image: ghcr.io/activepieces/activepieces:0.91.0
|
||||
container_name: mozdit-appilot-app
|
||||
env_file: .env
|
||||
environment:
|
||||
- AP_CONTAINER_TYPE=WORKER_AND_APP
|
||||
depends_on:
|
||||
postgres: { condition: service_healthy }
|
||||
redis: { condition: service_healthy }
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -fsS http://localhost:80/api/v1/flags >/dev/null || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 90s
|
||||
deploy:
|
||||
resources:
|
||||
limits: { memory: 1200M }
|
||||
|
||||
postgres:
|
||||
<<: *common
|
||||
image: pgvector/pgvector:0.8.0-pg14
|
||||
container_name: mozdit-appilot-postgres
|
||||
environment:
|
||||
- POSTGRES_DB=${AP_POSTGRES_DATABASE}
|
||||
- POSTGRES_USER=${AP_POSTGRES_USERNAME}
|
||||
- POSTGRES_PASSWORD=${AP_POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./initdb:/docker-entrypoint-initdb.d:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${AP_POSTGRES_USERNAME} -d ${AP_POSTGRES_DATABASE}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
deploy:
|
||||
resources:
|
||||
limits: { memory: 300M }
|
||||
|
||||
redis:
|
||||
<<: *common
|
||||
image: redis:7-alpine
|
||||
container_name: mozdit-appilot-redis
|
||||
command: ["redis-server", "--maxmemory", "96mb", "--maxmemory-policy", "noeviction"]
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
deploy:
|
||||
resources:
|
||||
limits: { memory: 128M }
|
||||
|
||||
checker:
|
||||
<<: *common
|
||||
image: python:3.12-alpine
|
||||
container_name: mozdit-appilot-checker
|
||||
command: ["python", "/app/checker.py"]
|
||||
volumes:
|
||||
- ./checker:/app:ro
|
||||
- ./tls:/certs:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8000/health >/dev/null || exit 1"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
deploy:
|
||||
resources:
|
||||
limits: { memory: 64M }
|
||||
|
||||
tls-target:
|
||||
<<: *common
|
||||
image: nginx:alpine
|
||||
container_name: mozdit-appilot-tls
|
||||
networks:
|
||||
mozdit-appilot-network:
|
||||
aliases: [tls.pilot]
|
||||
volumes:
|
||||
- ./tls:/etc/nginx/certs:ro
|
||||
- ./tls/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "nc -z 127.0.0.1 8443 || exit 1"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
deploy:
|
||||
resources:
|
||||
limits: { memory: 32M }
|
||||
|
||||
ntfy-sink:
|
||||
<<: *common
|
||||
image: python:3.12-alpine
|
||||
container_name: mozdit-appilot-ntfy
|
||||
command: ["python", "/app/sink.py"]
|
||||
volumes:
|
||||
- ./sink:/app:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8000/ >/dev/null || exit 1"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
deploy:
|
||||
resources:
|
||||
limits: { memory: 64M }
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
networks:
|
||||
mozdit-appilot-network:
|
||||
driver: bridge
|
||||
name: mozdit-appilot-network
|
||||
@@ -0,0 +1,33 @@
|
||||
export const code = async (inputs) => {
|
||||
// Alert state machine (ops-automation-phase1 design D4): alert on a state change only after
|
||||
// TWO consecutive identical results; one recovery message; reminder while critical stays open.
|
||||
const REMINDER_MS = Number(inputs.reminderMinutes ?? 720) * 60000;
|
||||
const result = typeof inputs.result === 'string' ? JSON.parse(inputs.result) : inputs.result;
|
||||
let prev = inputs.prev;
|
||||
if (typeof prev === 'string') { try { prev = JSON.parse(prev); } catch { prev = null; } }
|
||||
const now = new Date().toISOString();
|
||||
const cur = result.status;
|
||||
const state = prev && prev.status ? prev
|
||||
: { status: 'ok', since: now, lastAlertAt: null, pending: null, pendingCount: 0 };
|
||||
let next = { ...state };
|
||||
let alert = null;
|
||||
if (cur === state.status) {
|
||||
next.pending = null; next.pendingCount = 0;
|
||||
if (cur === 'critical' && state.lastAlertAt && Date.parse(now) - Date.parse(state.lastAlertAt) >= REMINDER_MS) {
|
||||
alert = { kind: 'reminder', level: 'critical' }; next.lastAlertAt = now;
|
||||
}
|
||||
} else if (cur === 'ok') {
|
||||
next = { status: 'ok', since: now, lastAlertAt: null, pending: null, pendingCount: 0 };
|
||||
alert = { kind: 'recovery', level: 'ok' };
|
||||
} else {
|
||||
if (state.pending === cur) next.pendingCount = (state.pendingCount || 0) + 1;
|
||||
else { next.pending = cur; next.pendingCount = 1; }
|
||||
if (next.pendingCount >= 2) {
|
||||
next = { status: cur, since: now, lastAlertAt: now, pending: null, pendingCount: 0 };
|
||||
alert = { kind: 'change', level: cur };
|
||||
}
|
||||
}
|
||||
const title = alert ? `[${alert.level}] ${result.check} ${result.target}` : '';
|
||||
const message = alert ? `${alert.kind}: ${JSON.stringify(result.values)}` : '';
|
||||
return { nextJson: JSON.stringify(next), hasAlert: !!alert, title, message, status: cur };
|
||||
};
|
||||
@@ -0,0 +1,354 @@
|
||||
{
|
||||
"displayName": "pilot-tls-check",
|
||||
"schemaVersion": "26",
|
||||
"notes": [],
|
||||
"trigger": {
|
||||
"name": "trigger",
|
||||
"valid": true,
|
||||
"displayName": "Every minute (pilot)",
|
||||
"nextAction": {
|
||||
"name": "step_1",
|
||||
"type": "CODE",
|
||||
"valid": true,
|
||||
"settings": {
|
||||
"input": {},
|
||||
"sourceCode": {
|
||||
"code": "export const code = async () => [{host:'tls.pilot',port:8443},{host:'tls.pilot',port:8444}];",
|
||||
"packageJson": "{}"
|
||||
},
|
||||
"sourceCodeHash": "",
|
||||
"propertySettings": {},
|
||||
"errorHandlingOptions": {
|
||||
"retryOnFailure": {
|
||||
"value": false
|
||||
},
|
||||
"continueOnFailure": {
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"nextAction": {
|
||||
"name": "step_2",
|
||||
"type": "LOOP_ON_ITEMS",
|
||||
"valid": true,
|
||||
"settings": {
|
||||
"items": "{{step_1['output']}}",
|
||||
"propertySettings": {}
|
||||
},
|
||||
"displayName": "For each target",
|
||||
"firstLoopAction": {
|
||||
"name": "step_3",
|
||||
"type": "PIECE",
|
||||
"valid": true,
|
||||
"settings": {
|
||||
"input": {
|
||||
"url": "http://checker:8000/check/tls",
|
||||
"method": "GET",
|
||||
"headers": {},
|
||||
"timeout": 10,
|
||||
"authType": "NONE",
|
||||
"body_type": "none",
|
||||
"use_proxy": false,
|
||||
"authFields": {},
|
||||
"failureMode": "retry_5xx",
|
||||
"queryParams": {
|
||||
"host": "{{step_2['output'].item.host}}",
|
||||
"port": "{{step_2['output'].item.port}}"
|
||||
},
|
||||
"proxy_settings": {},
|
||||
"followRedirects": false,
|
||||
"response_is_binary": false
|
||||
},
|
||||
"pieceName": "@activepieces/piece-http",
|
||||
"actionName": "send_request",
|
||||
"pieceVersion": "0.12.1",
|
||||
"propertySettings": {
|
||||
"url": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"method": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"headers": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"timeout": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"authType": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"body_type": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"use_proxy": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"authFields": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"failureMode": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"queryParams": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"proxy_settings": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"followRedirects": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"response_is_binary": {
|
||||
"type": "MANUAL"
|
||||
}
|
||||
},
|
||||
"errorHandlingOptions": {
|
||||
"retryOnFailure": {
|
||||
"value": true
|
||||
},
|
||||
"continueOnFailure": {
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"nextAction": {
|
||||
"name": "step_4",
|
||||
"type": "PIECE",
|
||||
"valid": true,
|
||||
"settings": {
|
||||
"input": {
|
||||
"key": "tls:{{step_2['output'].item.host}}:{{step_2['output'].item.port}}",
|
||||
"store_scope": "FLOW"
|
||||
},
|
||||
"pieceName": "@activepieces/piece-store",
|
||||
"actionName": "get",
|
||||
"pieceVersion": "0.6.20",
|
||||
"propertySettings": {
|
||||
"key": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"store_scope": {
|
||||
"type": "MANUAL"
|
||||
}
|
||||
},
|
||||
"errorHandlingOptions": {
|
||||
"retryOnFailure": {
|
||||
"value": false
|
||||
},
|
||||
"continueOnFailure": {
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"nextAction": {
|
||||
"name": "step_5",
|
||||
"type": "CODE",
|
||||
"valid": true,
|
||||
"settings": {
|
||||
"input": {
|
||||
"prev": "{{step_4['output']}}",
|
||||
"result": "{{step_3['output'].body}}",
|
||||
"target": "{{step_2['output'].item.host}}:{{step_2['output'].item.port}}",
|
||||
"reminderMinutes": "720"
|
||||
},
|
||||
"sourceCode": {
|
||||
"code": "export const code = async (inputs) => {\n // Alert state machine (ops-automation-phase1 design D4): alert on a state change only after\n // TWO consecutive identical results; one recovery message; reminder while critical stays open.\n const REMINDER_MS = Number(inputs.reminderMinutes ?? 720) * 60000;\n let result;\n try { result = typeof inputs.result === 'string' ? JSON.parse(inputs.result) : inputs.result; } catch { result = null; }\n if (!result || !result.status) result = { status: 'critical', check: 'checker', target: String(inputs.target || 'unknown'), values: { error: 'checker unreachable or invalid response' } };\n let prev = inputs.prev;\n if (typeof prev === 'string') { try { prev = JSON.parse(prev); } catch { prev = null; } }\n const now = new Date().toISOString();\n const cur = result.status;\n const state = prev && prev.status ? prev\n : { status: 'ok', since: now, lastAlertAt: null, pending: null, pendingCount: 0 };\n let next = { ...state };\n let alert = null;\n if (cur === state.status) {\n next.pending = null; next.pendingCount = 0;\n if (cur === 'critical' && state.lastAlertAt && Date.parse(now) - Date.parse(state.lastAlertAt) >= REMINDER_MS) {\n alert = { kind: 'reminder', level: 'critical' }; next.lastAlertAt = now;\n }\n } else if (cur === 'ok') {\n next = { status: 'ok', since: now, lastAlertAt: null, pending: null, pendingCount: 0 };\n alert = { kind: 'recovery', level: 'ok' };\n } else {\n if (state.pending === cur) next.pendingCount = (state.pendingCount || 0) + 1;\n else { next.pending = cur; next.pendingCount = 1; }\n if (next.pendingCount >= 2) {\n next = { status: cur, since: now, lastAlertAt: now, pending: null, pendingCount: 0 };\n alert = { kind: 'change', level: cur };\n }\n }\n const title = alert ? `[${alert.level}] ${result.check} ${result.target}` : '';\n const message = alert ? `${alert.kind}: ${JSON.stringify(result.values)}` : '';\n return { nextJson: JSON.stringify(next), hasAlert: !!alert, title, message, status: cur };\n};\n",
|
||||
"packageJson": "{}"
|
||||
},
|
||||
"sourceCodeHash": "",
|
||||
"propertySettings": {
|
||||
"prev": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"result": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"reminderMinutes": {
|
||||
"type": "MANUAL"
|
||||
}
|
||||
},
|
||||
"errorHandlingOptions": {
|
||||
"retryOnFailure": {
|
||||
"value": false
|
||||
},
|
||||
"continueOnFailure": {
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"nextAction": {
|
||||
"name": "step_6",
|
||||
"type": "PIECE",
|
||||
"valid": true,
|
||||
"settings": {
|
||||
"input": {
|
||||
"key": "tls:{{step_2['output'].item.host}}:{{step_2['output'].item.port}}",
|
||||
"value": "{{step_5['output'].nextJson}}",
|
||||
"store_scope": "FLOW"
|
||||
},
|
||||
"pieceName": "@activepieces/piece-store",
|
||||
"actionName": "put",
|
||||
"pieceVersion": "0.6.20",
|
||||
"propertySettings": {
|
||||
"key": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"value": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"store_scope": {
|
||||
"type": "MANUAL"
|
||||
}
|
||||
},
|
||||
"errorHandlingOptions": {
|
||||
"retryOnFailure": {
|
||||
"value": false
|
||||
},
|
||||
"continueOnFailure": {
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"nextAction": {
|
||||
"name": "step_7",
|
||||
"type": "ROUTER",
|
||||
"valid": true,
|
||||
"children": [
|
||||
{
|
||||
"name": "step_8",
|
||||
"type": "PIECE",
|
||||
"valid": true,
|
||||
"settings": {
|
||||
"input": {
|
||||
"url": "http://ntfy-sink:8000/infra-alerts",
|
||||
"body": {
|
||||
"data": "{{step_5['output'].message}}"
|
||||
},
|
||||
"method": "POST",
|
||||
"headers": {
|
||||
"Title": "{{step_5['output'].title}}",
|
||||
"Priority": "high"
|
||||
},
|
||||
"timeout": 10,
|
||||
"authType": "NONE",
|
||||
"body_type": "raw",
|
||||
"use_proxy": false,
|
||||
"authFields": {},
|
||||
"failureMode": "retry_5xx",
|
||||
"queryParams": {},
|
||||
"proxy_settings": {},
|
||||
"followRedirects": false,
|
||||
"response_is_binary": false
|
||||
},
|
||||
"pieceName": "@activepieces/piece-http",
|
||||
"actionName": "send_request",
|
||||
"pieceVersion": "0.12.1",
|
||||
"propertySettings": {
|
||||
"url": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"body": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"method": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"headers": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"timeout": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"authType": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"body_type": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"use_proxy": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"authFields": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"failureMode": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"queryParams": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"proxy_settings": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"followRedirects": {
|
||||
"type": "MANUAL"
|
||||
},
|
||||
"response_is_binary": {
|
||||
"type": "MANUAL"
|
||||
}
|
||||
},
|
||||
"errorHandlingOptions": {
|
||||
"retryOnFailure": {
|
||||
"value": true
|
||||
},
|
||||
"continueOnFailure": {
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"displayName": "Alert to ntfy sink"
|
||||
},
|
||||
null
|
||||
],
|
||||
"settings": {
|
||||
"branches": [
|
||||
{
|
||||
"branchName": "Alert",
|
||||
"branchType": "CONDITION",
|
||||
"conditions": [
|
||||
[
|
||||
{
|
||||
"operator": "BOOLEAN_IS_TRUE",
|
||||
"firstValue": "{{step_5['output'].hasAlert}}"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"branchName": "Otherwise",
|
||||
"branchType": "FALLBACK"
|
||||
}
|
||||
],
|
||||
"executionType": "EXECUTE_FIRST_MATCH",
|
||||
"propertySettings": {}
|
||||
},
|
||||
"displayName": "Alert needed?"
|
||||
},
|
||||
"displayName": "Store new state"
|
||||
},
|
||||
"displayName": "Evaluate state"
|
||||
},
|
||||
"displayName": "Load state"
|
||||
},
|
||||
"displayName": "Call checker (TLS)"
|
||||
}
|
||||
},
|
||||
"displayName": "Target list (domains.yaml stand-in)"
|
||||
},
|
||||
"type": "PIECE_TRIGGER",
|
||||
"settings": {
|
||||
"propertySettings": {
|
||||
"minutes": {
|
||||
"type": "MANUAL"
|
||||
}
|
||||
},
|
||||
"pieceName": "@activepieces/piece-schedule",
|
||||
"pieceVersion": "0.1.22",
|
||||
"triggerName": "every_x_minutes",
|
||||
"input": {
|
||||
"minutes": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { code } from './evaluate.mjs';
|
||||
let st = null; const log = [];
|
||||
const run = async (status, extra = {}) => {
|
||||
const r = await code({ result: { status, check: 'tls', target: 't', values: {} }, prev: st, ...extra });
|
||||
st = r.nextJson; log.push(`${status} -> alert=${r.hasAlert} ${JSON.parse(st).status} pc=${JSON.parse(st).pendingCount}`);
|
||||
};
|
||||
await run('ok'); await run('critical'); await run('ok'); await run('critical'); await run('critical');
|
||||
await run('critical'); await run('critical', { reminderMinutes: 0 }); await run('ok');
|
||||
console.log(log.join('\n'));
|
||||
@@ -0,0 +1,14 @@
|
||||
-- Simulates the planned mozdit_automation database (ops-automation-phase1 design D3).
|
||||
CREATE DATABASE automation_pilot;
|
||||
\connect automation_pilot
|
||||
CREATE TABLE check_result (
|
||||
id bigserial PRIMARY KEY, run_id uuid NOT NULL, target text NOT NULL, check_type text NOT NULL,
|
||||
status text NOT NULL CHECK (status IN ('ok','warning','critical','unknown')),
|
||||
"values" jsonb NOT NULL, measured_at timestamptz NOT NULL);
|
||||
CREATE TABLE check_state (
|
||||
target text, check_type text, status text NOT NULL, since timestamptz NOT NULL,
|
||||
last_alert_at timestamptz, consecutive_failures int NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (target, check_type));
|
||||
CREATE TABLE dlq_events (
|
||||
id bigserial PRIMARY KEY, workflow text NOT NULL, payload jsonb NOT NULL, error text NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT now(), replayed_at timestamptz);
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs ON the server inside ~/projects/ap-pilot: generates secrets (never printed) and test certificates.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
if [ ! -f .env ]; then
|
||||
umask 077
|
||||
cat > .env <<ENV
|
||||
AP_ENGINE_EXECUTABLE_PATH=dist/packages/engine/main.js
|
||||
AP_ENCRYPTION_KEY=$(openssl rand -hex 16)
|
||||
AP_JWT_SECRET=$(openssl rand -hex 32)
|
||||
AP_ENVIRONMENT=prod
|
||||
AP_FRONTEND_URL=http://localhost:80
|
||||
AP_WEBHOOK_TIMEOUT_SECONDS=30
|
||||
AP_TRIGGER_DEFAULT_POLL_INTERVAL=5
|
||||
AP_POSTGRES_DATABASE=activepieces
|
||||
AP_POSTGRES_HOST=postgres
|
||||
AP_POSTGRES_PORT=5432
|
||||
AP_POSTGRES_USERNAME=appilot
|
||||
AP_POSTGRES_PASSWORD=$(openssl rand -hex 16)
|
||||
AP_EXECUTION_MODE=UNSANDBOXED
|
||||
AP_WORKER_CONCURRENCY=1
|
||||
AP_REDIS_HOST=redis
|
||||
AP_REDIS_PORT=6379
|
||||
AP_FLOW_TIMEOUT_SECONDS=600
|
||||
AP_TELEMETRY_ENABLED=false
|
||||
ENV
|
||||
fi
|
||||
if [ ! -f tls/ok.pem ]; then
|
||||
cd tls
|
||||
openssl req -x509 -newkey rsa:2048 -nodes -keyout ca.key -out ca.pem -days 30 -subj "/CN=pilot-ca" 2>/dev/null
|
||||
for pair in "ok:30" "crit:5"; do
|
||||
n=${pair%%:*}; d=${pair##*:}
|
||||
openssl req -newkey rsa:2048 -nodes -keyout $n.key -out $n.csr -subj "/CN=tls.pilot" 2>/dev/null
|
||||
printf "subjectAltName=DNS:tls.pilot\n" > $n.ext
|
||||
openssl x509 -req -in $n.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out $n.pem -days $d -extfile $n.ext 2>/dev/null
|
||||
done
|
||||
chmod 644 *.pem; chmod 600 *.key; rm -f *.csr *.ext
|
||||
fi
|
||||
echo "setup ok"
|
||||
@@ -0,0 +1,16 @@
|
||||
"""ntfy stand-in for the pilot: records POSTs (title/priority headers + body); GET /received lists them."""
|
||||
import json
|
||||
from datetime import datetime, timezone
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
RECEIVED = []
|
||||
class H(BaseHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
body = self.rfile.read(int(self.headers.get("Content-Length", 0))).decode()
|
||||
RECEIVED.append({"at": datetime.now(timezone.utc).isoformat(), "path": self.path,
|
||||
"title": self.headers.get("Title"), "priority": self.headers.get("Priority"), "body": body})
|
||||
self.send_response(200); self.end_headers(); self.wfile.write(b'{"ok":true}')
|
||||
def do_GET(self):
|
||||
data = json.dumps(RECEIVED).encode() if self.path == "/received" else b'{"ok":true}'
|
||||
self.send_response(200); self.send_header("Content-Type", "application/json"); self.end_headers(); self.wfile.write(data)
|
||||
def log_message(self, *a): pass
|
||||
HTTPServer(("0.0.0.0", 8000), H).serve_forever()
|
||||
@@ -0,0 +1,2 @@
|
||||
server { listen 8443 ssl; ssl_certificate /etc/nginx/certs/ok.pem; ssl_certificate_key /etc/nginx/certs/ok.key; location / { return 200 "ok\n"; } }
|
||||
server { listen 8444 ssl; ssl_certificate /etc/nginx/certs/crit.pem; ssl_certificate_key /etc/nginx/certs/crit.key; location / { return 200 "crit\n"; } }
|
||||
Reference in New Issue
Block a user