refactor: use bubble instead

This commit is contained in:
iceBear67
2026-06-15 17:22:01 +08:00
parent ab9b4c7e13
commit 37d68dfcab
9 changed files with 47 additions and 381 deletions

View File

@@ -15,10 +15,6 @@ CONFIGURE_SH = $(SCRIPT_DIR)/configure.sh
build:
@echo ">>> Building $(IMAGE_FILE) ..."
@test -f $(OVERLAY_DIR)/root/gpg-key.asc || { \
echo "ERROR: GPG key not found. Generate key first" >&2; \
exit 1; \
}
alpine-make-vm-image \
--branch $(ALPINE_BRANCH) \
--image-format $(IMAGE_FORMAT) \
@@ -28,7 +24,7 @@ build:
--fs-skel-dir $(OVERLAY_DIR) \
--fs-skel-chown root:root \
--script-chroot \
--packages "python3 py3-yaml py3-pydantic git curl gnupg docker docker-cli-buildx docker-cli-compose cronie" \
--packages "git curl docker docker-cli-buildx docker-cli-compose cronie" \
$(IMAGE_FILE) \
$(CONFIGURE_SH)
@echo ">>> Image built: $(IMAGE_FILE)"

View File

@@ -33,25 +33,15 @@ rc-update add acpid default
rc-update add docker default
rc-update add cronie default
step 'Import GPG key for root'
GPG_KEY_FILE="/root/gpg-key.asc"
if [ -f "$GPG_KEY_FILE" ]; then
echo "Found GPG key file: $GPG_KEY_FILE"
gpg --batch --import "$GPG_KEY_FILE"
# Mark the imported key as ultimately trusted (non-interactive)
fingerprint=$(gpg --batch --with-colons --fingerprint \
| grep '^fpr:' | head -1 | cut -d: -f10)
if [ -n "$fingerprint" ]; then
echo "$fingerprint:6:" | gpg --batch --import-ownertrust
echo " * GPG key trusted: $fingerprint"
fi
rm -f "$GPG_KEY_FILE"
else
echo "WARNING: GPG key file not found at $GPG_KEY_FILE — skipping import" >&2
fi
step 'Clean up APK cache'
rm -rf /var/cache/apk/* || true
step 'Setup git user'
git config --user.email bearnet+keeper@sab.ee
git config --user.name "B.B.K.K.B.K.K"
adduser -S keeper
mkdir /users
chown keeper /users
echo ''
echo '=== Configure script completed ==='

View File

@@ -0,0 +1,17 @@
#!/bin/sh
# VARIABLES: _REVISION_ _REPO_
set -euo pipefail
mkdir -p /users && chown keeper /users && chmod 644 /users
su keeper
init_repo(){
git clone -b _REVISION_ _REPO_ /users
}
if [[ ! -d /users/.git ]]; then
init_repo
elif [[ -d /users && cd /users && ! git pull origin _REVISION_ ]]; then
init_repo
fi

View File

@@ -1,16 +0,0 @@
#!/bin/sh
mkdir -p /app
cd /app
rm -rf ./template ./snapshot
mkdir /app/template /app/snapshot
set -euo pipefail
git clone -b _REVISION_ _REPO_ template
python3 /daemon/orchestrate.py \
--root /app/template \
--network cloud \
--volume-parent /data/volumes \
--snapshot-root /app/snapshot

View File

@@ -0,0 +1,11 @@
#!/sbin/openrc-run
command="/usr/bin/auth-server"
command_background=true
command_args="-addr 0.0.0.0:8080 -root /users"
command_user="keeper"
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
need net
}

10
image/overlay/etc/init.d/bubble Executable file
View File

@@ -0,0 +1,10 @@
#!/sbin/openrc-run
depend() {
need auth-server docker
}
command="/usr/bin/bubble"
command_args="-config /daemon/config.yaml"
pidfile="/run/${RC_SVCNAME}.pid"
command_background=true

View File

@@ -1,2 +1,2 @@
# min hour day month weekday command
*/15 * * * * /usr/bin/sh /daemon/update.sh
*/15 * * * * /usr/bin/sh /daemon/update-keys.sh