GithubHelp home page GithubHelp logo

nventiveux / docker-syncthing Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 168 KB

Docker image for syncthing installation for x86 / arm architectures.

License: MIT License

Shell 52.25% Makefile 9.99% Dockerfile 37.76%
docker raspberry-pi syncthing docker-image file-synchronization

docker-syncthing's Introduction

Syncthing Docker image

Build Status

Syncthing Docker image for RaspberryPi / amd64 systems.

Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized.

See Syncthing website for more.

Tested on following archs:

  • x64

Following arch are missing tests:

  • arm32v6
  • armv7

Available image tags

Usage

Run the container manually (select tag according to the target architecture):

{
mkdir -p "${HOME}/Sync";
docker run \
  -d \
  --name syncthing \
  -p 8384:8384/tcp \
  -p 22000:22000/tcp \
  -p 21027:21027/udp \
  -v syncthing_config:/etc/syncthing \
  -v "${HOME}/Sync":/var/lib/syncthing \
  nventiveux/syncthing:latest;
}

Open the administration website with https://localhost:8384/ and connect using admin / admin.

This will make available for syncing all folders within ~/Sync. You may be interested to adapt environment variables SYNCTHING_USER_UID and SYNCTHING_GROUP_GID to match your user UID / GID at the host (verify with id).

Persisting data

Following paths within the container should be persisted:

  • /var/lib/syncthing holds synced content.
  • /etc/syncthing holds the syncthing configuration.

Network ports

  • Default ports:
    • 21027/udp --> Local discovery (see Known issues)
    • 22000/tcp --> Sync protocol
    • 8384/tcp --> Admin interface

Environment variables

You can configure Syncthing injecting following environment variables:

Variable Description Default
SYNCTHING_USER Name of container user syncthing
SYNCTHING_USER_UID Map container user to this UID 1000
SYNCTHING_GROUP Name of container user primary group syncthing
SYNCTHING_GROUP_GID Map container user primary group to this GID 1000
SYNCTHING_ADMIN_USER Admin username admin
SYNCTHING_ADMIN_PASSWORD Admin password admin

Example to set another password for the admin user:

docker run \
  ...
  -e SYNCTHING_ADMIN_PASSWORD="anotherpassword" \
  ...

Known issues

  • Local discovery does not work without --network=host. Need more testing if this can be avoided.

Contribute

Pre-requisites:

  • Python >=3.11
  • Rye
  • make
  • Bash >=4
  • Git >=2.18

Prepare your environment:

make install

Tweak Dockerfile to your convenience.

Note: if you are upgrading Syncthing to a newer version, also sync the config file version !

Commit changes and submit a Pull Request.

Releasing a new version

Bump the version using:

git switch -c release/next
make release version=<VERSION>
git commit -a -m "feat(core): bump syncthing to <VERSION>"
rye run cz bump --changelog <VERSION>
# Open a pull request

References

docker-syncthing's People

Contributors

bigbrozer avatar link-webcreations avatar vbesancon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-syncthing's Issues

Allow to specify user name / UID and group name / GID when running container.

See --user / --group in docker run reference:

New environment variables:

  • SYNCTHING_USER / SYNCTHING_USER_UID
  • SYNCTHING_GROUP / SYNCTHING_GROUP_GID

Create a docker-entrypoint.sh which will use such environment variables to create the user and group dynamically at container runtime instead of during image build.

Unique volume name for all instances in systemd service definition !

The syncthing database volume was named syncthing_data for all instances which can cause big
troubles and instance overlap, etc...

Migration steps

In order to change the existing syncthing_data volume to new naming scheme, you need to backup existing syncthing database:

$ sudo systemctl stop docker-syncthing@<INSTANCE>
$ docker run -it --rm -v /tmp/syncthing_backup:/backup -v syncthing_data:/etc/syncthing nventiveux/docker-alpine-rpi tar zcvf /backup/syncthing_db.tar.gz /etc/syncthing

Backup will be available on host in /tmp/syncthing_backup/syncthing_db.tar.gz. Keep it safe.

Destroy the existing volume:

$ docker volume rm syncthing_data

Update systemd service file and start service again to recreate the volume with correct instance name.
Stop the service and restore the database:

$ docker run -it --rm -v /tmp/syncthing_backup:/backup -v syncthing_$USER_data:/etc/syncthing nventiveux/docker-alpine-rpi sh
sh# ( rm -rf /etc/syncthing/* && cd / && tar zxvf /backup/syncthing_db.tar.gz )

Start the service again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.