Tweak run scripts, adjust config/welcome scripts, finalize syncthing integration

This commit is contained in:
KemoNine 2020-08-03 22:24:11 +00:00
parent 66b31f45dc
commit 34188e8721
7 changed files with 36 additions and 10 deletions

View file

@ -5,9 +5,6 @@ WORKDIR /opt/
# need to figure out if arm64/arm64 32bit multilib/arm
COPY piframefleet/arch_detect.sh /opt/
# Copy ansible samples -> /opt
COPY ansible /opt/
# Install and base setup all the things
RUN apk upgrade --update --no-cache && \
apk add python3 curl jq bash unzip && \
@ -46,6 +43,7 @@ VOLUME /lib/modules
ENV ENABLE_SYNCTHING=false
EXPOSE 8384/tcp
EXPOSE 22000/tcp
VOLUME /opt/syncthing
# FileBrowser related 'stuff'
ENV ENABLE_FILEBROWSER=false

26
piframefleet/root/etc/cont-init.d/30-config Normal file → Executable file
View file

@ -1,9 +1,15 @@
#!/usr/bin/with-contenv bash
####################
# Pictures storage
####################
if [ ! -d "/opt/pictures" ] ; then
mkdir /opt/pictures
fi
####################
# WireGuard
####################
if [ "$ENABLE_WIREGUARD" = true ] ; then
ip link del dev test 2>/dev/null
if ip link add dev test type wireguard; then
@ -15,10 +21,22 @@ if [ "$ENABLE_WIREGUARD" = true ] ; then
fi
####################
# Pictures storage
# syncthing
####################
if [ ! -d "/opt/pictures" ]; then
mkdir /opt/pictures
if [ "$ENABLE_SYNCTHING" = true ] ; then
if [ ! -d "/opt/syncthing" ]; then
mkdir /opt/syncthing
fi
ST_CONF="/opt/syncthing/config.xml"
if [ ! -f "$ST_CONF" ]; then
echo "**** Initial Syncthing Config ****"
/usr/bin/syncthing -generate /opt/syncthing
sed -i 's/<address>127.0.0.1:8384<\/address>/<address>0.0.0.0:8384<\/address>/g' /opt/syncthing/config.xml
sed -i 's/<folder id="default" label="Default Folder" path="\/root\/Sync" type="sendreceive" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">/<folder id="piframe-pictures" label="PiFrameFleet Pictures" path="\/opt\/pictures" type="sendonly" rescanIntervalS="86400" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true">/g' /opt/syncthing/config.xml
if [ -d "/root/Sync" ]; then
rm -r /root/Sync
fi
fi
fi
####################

0
piframefleet/root/etc/services.d/_service_control/run Normal file → Executable file
View file

View file

@ -0,0 +1,9 @@
#!/usr/bin/with-contenv bash
if [ "$ENABLE_SYNCTHING" = false ] ; then
exit
fi
/usr/bin/syncthing \
-home="/opt/syncthing" \
-no-browser

0
piframefleet/root/etc/services.d/wireguard/run Normal file → Executable file
View file

View file

@ -13,14 +13,15 @@ sudo docker run -it \
--cap-add=NET_ADMIN \
--cap-add=SYS_MODULE \
-e TZ=UTC \
-e ENABLE_WIREGUARD=true \
-e ENABLE_SYNCTHING=false \
-e ENABLE_WIREGUARD=false \
-e ENABLE_SYNCTHING=true \
-e ENABLE_FILEBROWSER=true \
-p 51820:51820/udp \
-p 51821:51820/udp \
-p 8384:8384/tcp \
-p 22000:22000/tcp \
-p 9191:9191/tcp \
-v /lib/modules:/lib/modules:ro \
-v /var/piframefleet/syncthing:/opt/syncthing \
-v /var/piframefleet/filebrowser:/opt/filebrowser \
-v /var/piframefleet/pictures:/opt/pictures \
piframe/piframefleet:latest