refactor
This commit is contained in:
@@ -31,7 +31,7 @@ alpine-make-vm-image \
|
||||
--fs-skel-dir "$OVERLAY_DIR" \
|
||||
--fs-skel-chown root:root \
|
||||
--script-chroot \
|
||||
--packages "git curl docker cronie openssh" \
|
||||
--packages "curl docker openssh" \
|
||||
"$IMAGE_FILE" \
|
||||
"$CONFIGURE_SH" | tee $TMP
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ rc-update add net.lo boot
|
||||
rc-update add net.eth0 default
|
||||
rc-update add acpid default
|
||||
rc-update add docker default
|
||||
rc-update add cronie default
|
||||
rc-update add sshd
|
||||
rc-update add auth-server
|
||||
rc-update add bubble
|
||||
@@ -48,12 +47,5 @@ rm -rf \
|
||||
/usr/share/doc \
|
||||
/usr/share/info
|
||||
|
||||
step 'Setup git user'
|
||||
git config --global user.email bearnet+keeper@sab.ee
|
||||
git config --global user.name "B.B.K.K.B.K.K"
|
||||
adduser -S keeper
|
||||
mkdir /users
|
||||
chown keeper /users
|
||||
|
||||
echo ''
|
||||
echo '=== Configure script completed ==='
|
||||
|
||||
14
image/overlay/daemon/config.yaml
Normal file
14
image/overlay/daemon/config.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
address: ":_BUBBLE_SSH_PORT_"
|
||||
network-group: "workspace"
|
||||
server-key-file: "/etc/ssh/ssh_host_rsa_key"
|
||||
|
||||
workspace-parent: "/data/workspace"
|
||||
global-share-dir: "/data/share"
|
||||
auth-server: "http://localhost:8080/"
|
||||
|
||||
manager:
|
||||
address: "0.0.0.0:7684"
|
||||
|
||||
templates:
|
||||
".*":
|
||||
image: ""
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
# VARIABLES: _REVISION_ _REPO_
|
||||
|
||||
set -euo pipefail
|
||||
mkdir -p /users && chown keeper /users && chmod 644 /users
|
||||
|
||||
init_repo(){
|
||||
su - keeper 'git clone -b _REVISION_ _REPO_ /users'
|
||||
}
|
||||
|
||||
if [[ ! -d /users/.git ]]; then
|
||||
init_repo
|
||||
elif [[ -d /users && cd /users && ! su - keeper 'git pull origin _REVISION_' ]]; then
|
||||
init_repo
|
||||
fi
|
||||
1
image/overlay/etc/conf.d/auth-server
Normal file
1
image/overlay/etc/conf.d/auth-server
Normal file
@@ -0,0 +1 @@
|
||||
GITEA_TOKEN=_BUBBLE_AUTH_GITEA_KEY_
|
||||
1
image/overlay/etc/hostname
Normal file
1
image/overlay/etc/hostname
Normal file
@@ -0,0 +1 @@
|
||||
_CLOUD_HOSTNAME_
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/sbin/openrc-run
|
||||
command="/usr/bin/auth-server"
|
||||
command_background=true
|
||||
command_args="-addr 0.0.0.0:8080 -root /users"
|
||||
command_args="-org _BUBBLE_AUTH_ORG_ -team _BUBBLE_AUTH_TEAM_ -gitea-url _BUBBLE_AUTH_GITEA_URL_"
|
||||
command_user="keeper"
|
||||
|
||||
pidfile="/run/${RC_SVCNAME}.pid"
|
||||
|
||||
9
image/overlay/etc/init.d/tsdns
Executable file
9
image/overlay/etc/init.d/tsdns
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
depend() {
|
||||
need docker net
|
||||
}
|
||||
|
||||
command="/usr/bin/tsdns"
|
||||
command_background=true
|
||||
pidfile="/run/${RC_SVCNAME}.pid"
|
||||
7
image/overlay/etc/init.d/update-images
Executable file
7
image/overlay/etc/init.d/update-images
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
depend() {
|
||||
need docker net
|
||||
}
|
||||
|
||||
command="/usr/bin/update-images"
|
||||
@@ -3,4 +3,4 @@ iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
post-up ip route del default || true; ip route add default via GATEWAY_ADDRESS
|
||||
post-up ip route del default || true; ip route add default via _CLOUD_GATEWAY_ADDRESS_
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Port _HOST_SSH_PORT_
|
||||
@@ -1 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN6GbswtvLbhmju/vBunpfPaqpcIuESJSLoR+Sz0ujTs cardno:F1D0_013135A1
|
||||
_HOST_SSH_PUBLIC_KEY_
|
||||
23
image/overlay/usr/bin/tsdns
Executable file
23
image/overlay/usr/bin/tsdns
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
if [ ! docker network insepct "workspace" ]; then
|
||||
docker network create \
|
||||
--attachable \
|
||||
--ipv4 \
|
||||
--ip-range "_ADVERTISE_ROUTE_" \
|
||||
--subnet "_TSDNS_SUBNET_" \
|
||||
workspace
|
||||
fi
|
||||
|
||||
docker run -e "TS_AUTHKEY=_TS_AUTHKEY_" \
|
||||
-e "HOMELAB_TLD=_HOMELAB_TLD_" \
|
||||
-e "HOMELAB_ZONE=_HOMELAB_ZONE_" \
|
||||
-e "TS_STATE_DIR=/tstate" \
|
||||
-e "ADVERTISE_ROUTE=_ADVERTISE_ROUTE_" \
|
||||
-e "TS_DEBUG_OMIT_LOCAL_ADDRS=true" \
|
||||
--network "workspace" \
|
||||
-p 41641:41641/udp
|
||||
-v "/data/tsdns:/tstate"
|
||||
--restart unless-stopped
|
||||
ghcr.io/saltedfishclub/tsdns:latest
|
||||
10
image/overlay/usr/bin/update-images
Executable file
10
image/overlay/usr/bin/update-images
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
cleanup_() {
|
||||
touch /.image-update-flag
|
||||
}
|
||||
|
||||
if [ ! -f /.image-update-flag ]; then
|
||||
docker pull
|
||||
fi
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * /usr/bin/sh /daemon/update-keys.sh
|
||||
32
image/substitution.sh
Executable file
32
image/substitution.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
current_file=""
|
||||
root="/kitchen/overlay"
|
||||
|
||||
while IFS= read -r line; do
|
||||
case "$line" in
|
||||
\#\ /*)
|
||||
current_file="${line#\# }"
|
||||
;;
|
||||
\#\:*)
|
||||
continue
|
||||
;;
|
||||
*=*)
|
||||
if [ -z "$current_file" ]; then
|
||||
echo "warning: value without file: $line" >&2
|
||||
continue
|
||||
fi
|
||||
key="${line%%=*}"
|
||||
value="${line#*=}"
|
||||
key_esc=$(printf '%s' "$key" | sed 's/[]\/$*.^[]/\\&/g')
|
||||
value_esc=$(printf '%s' "$value" | sed 's/[\/&]/\\&/g')
|
||||
sed -i "s/_${key_esc}_/${value_esc}/g" "$root$current_file"
|
||||
;;
|
||||
"")
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
echo "unknown line: $line" >&2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user