diff --git a/README.md b/README.md index bc2e2ed..62b9995 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,22 @@ # Pagetron -Free status page generator you always wanted! +Status page generator, based on Prometheus, designed to be deployed to Kubernetes clusters. + +[Demo Page](https://pagetron-demo.agrrh.com/) + +![screenshot](./docs/images/screenshot.png) ## About The Project Uses well-known technologies - - Prometheus under the hood - Kubernetes-ready + - Prometheus under the hood -Built with modular architecture in mind +Built with modularity in mind - - Easy to build e.g. your own UI + - Use external metrics sources + - Build your own UI Free to use and extend @@ -19,45 +24,24 @@ Free to use and extend

(back to top)

-### Built With - -Platform - - - [Docker](https://www.docker.com/) - - [Kubernetes](https://kubernetes.io/) - -Frontend - - - [Svelte](https://svelte.dev) - -Backend - - - [FastAPI](https://fastapi.tiangolo.com/) - -Storage - - - [Prometheus](https://prometheus.io) - -

(back to top)

- ## Getting Started ### Prerequisites You must have Kubernetes cluster to be up and running to deploy this application in native way. -You also may run it with Docker and possibly Docker Compose, after translating k8s manifests to docker or docker-compose scenario. - -See [./deploy](./deploy) folder. - ### Installation -⚠️ Development stage. - At the moment, installation is as simple as: ``` -kubectl apply -R -f ./deploy +git clone https://github.com/agrrh/pagetron.git + +helm install pagetron \ + pagetron/deploy/helm/pagetron \ + --upgrade \ + --namespace pagetron \ + --values values.yaml ``` This will create some resources in your cluster: @@ -73,54 +57,12 @@ This will create some resources in your cluster: ## Usage -⚠️ Development stage. - -### Setting up monitoring - -To monitor your stuff, you must target metrics collector (currently, `blackbox` exporter) to desired resources in `deploy/prometheus/prometheus.configmap.yaml`: - -``` -- targets: - - https://example.org - - https://api.example.org -``` - -### Backend - -First, expose metrics on your local environment: - -``` -kubectl port-forward -n pagetron svc/prometheus 9090:9090 -``` - -Then run backend API: - -``` -cd backend - -docker build . -t local/pagetron:backend -docker run --rm -ti --network host local/pagetron:backend -``` - -### Frontend - -Just run frontend: - -``` -npm i -npm run dev -``` - -Then you may visit UI: - -http://localhost:5173/ - -

(back to top)

