Fosi Fossil Service
Small teams. Open source. Built on Fossil.

CaaS / Lamina

Unified Management for Fossil Repositories

Public | Owner: CaaS | Default branch: trunk | Last update: 2026-10-25 00:41

Artifact f3651f12b872ec85ec10613df6d4417b1ec7120d6ef16b53dd983a11f946798d:


(defmodule lamina_sup
  (behaviour supervisor)
  (export all))

(defun start_link ()
  (supervisor:start_link `#(local lamina_sup) 'lamina_sup '()))

(defun init (_args)
  ;; 安装前后都拉起仓库进程树:未安装时 start-all 查库失败即可;
  ;; 否则 Setup 完成后不重启容器,创建仓库会因 repo_mgr 不存在而失败。
  (tuple 'ok (tuple #M(strategy one_for_one intensity 5 period 10)
                    (runtime-child-specs))))

(defun runtime-child-specs ()
  (list
   (tuple 'lamina_repo_registry
          (tuple 'lamina_repo_registry 'start_link '())
          'permanent 5000 'worker '())
   (tuple 'lamina_repo_mgr
          (tuple 'lamina_repo_mgr 'start_link '())
          'permanent 5000 'worker '())
   (tuple 'lamina_sync_sched
          (tuple 'lamina_sync_sched 'start_link '())
          'permanent 5000 'worker '())))

(defun ensure-runtime ()
  (lists:foreach #'ensure-child/1 (runtime-child-specs)))

(defun ensure-child (spec)
  (let ((id (element 1 spec)))
    (case (catch (supervisor:start_child 'lamina_sup spec))
      (`#(ok ,_) 'ok)
      (`#(error #(already_started ,_)) 'ok)
      (`#(error #(already_present ,_))
       (catch (supervisor:restart_child 'lamina_sup id))
       'ok)
      (_ 'ok))))

Clone

You can clone this repository with the following command:

fossil clone https://fosi.dev/CaaS/Lamina

Contribute

The best way to contribute is through e-mail. See the project documentation for more details.