Add Gitea service
This commit is contained in:
@@ -1,7 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
usage="Usage: $0 server_name project_root"
|
usage="Usage: $0 server_name project_root"
|
||||||
server_name="${1:?$usage}"
|
server_name="${1:?$usage}"
|
||||||
root="${2:?$usage}"
|
root="${2:?$usage}"
|
||||||
sed -Ei "s/(^[[:blank:]]*server_name [^_][^.]*\.)[^;]*/\1${server_name}/" "$root"/services/nginx/default.conf
|
sed -Ei "s/(^[[:blank:]]*server_name [^_][^.]*\.)[^;]*/\1${server_name}/" "$root"/services/nginx/default.conf
|
||||||
sed -Ei "s/(^OPENPROJECT_HOST__NAME=[^.]*\.).*/\1${server_name}/" "$root"/.env
|
sed -Ei "s/(^OPENPROJECT_HOST__NAME=[^.]*\.).*/\1${server_name}/" "$root"/.env
|
||||||
|
|
||||||
|
# Configure hostname for Gitea
|
||||||
|
# Note that this works only if you use a docker volume named `tvcloud_gitea` (this project default).
|
||||||
|
gitea_conf_file=/var/lib/docker/volumes/tvcloud_gitea/_data/gitea/conf/app.init
|
||||||
|
if [[ ! -e $gitea_conf_file ]]; then
|
||||||
|
mkdir -p $(dirname "$gitea_conf_file")
|
||||||
|
touch "$gitea_conf_file"
|
||||||
|
fi
|
||||||
|
if grep -Eq "\[server\] ROOT_URL = https://gitea\." $gitea_conf_file; then
|
||||||
|
sed -Ei "s/(\[server\] ROOT_URL = https:\/\/gitea\.).*/\1$server_name/" "$gitea_conf_file"
|
||||||
|
else
|
||||||
|
echo "[server] ROOT_URL = https://gitea.${server_name}/" >>"$gitea_conf_file"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -5,12 +5,16 @@ networks:
|
|||||||
nextcloud-backend:
|
nextcloud-backend:
|
||||||
openproject-frontend:
|
openproject-frontend:
|
||||||
openproject-backend:
|
openproject-backend:
|
||||||
|
gitea-frontend:
|
||||||
|
gitea-backend:
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
nextcloud-db:
|
nextcloud-db:
|
||||||
nextcloud:
|
nextcloud:
|
||||||
openproject-db:
|
openproject-db:
|
||||||
openproject:
|
openproject:
|
||||||
|
gitea-db:
|
||||||
|
gitea:
|
||||||
|
|
||||||
x-op-restart-policy: &restart_policy
|
x-op-restart-policy: &restart_policy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -41,6 +45,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- nextcloud-frontend
|
- nextcloud-frontend
|
||||||
- openproject-frontend
|
- openproject-frontend
|
||||||
|
- gitea-frontend
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
- "443:443"
|
||||||
@@ -48,6 +53,8 @@ services:
|
|||||||
- nextcloud:/var/www/html:ro
|
- nextcloud:/var/www/html:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
- nextcloud
|
- nextcloud
|
||||||
|
- openproject
|
||||||
|
- gitea
|
||||||
|
|
||||||
# NextCloud
|
# NextCloud
|
||||||
|
|
||||||
@@ -78,6 +85,43 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- nextcloud-db:/var/lib/mysql
|
- nextcloud-db:/var/lib/mysql
|
||||||
|
|
||||||
|
# Gitea
|
||||||
|
|
||||||
|
gitea:
|
||||||
|
image: docker.gitea.com/gitea:1.25.2
|
||||||
|
environment:
|
||||||
|
- USER_UID=1000
|
||||||
|
- USER_GID=1000
|
||||||
|
- GITEA__database__DB_TYPE=postgres
|
||||||
|
- GITEA__database__HOST=gitea-db:5432
|
||||||
|
- GITEA__database__NAME=gitea
|
||||||
|
- GITEA__database__USER=gitea
|
||||||
|
- GITEA__database__PASSWD=gitea
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- gitea-frontend
|
||||||
|
- gitea-backend
|
||||||
|
volumes:
|
||||||
|
- gitea:/data
|
||||||
|
- /etc/timezone:/etc/timezones:ro
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
ports:
|
||||||
|
- "222:22"
|
||||||
|
depends_on:
|
||||||
|
- gitea-db
|
||||||
|
|
||||||
|
gitea-db:
|
||||||
|
image: docker.io/library/postgres:14
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=gitea
|
||||||
|
- POSTGRES_PASSWORD=gitea
|
||||||
|
- POSTGRES_DB=gitea
|
||||||
|
networks:
|
||||||
|
- gitea-backend
|
||||||
|
volumes:
|
||||||
|
- gitea-db:/var/lib/postgresql/data
|
||||||
|
|
||||||
# OpenProject
|
# OpenProject
|
||||||
|
|
||||||
openproject:
|
openproject:
|
||||||
|
|||||||
34
readme.md
34
readme.md
@@ -1,24 +1,31 @@
|
|||||||
# tvcloud
|
# tvcloud
|
||||||
|
|
||||||
This project is a personal cloud of services:
|
This project is a personal cloud of services:
|
||||||
- NextCloud
|
- [NextCloud](https://nextcloud.com/)
|
||||||
- OpenProject
|
- [OpenProject](https://www.openproject.org/)
|
||||||
|
- [Gitea](https://about.gitea.com/products/gitea/)
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
|
|
||||||
1. Generate a self-signed certificate for the proxy.
|
1. Generate a self-signed certificate for the proxy.
|
||||||
|
|
||||||
```
|
```
|
||||||
openssl genpkey -algorithm RSA -out server.key
|
host=tvcloud.fr
|
||||||
openssl req -new -x509 -key server.key -out server.crt -days 365
|
mkcert \
|
||||||
|
-cert-file services/nginx/server.crt \
|
||||||
|
-key-file services/nginx/server.key \
|
||||||
|
gitea.$host nextcloud.$host openproject.$host $host 127.0.0.1 ::1
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Make a `.env` file for `docker-compose.yaml`. See `.example.env`.
|
2. Make a `.env` file (for `docker compose`).
|
||||||
|
|
||||||
|
See `.example.env`.
|
||||||
|
|
||||||
3. Configure the host name.
|
3. Configure the host name.
|
||||||
|
|
||||||
```
|
```
|
||||||
./configure.bash HOSTNAME .
|
host=tvcloud.fr
|
||||||
|
sudo ./configure.bash $host .
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Start the services.
|
4. Start the services.
|
||||||
@@ -26,18 +33,3 @@ openssl req -new -x509 -key server.key -out server.crt -days 365
|
|||||||
```
|
```
|
||||||
sudo docker compose up --detach
|
sudo docker compose up --detach
|
||||||
```
|
```
|
||||||
|
|
||||||
# OpenProject
|
|
||||||
|
|
||||||
- [Upgrade](https://www.openproject.org/docs/installation-and-operations/installation/docker-compose/#upgrade)
|
|
||||||
- [Backup](https://www.openproject.org/docs/installation-and-operations/installation/docker-compose/#backup)
|
|
||||||
|
|
||||||
# Joplin
|
|
||||||
|
|
||||||
- Update/Install:
|
|
||||||
|
|
||||||
```
|
|
||||||
wget -O - https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh | bash
|
|
||||||
```
|
|
||||||
|
|
||||||
You can then [synchronize it with NextCloud](https://joplinapp.org/help/apps/sync/nextcloud/).
|
|
||||||
|
|||||||
@@ -38,10 +38,30 @@ server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name gitea.tvcloud.fr;
|
||||||
|
|
||||||
|
ssl_certificate /etc/ssl/crt/server.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/crt/server.key;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
client_max_body_size 512M;
|
||||||
|
proxy_set_header Connection $http_connection;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
proxy_pass http://gitea:3000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf
|
# https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name nextcloud.tvcloud.fr;
|
server_name nextcloud.localhost;
|
||||||
|
|
||||||
ssl_certificate /etc/ssl/crt/server.crt;
|
ssl_certificate /etc/ssl/crt/server.crt;
|
||||||
ssl_certificate_key /etc/ssl/crt/server.key;
|
ssl_certificate_key /etc/ssl/crt/server.key;
|
||||||
|
|||||||
Reference in New Issue
Block a user