+Refer to wiki for [Quickstart](wiki#quickstart). ## Roadmap - [x] [Prototype Stage](https://github.com/agrrh/pagetron/milestone/1) -- [ ] [Core Features](https://github.com/agrrh/pagetron/milestone/2) +- [x] [Core Features](https://github.com/agrrh/pagetron/milestone/2) - [ ] [Nice To Have](https://github.com/agrrh/pagetron/milestone/3) See the [open issues](https://github.com/agrrh/pagetron/issues) for a full list of proposed features (and known issues). diff --git a/deploy/yaml/namespace.yaml b/deploy/yaml/namespace.yaml deleted file mode 100644 index bd04cfa..0000000 --- a/deploy/yaml/namespace.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -apiVersion: v1 -kind: Namespace - -metadata: - name: pagetron diff --git a/deploy/yaml/prometheus/blackbox.deployment.yaml b/deploy/yaml/prometheus/blackbox.deployment.yaml deleted file mode 100644 index b951740..0000000 --- a/deploy/yaml/prometheus/blackbox.deployment.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- - -apiVersion: apps/v1 -kind: Deployment - -metadata: - name: blackbox - namespace: pagetron - labels: - app.kubernetes.io/name: blackbox - -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: blackbox - strategy: - type: RollingUpdate - - template: - metadata: - labels: - app.kubernetes.io/name: blackbox - spec: - containers: - - name: blackbox - image: prom/blackbox-exporter:v0.24.0 - imagePullPolicy: IfNotPresent - ports: - - name: http - protocol: TCP - containerPort: 9115 diff --git a/deploy/yaml/prometheus/blackbox.service.yaml b/deploy/yaml/prometheus/blackbox.service.yaml deleted file mode 100644 index fcf1b36..0000000 --- a/deploy/yaml/prometheus/blackbox.service.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- - -apiVersion: v1 -kind: Service - -metadata: - name: blackbox - namespace: pagetron - labels: - app.kubernetes.io/name: blackbox - -spec: - type: ClusterIP - selector: - app.kubernetes.io/name: blackbox - ports: - - name: http - port: 9115 - protocol: TCP - targetPort: http diff --git a/deploy/yaml/prometheus/housekeeper.cronjob.yaml b/deploy/yaml/prometheus/housekeeper.cronjob.yaml deleted file mode 100644 index 824ec71..0000000 --- a/deploy/yaml/prometheus/housekeeper.cronjob.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- - -apiVersion: batch/v1 -kind: CronJob - -metadata: - name: housekeeper - namespace: pagetron - -spec: - schedule: "0 10 * * 5" - jobTemplate: - spec: - template: - spec: - restartPolicy: OnFailure - containers: - - name: housekeeper - image: curlimages/curl:8.4.0 - imagePullPolicy: IfNotPresent - command: ["curl"] - args: - - --request - - POST - - --globoff - - --data-urlencode - - 'match[]={__name__!~"pagetron:.+"}' - - http://prometheus:9090/api/v1/admin/tsdb/delete_series diff --git a/deploy/yaml/prometheus/prometheus.configmap.yaml b/deploy/yaml/prometheus/prometheus.configmap.yaml deleted file mode 100644 index 5aa8d7a..0000000 --- a/deploy/yaml/prometheus/prometheus.configmap.yaml +++ /dev/null @@ -1,79 +0,0 @@ ---- - -apiVersion: v1 -kind: ConfigMap - -metadata: - name: prometheus-config - namespace: pagetron - -data: - prometheus.yaml: | - global: - scrape_interval: 15s - scrape_timeout: 10s - evaluation_interval: 60s - - rule_files: - - "rules_pagetron.yaml" - - scrape_configs: - # self monitoring - - job_name: prometheus - metrics_path: "/metrics" - scheme: "http" - static_configs: - - targets: - - "localhost:9090" - - # blackbox operational metrics - - job_name: "blackbox_exporter" - static_configs: - - targets: - - blackbox:9115 - - # resources - - job_name: "blackbox" - metrics_path: /probe - params: - module: - - http_2xx - static_configs: - - targets: - - https://agrrh.com - - https://getlock.agrrh.com - relabel_configs: - - source_labels: [__address__] - target_label: __param_target - - source_labels: [__param_target] - target_label: instance - - target_label: __address__ - replacement: blackbox:9115 - - rules_pagetron.yaml: | - groups: - - name: pagetron_minute - interval: 15s - rules: - - record: pagetron:availability:1m - expr: |- - sum by (instance) ( - probe_success == bool 1 - and probe_http_status_code >= bool 200 - and probe_http_status_code < bool 300 - and probe_duration_seconds < bool 2 - ) - - - name: pagetron_hour - interval: 60s - rules: - - record: pagetron:availability:1h - expr: |- - avg_over_time(pagetron:availability:1m[60m:1m]) - - - name: pagetron_day - interval: 30m - rules: - - record: pagetron:availability:1d - expr: |- - avg_over_time(pagetron:availability:1h[24h:30m]) diff --git a/deploy/yaml/prometheus/prometheus.deployment.yaml b/deploy/yaml/prometheus/prometheus.deployment.yaml deleted file mode 100644 index 86ab449..0000000 --- a/deploy/yaml/prometheus/prometheus.deployment.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- - -apiVersion: apps/v1 -kind: Deployment - -metadata: - name: prometheus - namespace: pagetron - labels: - app.kubernetes.io/name: prometheus - -spec: - replicas: 1 - selector: - matchLabels: - app.kubernetes.io/name: prometheus - strategy: - type: RollingUpdate - - template: - metadata: - labels: - app.kubernetes.io/name: prometheus - spec: - containers: - - name: prometheus - image: prom/prometheus:v2.48.0 - imagePullPolicy: IfNotPresent - command: ["/bin/prometheus"] - args: - - "--config.file=/etc/prometheus/prometheus.yaml" - - "--storage.tsdb.path=/prometheus" - - "--web.console.libraries=/usr/share/prometheus/console_libraries" - - "--web.console.templates=/usr/share/prometheus/consoles" - - "--web.enable-admin-api" # allow external housekeeping - - "--storage.tsdb.retention.time=10y" - - "--storage.tsdb.retention.size=10GB" - ports: - - name: http - protocol: TCP - containerPort: 9090 - volumeMounts: - - name: config - mountPath: /etc/prometheus - - name: data - mountPath: /prometheus - volumes: - - name: config - configMap: - name: prometheus-config - - name: data - persistentVolumeClaim: - claimName: prometheus-data diff --git a/deploy/yaml/prometheus/prometheus.pvc.yaml b/deploy/yaml/prometheus/prometheus.pvc.yaml deleted file mode 100644 index d56e6a9..0000000 --- a/deploy/yaml/prometheus/prometheus.pvc.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- - -kind: PersistentVolumeClaim -apiVersion: v1 - -metadata: - name: prometheus-data - namespace: pagetron - -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 10Gi - # storageClassName: local diff --git a/deploy/yaml/prometheus/prometheus.service.yaml b/deploy/yaml/prometheus/prometheus.service.yaml deleted file mode 100644 index 8b92b64..0000000 --- a/deploy/yaml/prometheus/prometheus.service.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- - -apiVersion: v1 -kind: Service - -metadata: - name: prometheus - namespace: pagetron - labels: - app.kubernetes.io/name: prometheus - -spec: - type: ClusterIP - selector: - app.kubernetes.io/name: prometheus - ports: - - name: http - port: 9090 - protocol: TCP - targetPort: http diff --git a/docs/images/screenshot.png b/docs/images/screenshot.png new file mode 100644 index 0000000..d2d768e Binary files /dev/null and b/docs/images/screenshot.png differ