Statping ng izhodiscni guix fajli

main
Jurij Podgoršek 2024-05-23 21:18:58 +02:00
parent d9d6f41eca
commit b07a89656d
3 changed files with 137 additions and 0 deletions

14
README.org 100644
View File

@ -0,0 +1,14 @@
#+TITLE: Guix statping-ng
Kompot-ov paket za postavitev statping-ng preko guix upravljalnika paketov.
Statping-ng prikazuje dosegljivost (uptime) spletnih in internethih storitev.
* Požen
Na sistemu, ki ima ~guix~ upravljalnik paketov, poženi:
#+begin_src bash
guix shell
#+end_src
Po prvem zagonu izpiše ukaz, s katerim dovolimo nalaganje ~manifest.scm~ fajla iz direktorija tega projekta.

5
manifest.scm 100644
View File

@ -0,0 +1,5 @@
(define-module (guix-statping-ng manifest))
(use-modules (gnu packages))
(specifications->manifest
(list "statping-ng-bin-amd64"))

118
statping-ng.scm 100644
View File

@ -0,0 +1,118 @@
(use-modules (guix packages)
(guix download)
((guix licenses) #:prefix license:)
(guix gexp)
(nonguix build-system binary)
(gnu packages gcc)
(gnu packages admin)
(gnu services)
(gnu services configuration)
(gnu services shepherd)
(gnu system shadow))
(define statping-ng-bin-amd64
(package
(name "statping-ng-bin-amd64")
(version "0.91.0")
(source
(origin
(method url-fetch)
(uri (string-append
"https://github.com/statping-ng/statping-ng/releases/download/v" version "/statping-linux-amd64.tar.gz"))
(file-name "statping-ng")
(sha256
(base32 "1d4qnwp5cmv7glw31m9g1ackccgx4kdrc445fdfi5ir75grqqx0g"))))
(build-system binary-build-system)
(arguments
`(#:phases (modify-phases %standard-phases
(add-after 'unpack 'chmod-to-allow-patchelf
(lambda _
(chmod "statping-ng" #o755))))
;#:validate-runpath? #f
#:install-plan `(("statping-ng" "bin/"))))
(inputs `(("gcc:lib" ,gcc "lib")))
(home-page "https://statping-ng.github.io/")
(synopsis "An updated drop-in for statping.")
(description "A Status Page for monitoring your websites and applications with beautiful graphs, analytics, and plugins. Run on any type of environment.")
(properties
'((release-monitoring-url . "https://github.com/statping-ng/statping-ng/releases")))
(license license:gpl3)))
(define %statping-ng-accounts
(list (user-group (name "statping-ng") (system? #t))
(user-account
(name "statping-ng")
(group "statping-ng")
(system? #t)
(shell (file-append shadow "/sbin/nologin"))
(comment "uporabnik za statping-ng uptime tracker"))))
(define %statping-ng-activation
#~(begin
(use-modules (guix build tools))
(mkdir-p "/srv/statping-ng")
(let ((user (getpwnam "statping-ng")))
(chown "/srv/statping-ng"
(passwd:uid user)
(passwd:gid user)))))
(define (statping-ng-shepherd-service config)
"Vrne storitev ki poganja statping-ng"
(let* ((statping-ng (statping-ng-configuration config))
(statping-ng-bin (file-append statping-ng-bin-amd64 "/bin/statping-ng"))
(statping-ng-cfg (statping-ng-configuration->file config)))
(list (shepherd-service
(documentation "požene statping-ng storitev")
(requirement '(networking user-processes))
(provision '(statping-ng))
(start #~(make-forkexec-constructor
(list #$statping-ng-bin)
#:environment-variables
(list)))
(stop #~(make-kill-destructor))))))
(define-configuration/no-serialization statping-ng-configuration
(statping-ng-bin-amd64
(file-like statping-ng-bin-amd64)
"paket statping-ng"))
(define (statping-ng-configuration->file config)
(mixed-text-file "statping-ng.yml" "
connection: postgres
host: localhost
user: statpingng
password: d7e9820c6856698908632127
database: statpingng
port: 5432
language: en
allow_reports: true
location: /srv/statping-ng
disable_http: false
demo_mode: false
disable_logs: false
use_assets: false
db_open_connections: 25
db_idle_connections: 25
db_max_life_connections: 300
sample_data: false
use_cdn: false
disable_colors: false
"))
(define statping-ng-bin-amd64-service-type
(service-type (name 'statping-ng-bin-amd64)
(extensions
;; Storitev, ki teče
(list (service-extension shepherd-root-service-type
statping-ng-shepherd-service)
;; Uporabniški računi za storitev
(service-extension account-service-type
(const %statping-ng-accounts))
;; Aktivacija se požene menda enkrat, ko prvič poženeš
(service-extension activation-service-type
(const %statping-ng-activation))))
(default-value (statping-ng-configuration))
(description
"Poženi statping-ng")))
statping-ng-bin-amd64