forked from finn/tinyboard
compose.yaml, setup-spoke.sh: replace named Docker volume with host directory for syncthing config, reset compose.yaml to generic placeholders, remove volume permission fix step
This commit is contained in:
@@ -11,25 +11,22 @@ services:
|
|||||||
-o "ServerAliveInterval=60"
|
-o "ServerAliveInterval=60"
|
||||||
-o "ServerAliveCountMax=3"
|
-o "ServerAliveCountMax=3"
|
||||||
-R 11111:localhost:22
|
-R 11111:localhost:22
|
||||||
-i /home/armbian/.ssh/oilykey2026
|
-i /home/armbian/.ssh/hubkey
|
||||||
armbian@oily.dad
|
armbian@hub.example.com
|
||||||
volumes:
|
volumes:
|
||||||
- /home/armbian/.ssh/oilykey2026:/home/armbian/.ssh/oilykey2026:ro
|
- /home/armbian/.ssh/hubkey:/home/armbian/.ssh/hubkey:ro
|
||||||
- /home/armbian/.ssh/known_hosts:/home/armbian/.ssh/known_hosts:ro
|
- /home/armbian/.ssh/known_hosts:/home/armbian/.ssh/known_hosts:ro
|
||||||
syncthing:
|
syncthing:
|
||||||
image: syncthing/syncthing
|
image: syncthing/syncthing
|
||||||
container_name: spoke-syncthing
|
container_name: spoke-syncthing
|
||||||
hostname: spoke-syncthing
|
hostname: spoke-syncthing
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
user: "1000:1000"
|
||||||
environment:
|
environment:
|
||||||
- PUID=1000
|
- HOME=/var/syncthing
|
||||||
- PGID=1000
|
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:8384:8384"
|
- "127.0.0.1:8384:8384"
|
||||||
- "22000:22000"
|
- "22000:22000"
|
||||||
volumes:
|
volumes:
|
||||||
- syncthing-config:/var/syncthing/config
|
- /home/armbian/st/config:/var/syncthing/config
|
||||||
- /home/armbian/st/data:/var/syncthing/data
|
- /home/armbian/st/data:/var/syncthing/data
|
||||||
|
|
||||||
volumes:
|
|
||||||
syncthing-config:
|
|
||||||
|
|||||||
@@ -349,8 +349,9 @@ header "Configuring compose.yaml"
|
|||||||
info "Setting port to $TUNNEL_PORT and key to $KEY_NAME..."
|
info "Setting port to $TUNNEL_PORT and key to $KEY_NAME..."
|
||||||
|
|
||||||
SYNCTHING_MOUNT="$ARMBIAN_HOME/st/data"
|
SYNCTHING_MOUNT="$ARMBIAN_HOME/st/data"
|
||||||
mkdir -p "$SYNCTHING_MOUNT"
|
SYNCTHING_CONFIG="$ARMBIAN_HOME/st/config"
|
||||||
chown "$SPOKE_USER":"$SPOKE_USER" "$SYNCTHING_MOUNT"
|
mkdir -p "$SYNCTHING_MOUNT" "$SYNCTHING_CONFIG"
|
||||||
|
chown "$SPOKE_USER":"$SPOKE_USER" "$SYNCTHING_MOUNT" "$SYNCTHING_CONFIG"
|
||||||
|
|
||||||
SPOKE_UID=$(id -u "$SPOKE_USER")
|
SPOKE_UID=$(id -u "$SPOKE_USER")
|
||||||
SPOKE_GID=$(id -g "$SPOKE_USER")
|
SPOKE_GID=$(id -g "$SPOKE_USER")
|
||||||
@@ -361,8 +362,8 @@ sed -i "/known_hosts/!s|/home/[^/]*/\.ssh/[^:]*:/home/[^/]*/\.ssh/[^:]*:ro|${SSH
|
|||||||
sed -i "s|/home/[^/]*/\.ssh/known_hosts|${SSH_DIR}/known_hosts|g" "$COMPOSE"
|
sed -i "s|/home/[^/]*/\.ssh/known_hosts|${SSH_DIR}/known_hosts|g" "$COMPOSE"
|
||||||
sed -i "s| [a-zA-Z0-9._-]*@[a-zA-Z0-9._-]*\.[a-zA-Z0-9._-]*[[:space:]]*\$| ${HUB_USER}@${HUB_HOST}|" "$COMPOSE"
|
sed -i "s| [a-zA-Z0-9._-]*@[a-zA-Z0-9._-]*\.[a-zA-Z0-9._-]*[[:space:]]*\$| ${HUB_USER}@${HUB_HOST}|" "$COMPOSE"
|
||||||
sed -i "s|/home/[^/]*/st/data:|${SYNCTHING_MOUNT}:|g" "$COMPOSE"
|
sed -i "s|/home/[^/]*/st/data:|${SYNCTHING_MOUNT}:|g" "$COMPOSE"
|
||||||
sed -i "s|PUID=[0-9]*|PUID=${SPOKE_UID}|g" "$COMPOSE"
|
sed -i "s|/home/[^/]*/st/config:|${SYNCTHING_CONFIG}:|g" "$COMPOSE"
|
||||||
sed -i "s|PGID=[0-9]*|PGID=${SPOKE_GID}|g" "$COMPOSE"
|
sed -i "s|user: \"[0-9]*:[0-9]*\"|user: \"${SPOKE_UID}:${SPOKE_GID}\"|" "$COMPOSE"
|
||||||
sed -i "s|container_name: spoke-autossh|container_name: ${SPOKE_NAME}-autossh|g" "$COMPOSE"
|
sed -i "s|container_name: spoke-autossh|container_name: ${SPOKE_NAME}-autossh|g" "$COMPOSE"
|
||||||
sed -i "s|container_name: spoke-syncthing|container_name: ${SPOKE_NAME}-syncthing|g" "$COMPOSE"
|
sed -i "s|container_name: spoke-syncthing|container_name: ${SPOKE_NAME}-syncthing|g" "$COMPOSE"
|
||||||
sed -i "s|hostname: spoke-syncthing|hostname: ${SPOKE_NAME}-syncthing|g" "$COMPOSE"
|
sed -i "s|hostname: spoke-syncthing|hostname: ${SPOKE_NAME}-syncthing|g" "$COMPOSE"
|
||||||
@@ -375,11 +376,6 @@ docker build \
|
|||||||
--build-arg GID="$(id -g "$SPOKE_USER")" \
|
--build-arg GID="$(id -g "$SPOKE_USER")" \
|
||||||
-t spoke-autossh .
|
-t spoke-autossh .
|
||||||
|
|
||||||
header "Fixing Syncthing Volume Permissions"
|
|
||||||
info "Setting correct ownership on syncthing-config volume..."
|
|
||||||
docker run --rm -v syncthing-config:/var/syncthing/config alpine chown -R "${SPOKE_UID}:${SPOKE_GID}" /var/syncthing/config
|
|
||||||
info "Syncthing volume permissions set."
|
|
||||||
|
|
||||||
header "Starting Containers"
|
header "Starting Containers"
|
||||||
TUNNEL_UP="false"
|
TUNNEL_UP="false"
|
||||||
for ATTEMPT in 1 2 3; do
|
for ATTEMPT in 1 2 3; do
|
||||||
|
|||||||
Reference in New Issue
Block a user