11-11-2021
This commit is contained in:
332
docs/Synology/dsm7/gitea.md
Normal file
332
docs/Synology/dsm7/gitea.md
Normal file
@@ -0,0 +1,332 @@
|
||||
# Gitea
|
||||
|
||||
|
||||
|
||||
Le paquet [gitea-spk](https://github.com/flipswitchingmonkey/gitea-spk) n'a pas été mis à jour pour DSM7. Il faut donc installer Gitea d'après les [binaires](https://docs.gitea.io/en-us/install-from-binary/).
|
||||
|
||||
|
||||
|
||||
### Installation:
|
||||
|
||||
Déclarer le répertoire d'installation dans `.bashrc`:
|
||||
|
||||
```
|
||||
export GITEA_WORK_DIR=/var/services/homes/bruno/gitea
|
||||
```
|
||||
|
||||
Préparer les répertoires:
|
||||
|
||||
```bash
|
||||
# dossier d'installation
|
||||
mkdir -p $GITEA_WORK_DIR/{custom,data,log}
|
||||
#chown -R git:git $GITEA_WORK_DIR/
|
||||
chown -R bruno:users $GITEA_WORK_DIR/
|
||||
chmod -R 750 $GITEA_WORK_DIR/
|
||||
|
||||
# dossier de configuration
|
||||
mkdir /etc/gitea
|
||||
#chown root:git /etc/gitea
|
||||
chown bruno:users /etc/gitea
|
||||
chmod 770 /etc/gitea
|
||||
```
|
||||
|
||||
Télécharger Gitea
|
||||
|
||||
```bash
|
||||
wget -O gitea https://dl.gitea.io/gitea/1.15.4/gitea-1.15.4-linux-amd64
|
||||
chmod +x gitea
|
||||
mv gitea /usr/local/bin/
|
||||
```
|
||||
|
||||
Lancer Gitea
|
||||
|
||||
```bash
|
||||
gitea web
|
||||
|
||||
GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Configuration:
|
||||
|
||||
#### Accéder au site:
|
||||
|
||||
http://localhost:3000 . Si Safari ne peut y accéder parce que la connexion n'est pas sécurisée (*HSTS Policy*):
|
||||
|
||||
1. `command + ,`
|
||||
2. **Confidentialité** -> **Gérer les données de sites web**...
|
||||
3. Chercher *localhost*
|
||||
4. Clic **Supprimer**
|
||||
|
||||
|
||||
|
||||
DSM -> Portail des applications -> Proxy inversé
|
||||
|
||||
| | Source | Destination |
|
||||
| ---------- | -------------------- | ----------- |
|
||||
| Protocole | HTTPS | HTTP |
|
||||
| Nom d'hôte | clicclac.synology.me | localhost |
|
||||
| Port | 3001 | 3000 |
|
||||
|
||||
Apache:
|
||||
|
||||
```bash
|
||||
<VirtualHost *:80>
|
||||
ProxyPreserveHost On
|
||||
ProxyRequests off
|
||||
ProxyPass / http://localhost:3000/
|
||||
ProxyPassReverse / http://localhost:3000/
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
Nginx:
|
||||
|
||||
```bash
|
||||
server {
|
||||
listen 80;
|
||||
server_name git.example.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3000;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Configuration:
|
||||
|
||||
Base: sqlite3 (impossible de se connecter à mariadb)
|
||||
|
||||
PATH: = /var/services/homes/bruno/gitea/data/gitea.db
|
||||
|
||||
|
||||
|
||||
Une fois Gitea installé et configuré, on peut sécuriser le fichier de configuration:
|
||||
|
||||
```bash
|
||||
chmod 750 /etc/gitea
|
||||
chmod 640 /etc/gitea/app.ini
|
||||
```
|
||||
|
||||
|
||||
|
||||
Les repos sont stockés ici:
|
||||
|
||||
```bash
|
||||
ROOT = /var/services/homes/bruno/gitea/data/gitea-repositories
|
||||
```
|
||||
|
||||
et les logs là:
|
||||
|
||||
```bash
|
||||
ROOT_PATH = /var/services/homes/bruno/gitea/log
|
||||
```
|
||||
|
||||
|
||||
|
||||
On peut lancer gitea depuis un script:
|
||||
|
||||
```bash
|
||||
$ /usr/local/bin/gitea web -c /etc/gitea/app.ini
|
||||
```
|
||||
|
||||
ou depuis un service.
|
||||
|
||||
|
||||
|
||||
### Service
|
||||
|
||||
A installer dans `/etc/systemd/system`:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Gitea (Git with a cup of tea)
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
###
|
||||
# Don't forget to add the database service dependencies
|
||||
###
|
||||
#
|
||||
#Wants=mysql.service
|
||||
#After=mysql.service
|
||||
#
|
||||
#Wants=mariadb.service
|
||||
#After=mariadb.service
|
||||
#
|
||||
#Wants=postgresql.service
|
||||
#After=postgresql.service
|
||||
#
|
||||
#Wants=memcached.service
|
||||
#After=memcached.service
|
||||
#
|
||||
#Wants=redis.service
|
||||
#After=redis.service
|
||||
#
|
||||
###
|
||||
# If using socket activation for main http/s
|
||||
###
|
||||
#
|
||||
#After=gitea.main.socket
|
||||
#Requires=gitea.main.socket
|
||||
#
|
||||
###
|
||||
# (You can also provide gitea an http fallback and/or ssh socket too)
|
||||
#
|
||||
# An example of /etc/systemd/system/gitea.main.socket
|
||||
###
|
||||
##
|
||||
## [Unit]
|
||||
## Description=Gitea Web Socket
|
||||
## PartOf=gitea.service
|
||||
##
|
||||
## [Socket]
|
||||
## Service=gitea.service
|
||||
## ListenStream=<some_port>
|
||||
## NoDelay=true
|
||||
##
|
||||
## [Install]
|
||||
## WantedBy=sockets.target
|
||||
##
|
||||
###
|
||||
|
||||
[Service]
|
||||
# Modify these two values and uncomment them if you have
|
||||
# repos with lots of files and get an HTTP error 500 because
|
||||
# of that
|
||||
###
|
||||
#LimitMEMLOCK=infinity
|
||||
#LimitNOFILE=65535
|
||||
RestartSec=2s
|
||||
Type=simple
|
||||
User=bruno
|
||||
Group=users
|
||||
WorkingDirectory=/var/services/homes/bruno/gitea/
|
||||
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
|
||||
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
|
||||
#RuntimeDirectory=gitea
|
||||
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
|
||||
Restart=always
|
||||
Environment=USER=bruno HOME=/var/services/homes/bruno GITEA_WORK_DIR=/var/services/homes/bruno/gitea
|
||||
# If you install Git to directory prefix other than default PATH (which happens
|
||||
# for example if you install other versions of Git side-to-side with
|
||||
# distribution version), uncomment below line and add that prefix to PATH
|
||||
# Don't forget to place git-lfs binary on the PATH below if you want to enable
|
||||
# Git LFS support
|
||||
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
|
||||
# If you want to bind Gitea to a port below 1024, uncomment
|
||||
# the two values below, or use socket activation to pass Gitea its ports as above
|
||||
###
|
||||
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
#AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
###
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
Activer le service gitea au démarrage:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl enable gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
Démarrer le service gitea:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl start gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
Vérifier le status de gitea:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl status -l gitea
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ps auxw | grep gitea
|
||||
bruno 8220 0.8 6.2 2038820 122672 ? Ssl 20:26 0:02 /usr/local/bin/gitea web --config /etc/gitea/app.ini
|
||||
bruno 9790 0.0 0.0 2860 184 pts/1 D+ 20:32 0:00 grep gitea
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Mise-à-jour
|
||||
|
||||
Depuis un script `dsm7-gitea-update.sh`:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
GITEA_BIN=`which gitea`
|
||||
if [ "$GITEA_BIN" == "*gitea*" ]; then
|
||||
echo "Gitea is not installed..."
|
||||
exit 0
|
||||
fi
|
||||
GITEA_INSTALLED=`$GITEA_BIN --version | cut -d \ -f 3`
|
||||
|
||||
LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/go-gitea/gitea/releases/latest`
|
||||
#https://github.com/go-gitea/gitea/releases/tag/v1.11.3
|
||||
|
||||
#echo LATEST_URL = ${LATEST_URL}
|
||||
GITEA_VERSION=${LATEST_URL##*/v}
|
||||
|
||||
if [ "${GITEA_INSTALLED}" != "${GITEA_VERSION}" ]; then
|
||||
echo "No Gitea update available..."
|
||||
exit 0
|
||||
|
||||
else
|
||||
echo "Installed: "${GITEA_INSTALLED}
|
||||
echo "Latest: "${GITEA_VERSION}
|
||||
|
||||
|
||||
a=$(echo -e "Do you wanna update Gitea to ${GITEA_VERSION} ? (y/n)")
|
||||
read -p "$a" choice
|
||||
|
||||
if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then
|
||||
|
||||
rm -rf /tmp/gitea
|
||||
mkdir /tmp/gitea
|
||||
cd /tmp/gitea
|
||||
|
||||
sudo systemctl stop gitea
|
||||
|
||||
echo "Download latest Gitea..."
|
||||
GITEA_ARCHIVE=gitea-${GITEA_VERSION}-linux-amd64.xz
|
||||
#DOWNLOAD_URL=https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64.xz
|
||||
DOWNLOAD_URL=https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/${GITEA_ARCHIVE}
|
||||
echo ${DOWNLOAD_URL}
|
||||
|
||||
wget -P /tmp/gitea ${DOWNLOAD_URL}
|
||||
# sudo opkg install xz
|
||||
# sudo opkg install tar (sinon tar: unrecognized option '--exclude=INFO.in')
|
||||
xz --decompress ${GITEA_ARCHIVE}
|
||||
|
||||
echo "Installing Gitea ${GITEA_VERSION}..."
|
||||
filename="${GITEA_ARCHIVE%.*}"
|
||||
|
||||
if [[ "$filename" =~ gitea ]]; then
|
||||
mv $filename gitea
|
||||
sudo mv gitea `dirname "$GITEA_BIN"`
|
||||
fi
|
||||
sudo chmod +x ${GITEA_BIN}
|
||||
sudo chown root:root ${GITEA_BIN}
|
||||
|
||||
sudo systemctl start gitea
|
||||
|
||||
sudo systemctl status gitea
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 1
|
||||
```
|
||||
|
||||
34
docs/Synology/dsm7/nextcloud.md
Normal file
34
docs/Synology/dsm7/nextcloud.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Nextcloud
|
||||
|
||||
|
||||
|
||||
https://blog.viking-studios.net/en/nextcloud-hub-optimization-on-a-synology-diskstation-with-dsm-6/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
config.php
|
||||
|
||||
```
|
||||
'memcache.local' => '\OC\Memcache\APCu',
|
||||
'memcache.distributed' => '\\OC\\Memcache\\Redis',
|
||||
'redis' =>
|
||||
array (
|
||||
'host' => '127.0.0.1',
|
||||
'port' => '6379',
|
||||
'timeout' => '0',
|
||||
'dbindex' => '0',
|
||||
),
|
||||
'memcache.locking' => '\OC\Memcache\Redis',
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
[apc]
|
||||
apc.enable_cli=1
|
||||
```
|
||||
|
||||
@@ -12,6 +12,27 @@ Python 3.8.8
|
||||
|
||||
$ which python
|
||||
/bin/python
|
||||
|
||||
# Les modules sont installés là:
|
||||
# /usr/lib/python3.8/site-packages
|
||||
# /volume1/homes/bruno/.local/lib/python3.8/site-packages
|
||||
|
||||
$ find / -iname "site-packages" -type d -print 2>/dev/null
|
||||
```
|
||||
|
||||
|
||||
|
||||
Python 2 est aussi installé:
|
||||
|
||||
```bash
|
||||
$ python2 -V
|
||||
Python 2.7.18
|
||||
|
||||
$ which python2
|
||||
/usr/local/bin/python2
|
||||
|
||||
# Les modules sont installés là:
|
||||
# /usr/local/lib/python2.7/site-packages
|
||||
```
|
||||
|
||||
|
||||
@@ -42,6 +63,10 @@ Local installation:
|
||||
```bash
|
||||
$ which pip3
|
||||
/var/services/homes/bruno/.local/bin/pip3
|
||||
|
||||
bruno@DS916:~/.local/bin $ pip --version
|
||||
bruno@DS916:~/.local/bin $ pip3 --version
|
||||
pip 21.1.3 from /var/services/homes/bruno/.local/lib/python3.8/site-packages/pip (python 3.8)
|
||||
```
|
||||
|
||||
|
||||
|
||||
58
docs/Synology/dsm7/redis.md
Normal file
58
docs/Synology/dsm7/redis.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Redis
|
||||
|
||||
|
||||
|
||||
https://digitalboxweb.wordpress.com/2020/02/01/redis-sur-nas-synology/
|
||||
|
||||
|
||||
|
||||
1. Ajouter le repo DigitalBox comme source de paquets (http://digital.box.free.fr/sspks)
|
||||
|
||||
2. Depuis le Centre de paquets, installer le paquet Redis.
|
||||
|
||||
3. Vérifier que Redis est correctement installé:
|
||||
|
||||
```bash
|
||||
$ cd /var/packages/redis/target/bin
|
||||
total 3676
|
||||
drwxr-xr-x 1 sc-redis sc-redis 160 Jul 26 09:43 .
|
||||
drwxr-xr-x 1 sc-redis sc-redis 18 Nov 10 09:21 ..
|
||||
-rwxr-xr-x 1 sc-redis sc-redis 892760 Jul 26 09:43 redis-benchmark
|
||||
lrwxrwxrwx 1 sc-redis sc-redis 12 Jul 26 09:43 redis-check-aof -> redis-server
|
||||
lrwxrwxrwx 1 sc-redis sc-redis 12 Jul 26 09:43 redis-check-rdb -> redis-server
|
||||
-rwxr-xr-x 1 sc-redis sc-redis 835832 Jul 26 09:43 redis-cli
|
||||
lrwxrwxrwx 1 sc-redis sc-redis 12 Jul 26 09:43 redis-sentinel -> redis-server
|
||||
-rwxr-xr-x 1 sc-redis sc-redis 2018008 Jul 26 09:43 redis-server
|
||||
|
||||
$ ./redis-cli
|
||||
127.0.0.1:6379> ping
|
||||
PONG
|
||||
```
|
||||
|
||||
4. Activer Redis dans PHP:
|
||||
|
||||
Redis n'est pas proposé dans les extensions, bien que le module soit présent..
|
||||
|
||||
```bash
|
||||
$ ls /volume1/@appstore/PHP7.3/usr/local/lib/php73/modules/redis.so
|
||||
/volume1/@appstore/PHP7.3/usr/local/lib/php73/modules/redis.so
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo nano /usr/local/etc/php73/cli/conf.d/extension.ini
|
||||
|
||||
# Ajouter la ligne extension = redis.so juste après posix.po
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo nano /volume1/@appstore/PHP7.3/misc/extension_list.json
|
||||
|
||||
# Ajouter le bloc suivant après le bloc posix
|
||||
"redis": {
|
||||
"enable_default": true,
|
||||
"desc": "The phpredis extension provides an API for communicating with the Redis key-value store."
|
||||
},
|
||||
```
|
||||
|
||||
5. Redis est maintenant disponible dans les extensions PHP. On l'active.
|
||||
|
||||
Reference in New Issue
Block a user