mirror of
https://github.com/YunoHost-Apps/syncthing_ynh.git
synced 2024-09-03 20:26:23 +02:00
commit 5
This commit is contained in:
parent
77d261b2d4
commit
773a8f533d
9 changed files with 248 additions and 0 deletions
16
TODO
Normal file
16
TODO
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
- finir les scripts: install, remove, upgrade
|
||||||
|
- on crée un utilisateur spécifique pour lancer l'exécutable: syncthingd
|
||||||
|
- le dossier sera /home/yunohost.syncthing/ est le $HOME du user syncthingd
|
||||||
|
- le dossier sera /home/yunohost.syncthing/bin pour le binaire
|
||||||
|
- le dossier sera /home/yunohost.syncthing/sync pour créer des dossiers de synchro (à revoir à l'usage)
|
||||||
|
ces dossiers appartiennent à syncthingd
|
||||||
|
|
||||||
|
- écrire le script pour le service syncthing
|
||||||
|
|
||||||
|
|
||||||
|
wget https://github.com/syncthing/syncthing/releases/download/v$version/syncthing-linux-amd64-v$version.tar.gz
|
||||||
|
|
||||||
|
tar xvf syncthing-linux-amd64-v$version.tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
cd syncthing-linux-amd64-v$version
|
19
conf/nginx.conf
Normal file
19
conf/nginx.conf
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
location PATHTOCHANGE/syncthing {
|
||||||
|
proxy_pass http://127.0.0.1:8080PATHTOCHANGE/syncthing;
|
||||||
|
|
||||||
|
# Include SSOWAT user panel.
|
||||||
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
more_clear_input_headers 'Accept-Encoding';
|
||||||
|
}
|
||||||
|
location PATHTOCHANGE/ {
|
||||||
|
proxy_pass http://127.0.0.1:8080/;
|
||||||
|
}
|
||||||
|
location PATHTOCHANGE/downloads {
|
||||||
|
alias /home/yunohost.syncthing/completed/;
|
||||||
|
autoindex on;
|
||||||
|
autoindex_exact_size off;
|
||||||
|
|
||||||
|
# Include SSOWAT user panel.
|
||||||
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
more_clear_input_headers 'Accept-Encoding';
|
||||||
|
}
|
35
manifest.json
Normal file
35
manifest.json
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"name": "Syncthing",
|
||||||
|
"id": "syncthing",
|
||||||
|
"description": {
|
||||||
|
"en": "Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized.",
|
||||||
|
"fr": "Syncthing remplace les services propriétaires de synchro et de cloud avec quelque chose d'ouvert, digne de confiance et décentralisée."
|
||||||
|
},
|
||||||
|
"url": "https://syncthing.net/",
|
||||||
|
"maintainer": {
|
||||||
|
"name": "txmrl",
|
||||||
|
"email": "txmrl@txmrl.net"
|
||||||
|
},
|
||||||
|
"multi_instance": "false",
|
||||||
|
"arguments": {
|
||||||
|
"install": [
|
||||||
|
{
|
||||||
|
"name": "domain",
|
||||||
|
"type": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a domain for Syncthing"
|
||||||
|
},
|
||||||
|
"example": "domain.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"type": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for Syncthing"
|
||||||
|
},
|
||||||
|
"example": "/syncthing",
|
||||||
|
"default": "/syncthing"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
51
scripts/install
Normal file
51
scripts/install
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$1
|
||||||
|
path=$2
|
||||||
|
|
||||||
|
version="0.10.29"
|
||||||
|
|
||||||
|
sudo yunohost app checkurl $domain$path -a syncthing
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove trailing "/" for next commands
|
||||||
|
path=${path%/}
|
||||||
|
|
||||||
|
# Check port availability
|
||||||
|
sudo yunohost app checkport 8080
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sudo yunohost app checkport 22000
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Open port in firewall
|
||||||
|
sudo yunohost firewall allow TCP 22000 > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Make directories and set rights
|
||||||
|
#~ sudo mkdir -p /home/yunohost.syncthing/{bin,sync}
|
||||||
|
#~ sudo chown -R debian-syncthing:www-data /home/yunohost.syncthing/
|
||||||
|
#~ sudo chown -R debian-syncthing:debian-syncthing /home/yunohost.syncthing/progress
|
||||||
|
#~ sudo find /home/yunohost.syncthing/ -type f | while read LINE; do sudo chmod 640 "$LINE" ; done
|
||||||
|
#~ sudo find /home/yunohost.syncthing/ -type d | while read LINE; do sudo chmod 750 "$LINE" ; done
|
||||||
|
|
||||||
|
|
||||||
|
# Install official debian package
|
||||||
|
## Ici il faut ajouter le code pour télécharger l'archive depuis le github de syncthing
|
||||||
|
## créer un utilisateur pour lancer syncthing
|
||||||
|
#~ sudo apt-get install syncthing-daemon -y -qq
|
||||||
|
|
||||||
|
|
||||||
|
# Monitor service
|
||||||
|
#~ sudo yunohost service add syncthing-daemon
|
||||||
|
|
||||||
|
# Configure Nginx and reload
|
||||||
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/syncthing.conf
|
||||||
|
sudo service nginx reload
|
||||||
|
echo $?
|
14
scripts/remove
Normal file
14
scripts/remove
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sudo service syncthing-daemon stop
|
||||||
|
sudo yunohost firewall disallow TCP 22000
|
||||||
|
sudo yunohost service remove syncthing-daemon
|
||||||
|
domain=$(sudo yunohost app setting syncthing domain)
|
||||||
|
|
||||||
|
sudo rm /etc/nginx/conf.d/$domain.d/syncthing.conf
|
||||||
|
sudo rm -rf /home/yunohost.syncthing
|
||||||
|
|
||||||
|
sudo apt-get remove -y -qq syncthing-daemon
|
||||||
|
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app ssowatconf
|
26
scripts/upgrade
Normal file
26
scripts/upgrade
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$(sudo yunohost app setting syncthing domain)
|
||||||
|
path=$(sudo yunohost app setting syncthing path)
|
||||||
|
|
||||||
|
# Remove trailing "/" for next commands
|
||||||
|
path=${path%/}
|
||||||
|
|
||||||
|
# Open port in firewall
|
||||||
|
sudo yunohost firewall allow TCP 22000 > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Upgrade official debian package
|
||||||
|
sudo apt-get install syncthing-daemon -y -qq
|
||||||
|
|
||||||
|
# Make directories and set rights
|
||||||
|
sudo mkdir -p /home/yunohost.syncthing//{bin,sync}
|
||||||
|
sudo chown -R debian-syncthing:www-data /home/yunohost.syncthing/
|
||||||
|
sudo chown -R debian-syncthing:debian-syncthing /home/yunohost.syncthing/progress
|
||||||
|
sudo find /home/yunohost.syncthing/ -type f | while read LINE; do sudo chmod 640 "$LINE" ; done
|
||||||
|
sudo find /home/yunohost.syncthing/ -type d | while read LINE; do sudo chmod 750 "$LINE" ; done
|
||||||
|
|
||||||
|
# Configure Nginx and reload
|
||||||
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/syncthing.conf
|
||||||
|
sudo service nginx reload
|
BIN
sources/toolbar-downloads.png
Normal file
BIN
sources/toolbar-downloads.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
9
sources/ynh_common.css
Normal file
9
sources/ynh_common.css
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
/* Inserted by Yunohost install script */
|
||||||
|
div#toolbar > * {
|
||||||
|
background-position: center center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
div#toolbar > #toolbar-downloads {
|
||||||
|
background-image: url("images/toolbar-downloads.png");
|
||||||
|
}
|
78
syncthing.man
Normal file
78
syncthing.man
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
Usage:
|
||||||
|
syncthing [options]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-generate="" Generate key and config in specified dir, then exit
|
||||||
|
-gui-address="" Override GUI address
|
||||||
|
-gui-apikey="" Override GUI API key
|
||||||
|
-gui-authentication="" Override GUI authentication; username:password
|
||||||
|
-home="" Set configuration directory
|
||||||
|
-logflags="2" Select information in log line prefix
|
||||||
|
-no-browser Do not start browser
|
||||||
|
-no-restart Do not restart; just exit
|
||||||
|
-reset Prepare to resync from cluster
|
||||||
|
-upgrade Perform upgrade
|
||||||
|
-upgrade-check Check for available upgrade
|
||||||
|
-upgrade-to="" Force upgrade directly from specified URL
|
||||||
|
-version Show version
|
||||||
|
|
||||||
|
|
||||||
|
The default configuration directory is:
|
||||||
|
|
||||||
|
/home/lahire/.config/syncthing
|
||||||
|
|
||||||
|
|
||||||
|
The -logflags value is a sum of the following:
|
||||||
|
|
||||||
|
1 Date
|
||||||
|
2 Time
|
||||||
|
4 Microsecond time
|
||||||
|
8 Long filename
|
||||||
|
16 Short filename
|
||||||
|
|
||||||
|
I.e. to prefix each log line with date and time, set -logflags=3 (1 + 2 from
|
||||||
|
above). The value 0 is used to disable all of the above. The default is to
|
||||||
|
show time only (2).
|
||||||
|
|
||||||
|
|
||||||
|
Development Settings
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
The following environment variables modify syncthing's behavior in ways that
|
||||||
|
are mostly useful for developers. Use with care.
|
||||||
|
|
||||||
|
STGUIASSETS Directory to load GUI assets from. Overrides compiled in assets.
|
||||||
|
|
||||||
|
STTRACE A comma separated string of facilities to trace. The valid
|
||||||
|
facility strings are:
|
||||||
|
|
||||||
|
- "beacon" (the beacon package)
|
||||||
|
- "discover" (the discover package)
|
||||||
|
- "events" (the events package)
|
||||||
|
- "files" (the files package)
|
||||||
|
- "net" (the main package; connections & network messages)
|
||||||
|
- "model" (the model package)
|
||||||
|
- "scanner" (the scanner package)
|
||||||
|
- "stats" (the stats package)
|
||||||
|
- "upnp" (the upnp package)
|
||||||
|
- "xdr" (the xdr package)
|
||||||
|
- "all" (all of the above)
|
||||||
|
|
||||||
|
STPROFILER Set to a listen address such as "127.0.0.1:9090" to start the
|
||||||
|
profiler with HTTP access.
|
||||||
|
|
||||||
|
STCPUPROFILE Write a CPU profile to cpu-$pid.pprof on exit.
|
||||||
|
|
||||||
|
STHEAPPROFILE Write heap profiles to heap-$pid-$timestamp.pprof each time
|
||||||
|
heap usage increases.
|
||||||
|
|
||||||
|
STBLOCKPROFILE Write block profiles to block-$pid-$timestamp.pprof every 20
|
||||||
|
seconds.
|
||||||
|
|
||||||
|
STPERFSTATS Write running performance statistics to perf-$pid.csv. Not
|
||||||
|
supported on Windows.
|
||||||
|
|
||||||
|
STNOUPGRADE Disable automatic upgrades.
|
||||||
|
|
||||||
|
GOMAXPROCS Set the maximum number of CPU cores to use. Defaults to all
|
||||||
|
available CPU cores.
|
Loading…
Add table
Reference in a new issue