From 313fb607c03082750fbde9135cadf4a35db9d5b4 Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Sun, 16 Nov 2025 11:16:00 -0700 Subject: move CI to docker-compose --- ci/data/bogenherr-starter.lisp | 7 +++++ ci/data/etc/bogenherr/figwheel-main.edn | 34 +++++++++++++++++++++++ ci/data/etc/bogenherr/options.lisp | 15 ++++++++++ ci/data/etc/sbclrc | 6 ++++ ci/data/install-root.sh | 30 ++++++++++++++++++++ ci/data/install-user-sbcl.sh | 10 +++++++ ci/data/start_app.sh | 49 +++++++++++++++++++++++++++++++++ 7 files changed, 151 insertions(+) create mode 100644 ci/data/bogenherr-starter.lisp create mode 100644 ci/data/etc/bogenherr/figwheel-main.edn create mode 100644 ci/data/etc/bogenherr/options.lisp create mode 100644 ci/data/etc/sbclrc create mode 100755 ci/data/install-root.sh create mode 100755 ci/data/install-user-sbcl.sh create mode 100755 ci/data/start_app.sh (limited to 'ci/data') diff --git a/ci/data/bogenherr-starter.lisp b/ci/data/bogenherr-starter.lisp new file mode 100644 index 0000000..1b95947 --- /dev/null +++ b/ci/data/bogenherr-starter.lisp @@ -0,0 +1,7 @@ +(load "/etc/sbclrc") +(asdf:operate 'asdf:load-op 'swank) +(setf swank::*loopback-interface* "0.0.0.0") +(swank:create-server :port 4110 :dont-close t) +(asdf:operate 'asdf:load-op 'bogenherr) +(in-package :bogenherr) +(bogenherr) diff --git a/ci/data/etc/bogenherr/figwheel-main.edn b/ci/data/etc/bogenherr/figwheel-main.edn new file mode 100644 index 0000000..864266c --- /dev/null +++ b/ci/data/etc/bogenherr/figwheel-main.edn @@ -0,0 +1,34 @@ +;; Figwheel-main configuration options see: https://figwheel.org/config-options +;; these will be overriden by the metadata config options in dev.cljs.edn build file +{ + ;; Set the server port https://figwheel.org/config-options#ring-server-options + ;; :ring-server-options {:port 9500} + + ;; Change the target directory from the "target" to "resources" + ;; https://figwheel.org/config-options#target-dir + ;; :target-dir "resources" + + ;; Server Ring Handler (optional) https://figwheel.org/docs/ring-handler.html + ;; If you want to embed a ring handler into the figwheel server, this + ;; is for simple ring servers + ;; :ring-handler hello_world.server/handler + + ;; To be able to open files in your editor from the heads up display + ;; you will need to put a script on your path. This script will have + ;; to take a file path and a line number ie. + ;; in ~/bin/myfile-opener: + ;; + ;; #! /bin/sh + ;; emacsclient -n +$2:$3 $1 + ;; + ;; :open-file-command "myfile-opener" + + ;; if you are using emacsclient you can just use + ;; :open-file-command "emacsclient" + + ;; Logging output gets printed to the REPL, if you want to redirect it to a file: + ;; :log-file "figwheel-main.log" + + :target-dir "resources" + :open-url false +} diff --git a/ci/data/etc/bogenherr/options.lisp b/ci/data/etc/bogenherr/options.lisp new file mode 100644 index 0000000..25f2ec2 --- /dev/null +++ b/ci/data/etc/bogenherr/options.lisp @@ -0,0 +1,15 @@ +(:name "bogenherr" + :scheme "http" + :url "www.bogenherr.org" + :document-root "bogenherr" + :title "Bogenherr Violin and Viola Lessons" + :meta-description "Bogenherr Violin and Viola Lessons written in Common Lisp/Hunchentoot and ClojureScript." + :databases (:db-bogenherr ("bogenherr" "bogenherr" "neweboy" "127.0.0.1")) + :mail-mx "mail.bogenherr.org" + :mail-from "postmaster@bogenherr.org" + :mail-postmaster "postmaster@bogenherr.org" + :mail-webmaster "webmaster@bogenherr.org" + :mail-info "postmaster@bogenherr.org" + :mail-login-notify "postmaster@bogenherr.org" + :mail-authentication (:login "me@ckons.org" "ayluvmiym") + :mail-ssl :starttls) diff --git a/ci/data/etc/sbclrc b/ci/data/etc/sbclrc new file mode 100644 index 0000000..3a931d0 --- /dev/null +++ b/ci/data/etc/sbclrc @@ -0,0 +1,6 @@ +;;; The following lines added by ql:add-to-init-file: +#-quicklisp +(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" + (user-homedir-pathname)))) + (when (probe-file quicklisp-init) + (load quicklisp-init))) diff --git a/ci/data/install-root.sh b/ci/data/install-root.sh new file mode 100755 index 0000000..be226f0 --- /dev/null +++ b/ci/data/install-root.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries +export DEBIAN_FRONTEND=noninteractive +apt-get update +apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade +apt-get -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" aptitude +aptitude -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" apt-transport-https ca-certificates software-properties-common language-pack-de +update-ca-certificates +aptitude update +aptitude -y install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" sbcl sbcl-source leiningen dnsutils bind9-host vim curl wget rlwrap pass rsync sudo jq lsof zip unzip + +rsync -av /data/ / + +if (( OLO_UID != 0 )); then + userdel ubuntu || true + groupdel ubuntu || true + rm -rf /home/ubuntu || true + export HOMEDIR="/home/${OLO_USERNAME}" + groupadd -g "${OLO_GID}" "${OLO_GROUPNAME}" || OLO_GROUPNAME=$(grep -F "x:${OLO_GID}:" /etc/group | awk -F: '{print $1}') + useradd -s /bin/bash -m -u "${OLO_UID}" -g "${OLO_GROUPNAME}" "${OLO_USERNAME}" || OLO_USERNAME=$(grep -F "x:${OLO_UID}:" /etc/passwd | awk -F: '{print $1}') + SUDOERS_FILENAME="${OLO_USERNAME//\./_}" + echo "${OLO_USERNAME} ALL=(ALL) NOPASSWD: ALL" > "/etc/sudoers.d/${SUDOERS_FILENAME}" + chmod 0440 "/etc/sudoers.d/${SUDOERS_FILENAME}" + mkdir -p "${HOMEDIR}/.gnupg" + chown "${OLO_USERNAME}":"${OLO_GROUPNAME}" "${HOMEDIR}/.gnupg" + chmod 0700 "${HOMEDIR}/.gnupg" +fi + +exit 0 diff --git a/ci/data/install-user-sbcl.sh b/ci/data/install-user-sbcl.sh new file mode 100755 index 0000000..e9d03ff --- /dev/null +++ b/ci/data/install-user-sbcl.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +curl -o ~/quicklisp.lisp https://beta.quicklisp.org/quicklisp.lisp +sbcl --load ~/quicklisp.lisp --eval "(quicklisp-quickstart:install)" --eval "(sb-ext:exit)" +sbcl --eval "(loop for pkg in '(cl-ppcre cl-smtp hunchentoot cl-log ironclad cl-markdown tmpdir swank net-telent-date uffi drakma cl-json postmodern fiveam local-time trivial-octet-streams cl-ppcre) do (ql:quickload (symbol-name pkg)))" --eval "(sb-ext:exit)" + +mkdir -p ~/.config/common-lisp +echo "(:source-registry (:tree (:home \"common-lisp/systems\")) :inherit-configuration)" | tee ~/.config/common-lisp/source-registry.conf + +exit 0 diff --git a/ci/data/start_app.sh b/ci/data/start_app.sh new file mode 100755 index 0000000..e357751 --- /dev/null +++ b/ci/data/start_app.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +mkdir -p ~/common-lisp/systems ~/opt +cd ~/opt +git clone -b master git@ns:repos/bogenherr.git +git clone -b master git@github.com:ckonstanski/org-ckons-cljs.form.git +git clone -b master git@github.com:ckonstanski/org-ckons-cljs.notifications +git clone -b master git@github.com:ckonstanski/org-ckons-condition +git clone -b master git@github.com:ckonstanski/org-ckons-core +git clone -b master git@github.com:ckonstanski/org-ckons-file +git clone -b master git@github.com:ckonstanski/org-ckons-http +git clone -b master git@github.com:ckonstanski/org-ckons-json +git clone -b master git@github.com:ckonstanski/org-ckons-serializable +git clone -b master git@github.com:ckonstanski/org-ckons-session +git clone -b master git@github.com:ckonstanski/org-ckons-sql + +logdir="/var/log/lisp" +mv ${logdir}/bogenherr.log.1 ${logdir}/bogenherr.log.2 +mv ${logdir}/${APPNAME}bogenherr.log ${logdir}/bogenherr.log.1 + +pushd ~/common-lisp/systems +ln -s ~/opt/bogenherr/lisp/bogenherr.asd bogenherr.asd +ln -s ~/opt/org-ckons-condition/org-ckons-condition.asd org-ckons-condition.asd +ln -s ~/opt/org-ckons-core/org-ckons-core.asd org-ckons-core.asd +ln -s ~/opt/org-ckons-file/org-ckons-file.asd org-ckons-file.asd +ln -s ~/opt/org-ckons-http/org-ckons-http.asd org-ckons-http.asd +ln -s ~/opt/org-ckons-json/org-ckons-json.asd org-ckons-json.asd +ln -s ~/opt/org-ckons-serializable/org-ckons-serializable.asd org-ckons-serializable.asd +ln -s ~/opt/org-ckons-session/org-ckons-session.asd org-ckons-session.asd +ln -s ~/opt/org-ckons-sql/org-ckons-sql.asd org-ckons-sql.asd +popd + +pushd ~/opt/bogenherr/lisp/webapps/bogenherr/conf +ln -s /etc/bogenherr/options.lisp options.lisp +popd + +pushd ~/opt/bogenherr/lisp/webapps/bogenherr/clojurescript/bogenherr +ln -s /etc/bogenherr/figwheel-main.edn figwheel-main.edn +mkdir checkouts +pushd checkouts +ln -s ~/opt/org-ckons-cljs.form org-ckons-cljs.form +ln -s ~/opt/org-ckons-cljs.notifications org-ckons-cljs.notifications +popd + +lein clean +lein fig:build | tee /tmp/bogenherr/lein.log & +popd + +SBCL_HOME=/usr/lib/sbcl SBCL_SOURCE_ROOT=/usr/lib/sbcl/src exec sbcl --dynamic-space-size 2048 --userinit /data/bogenherr-starter.lisp | tee /tmp/bogenherr/sbcl.log -- cgit v1.3