Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[syncthing] Improve configuration #450

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions syncthing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.18.0 - 2024-?-?

* 🔨 Configure Syncthing via environment variables instead of CLI arguments where possible and properly separate config and database/state directories (thanks @salim-b | #450)
* 🔨 Set `/share` as default folder path fallback (fixes #447, @salim-b).

## 1.17.0 - 2023-10-13

* 🔨 Set gui-address to first IP in container (thanks @reedy | #426)
Expand Down
1 change: 0 additions & 1 deletion syncthing/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ When using this add-on to permanently hold your data, put the synced folders ins
- `/data`
- `/media`
- `/share`
- `/config`
- `/ssl`
- `/addons`

Expand Down
10 changes: 9 additions & 1 deletion syncthing/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ FROM $BUILD_FROM
RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
"syncthing=1.25.0-r1"

COPY root /

ENV HOME=/share \
STCONFDIR=/config \
STDATADIR=/data \
salim-b marked this conversation as resolved.
Show resolved Hide resolved
STNODEFAULTFOLDER=1 \
STNORESTART=1 \
STNOUPGRADE=1
salim-b marked this conversation as resolved.
Show resolved Hide resolved

ENTRYPOINT [ "/init" ]
CMD []
COPY root /
10 changes: 5 additions & 5 deletions syncthing/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Syncthing
version: "1.17.0"
version: "1.18.0"
slug: syncthing
description: "Syncthing is a continuous file synchronization program in a
de-centralized way"
Expand All @@ -26,9 +26,9 @@ ingress_port: 8384
panel_title: Syncthing
panel_icon: mdi:sync
map:
- share:rw
- config:rw
- backup:rw
- addon_config:rw
- addons:rw
- ssl:rw
- backup:rw
- media:rw
- share:rw
- ssl:rw
25 changes: 17 additions & 8 deletions syncthing/root/etc/s6-overlay/s6-rc.d/syncthing/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,28 @@
# shellcheck shell=bash
set -e

export STNOUPGRADE=1

bashio::log.info 'Setup config'
mkdir -p /data/config
bashio::log.info 'Intializing Syncthing'

# determine IP address to serve Syncthing's GUI on
ip=$(ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{sub("addr:",""); print $2}' | head -n 1)

if [ -z "$ip" ]
then
ip=0.0.0.0
ip=0.0.0.0
bashio::log.info "Couldn't detect IP address. Falling back to: $ip"
else
bashio::log.info "Detected IP address: $ip"
fi

bashio::log.info "Detected IP Address: $ip"
# move config and DB state from old to new locations if necessary, cf. https://github.com/Poeschl/Hassio-Addons/pull/450
if [ -d /data/config ]
then
for CONF_FILE in config.xml cert.pem key.pem https-cert.pem https-key.pem
do
[ -f "/data/config/${CONF_FILE}" ] && mv -fu "/data/config/${CONF_FILE}" /config/ && rm -f "/data/config/${CONF_FILE}"
done
mv -fu /data/config/* /data/ && rm -f /data/config
fi

bashio::log.info 'Start syncthing'
syncthing --no-browser --no-restart --home=/data/config --gui-address="$ip:8384"
bashio::log.info 'Starting Syncthing'
syncthing --gui-address="$ip:8384" --no-browser
Loading