### Gitea:



#### Créer le paquet:

[Gitea-spk](https://github.com/flipswitchingmonkey/gitea-spk)

##### Installer le paquet:

```bash
cd ~/git/gitea-spk/
sudo synopkg install gitea-1.10.3-linux-amd64.spk
```

Créer un dossier partagé `gitea`, puis éditer les permissions du dossier: 

Permissions -> Utilisateurs du système interne -> gitea lecture /écriture



#### 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;
    }
}
```



Le fichier de config: `/usr/local/gitea/gitea/custom/conf/app.ini`

`/etc/gitea/app.ini` sur le vps mbv



#### Créer un repo sur sur le serveur gitea:

Il est placé ici: `/volume1/gitea/gitea/gitea-repositories/bruno/test.git`

Sur le client, on clone le repo:

```bash
$ ~/Documents/Git git clone bruno@dsm916e:/volume1/gitea/gitea/gitea-repositories/bruno/test.git
```

git remote add origin bruno@dsm916e:/volume1/Repositories/wp2012.git



#### Mise-à-jour:

```bash
#!/bin/bash
GITEA_INSTALLED=`/volume1/@appstore/Gitea/gitea/gitea --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 update available..."
    exit 0
fi

#Install
echo "Installed: "${GITEA_INSTALLED}
echo "Latest: "${GITEA_VERSION}
rm -rf /tmp/gitea
mkdir /tmp/gitea
cd /tmp/gitea
echo "Clone gitea-spk..."
git clone https://github.com/flipswitchingmonkey/gitea-spk.git
cd gitea-spk

echo "Download latest gitea..."
DOWNLOAD_URL=https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64.xz
#echo ${DOWNLOAD_URL}

# sudo opkg install wget (sinon pas de https)
wget ${DOWNLOAD_URL}
# sudo opkg install xz
xz --decompress gitea-*.xz
# sudo opkg install tar (sinon tar: unrecognized option '--exclude=INFO.in')
echo "Create spk package..."
./create_spk.sh

echo "Install spk package..."
sudo synoservice --stop  pkgctl-Gitea

#echo "Backup gitea mysql database..."
#sudo mysqldump -u root admin_gitea > /tmp/$filename

sudo synoservice --status  pkgctl-Gitea
sudo synopkg install /tmp/gitea/gitea-spk/gitea-${GITEA_VERSION}-linux-amd64.spk
sudo synoservice --start  pkgctl-Gitea

exit 1
```

