|
From: | paul |
Subject: | OCI-backed Guix System Services |
Date: | Wed, 20 Sep 2023 16:47:32 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 |
Dear Guixers,
I was recently inspired from Nix's oci-container feature and
wrote a thin wrapper around the docker CLI to enable the
management of docker containers through Shepherd [0]. This enables
handling of non packaged services through guix system reconfigure
and herd start/stop/status .
(define (grafana-configuration config)
(oci-container-configuration
(image "grafana/grafana:10.0.1"
)
(network "host")
(ports
`((,port . "3000")))
(volumes
`(("/var/lib/grafana" . "/var/lib/grafana")
;; Needed because grafana.ini is a symlink to an item in the store.
("/gnu/store" . "/gnu/store")
("/etc/grafana/grafana.ini" . "/etc/grafana/grafana.ini")))))
(define grafana-service-type
(service-type (name 'grafana)
(extensions (list (service-extension oci-container-service-type
grafana-configuration)
(service-extension account-service-type
(const %grafana-accounts))
(service-extension nginx-service-type
grafana-nginx-locations)
(service-extension activation-service-type
%grafana-activation)))))
This is somewhat made up code, for a real world example you can
have a look here [1].
In the future it probably makes sense to be able to switch the "OCI backend" to podman, for now I just wanted to figure out if it's something that would be useful to the Guix community and if the implementation looks right.
To conclude, I'm not advocating for adding OCI-backed services to Guix mainstream: in my opinion they should be bootstrapped and built from source, but I believe the actual "backend" implementation for such services could be useful to have in Guix. What do you think?
Thank you for the wonderful community that Guix still proves to be,
giacomo
[0]:
https://gitlab.com/orang3/small-guix/-/blob/master/small-guix/services/docker.scm
[1]:
https://gitlab.com/orang3/guix-nas/-/blob/main/modules/nas/services/grafana.scm
[Prev in Thread] | Current Thread | [Next in Thread] |