Ajout des services Traefik, PostgreSQL et Gitea
This commit is contained in:
29
gitea/.env
Normal file
29
gitea/.env
Normal file
@ -0,0 +1,29 @@
|
||||
COMPOSE_FILE=../postgres/docker-compose.yml:./docker-compose.yml:./docker-compose.override.yml
|
||||
|
||||
# APP
|
||||
|
||||
GITEA_IMAGE=gitea/gitea:1.11.5
|
||||
GITEA_CONTAINER_NAME=gitea
|
||||
GITEA_VOLUME_NAME=gitea
|
||||
GITEA_PROTOCOL=http
|
||||
GITEA_DOMAIN=gitea.lan
|
||||
|
||||
# APP CONFIG
|
||||
# https://docs.gitea.io/en-us/install-with-docker/#environments-variables
|
||||
|
||||
DISABLE_SSH=true
|
||||
RUN_MODE=prod
|
||||
ROOT_URL=${GITEA_PROTOCOL}://${GITEA_DOMAIN}
|
||||
DISABLE_REGISTRATION=true
|
||||
DISABLE_GRAVATAR=true
|
||||
#INSTALL_LOCK=true
|
||||
|
||||
# DATABASE
|
||||
# Voir la description ../postgres/README.md
|
||||
|
||||
POSTGRES_IMAGE=postgres:12.2-alpine
|
||||
POSTGRES_USER=user-example
|
||||
POSTGRES_PASSWORD=password-example
|
||||
POSTGRES_DB=postgres-database-name-example
|
||||
POSTGRES_CONTAINER_NAME=gitea-postgres
|
||||
POSTGRES_VOLUME_NAME=gitea-postgres
|
28
gitea/README.md
Normal file
28
gitea/README.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Gitea
|
||||
|
||||
> Gitea est un service Git auto-hébergé très simple à installer et à utiliser. Il est similaire à GitHub, Bitbucket ou Gitlab.
|
||||
>
|
||||
> <cite>[Documentation][documentation]</cite>
|
||||
|
||||
## Configuration
|
||||
|
||||
TODO
|
||||
|
||||
## Commandes
|
||||
|
||||
```sh
|
||||
$ ./run
|
||||
./run backup : Lancement de la sauvegarde de Gitea
|
||||
./run restore : Restoration de la sauvegarde de Gitea
|
||||
```
|
||||
|
||||
## Liens
|
||||
|
||||
- [Site internet][site]
|
||||
- [Code source][source]
|
||||
- [Docker Hub][dockerhub]
|
||||
|
||||
[documentation]: https://docs.gitea.io/fr-fr/
|
||||
[site]: https://gitea.io
|
||||
[source]: https://github.com/go-gitea/gitea
|
||||
[dockerhub]: https://hub.docker.com/r/gitea/gitea
|
6
gitea/docker-compose.override.yml
Normal file
6
gitea/docker-compose.override.yml
Normal file
@ -0,0 +1,6 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
gitea:
|
||||
ports:
|
||||
- "3000:3000"
|
16
gitea/docker-compose.traefik.yml
Normal file
16
gitea/docker-compose.traefik.yml
Normal file
@ -0,0 +1,16 @@
|
||||
version: "3.8"
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: ${TRAEFIK_NETWORK_NAME}
|
||||
|
||||
services:
|
||||
gitea:
|
||||
labels:
|
||||
traefik.enable: 'true'
|
||||
traefik.docker.network: ${TRAEFIK_NETWORK_NAME}
|
||||
|
||||
traefik.http.routers.gitea.rule: 'Host(`${GITEA_DOMAIN}`)'
|
||||
traefik.http.routers.gitea.entrypoints: 'web'
|
||||
|
||||
traefik.http.services.gitea.loadbalancer.server.port: '3000'
|
25
gitea/docker-compose.yml
Normal file
25
gitea/docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
||||
version: "3.8"
|
||||
|
||||
volumes:
|
||||
gitea:
|
||||
name: ${GITEA_VOLUME_NAME}
|
||||
|
||||
services:
|
||||
gitea:
|
||||
container_name: ${GITEA_CONTAINER_NAME}
|
||||
image: ${GITEA_IMAGE}
|
||||
restart: always
|
||||
environment:
|
||||
# - USER_UID=1000
|
||||
# - USER_GID=1000
|
||||
DB_TYPE: postgres
|
||||
DB_HOST: postgres:5432
|
||||
DB_NAME: ${POSTGRES_DB}
|
||||
DB_USER: ${POSTGRES_USER}
|
||||
DB_PASSWD: ${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- gitea:/data
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
depends_on:
|
||||
- postgres
|
48
gitea/run
Executable file
48
gitea/run
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
. $DIR/../help.sh
|
||||
. $DIR/../postgres/run --only-source
|
||||
|
||||
gitea_help() {
|
||||
echo "./run backup : Lancement de la sauvegarde de Gitea"
|
||||
echo "./run restore : Restoration de la sauvegarde de Gitea"
|
||||
}
|
||||
|
||||
gitea_backup() {
|
||||
script_env
|
||||
BACKUP_DATE_DEFAULT=`date +%Y%m%d_%H%M%S`
|
||||
BACKUP_DATE=${BACKUP_DATE:-$BACKUP_DATE_DEFAULT}
|
||||
backup_folder_create
|
||||
|
||||
POSTGRES_BACKUP_FILE=backups/${BACKUP_DATE}_gitea_postgres.sql
|
||||
postgres_backup
|
||||
|
||||
docker-compose run --rm -v $GITEA_VOLUME_NAME:/data -v $HOME/backups/gitea:/backup gitea tar cvf /backup/${BACKUP_DATE}_gitea_data.tar /data
|
||||
}
|
||||
|
||||
gitea_restore() {
|
||||
script_start
|
||||
script_env
|
||||
echo "🏁 Start restore PostgreSQL database '$POSTGRES_DB' from '$POSTGRES_BACKUP_FILE'"
|
||||
cat $POSTGRES_BACKUP_FILE | docker exec -i $POSTGRES_CONTAINER_NAME psql -U $POSTGRES_USER -d $POSTGRES_DB
|
||||
script_end
|
||||
}
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
if [ "${1}" == "backup" ]; then
|
||||
script_start
|
||||
gitea_backup
|
||||
script_end
|
||||
elif [ "${1}" == "restore" ]; then
|
||||
script_start
|
||||
gitea_restore
|
||||
script_end
|
||||
elif [ "${1}" != "--only-source" ]; then
|
||||
gitea_help
|
||||
fi
|
||||
else
|
||||
gitea_help
|
||||
fi
|
Reference in New Issue
Block a user