Compare commits

...

27 Commits

Author SHA1 Message Date
a88aa78561 add postgresdb alternative
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-09 16:50:46 +01:00
3wc
a1dde38834 Switch to <recipe>.example.com 2022-11-24 10:53:27 -08:00
f35689989c Merge pull request 'Adding Oauth2 options and up on versions' (#29) from javielico/gitea:master into master
Some checks failed
continuous-integration/drone/tag Build is failing
Reviewed-on: #29
2022-11-13 21:54:01 +00:00
1d4dc8e8bb Bump version up on compose.yml 2022-11-13 00:45:23 +00:00
f85eaed26e Adding GITEA_OAUTH2_CLIENT_ENABLED to compose.yml and .env.sample 2022-11-11 16:47:52 +00:00
fbb36d5598 Up versions of gitea and mariadb 2022-11-11 16:15:34 +00:00
13c8af2356 Version bump 2022-11-11 16:11:33 +00:00
a4cddb7b09 Adding vars to compose.yml 2022-11-11 16:10:38 +00:00
daf24d521f Adding variables to .env.sample 2022-11-11 16:09:27 +00:00
b92ad0d45c Add oauth2_client options 2022-11-11 16:04:33 +00:00
af97db8082 chore: publish 1.3.0+1.17.2-rootless release 2022-09-07 14:45:39 +02:00
cd39f5fc82 chore: publish 1.2.1+1.16.8-rootless release 2022-06-01 09:46:21 +02:00
aa84c25a83 Bump app.ini version in abra.sh 2022-05-01 02:39:58 +00:00
cd3ded3c4e Add disable_gravatar and federated_avatar 2022-04-28 17:50:51 -07:00
0cad878de5 use domain env var 2022-03-27 21:08:50 +02:00
3a47a4164e chore: publish 1.2.0+1.16.3-rootless release 2022-03-09 12:01:02 +01:00
8ead189fde chore: publish 1.1.3+1.15.10-rootless release 2022-01-18 10:26:40 +01:00
c8ea311d7d fix: point to new drone instance [ci skip] 2021-12-31 16:31:34 +01:00
b2f29bc99e docs(README): how to enable SSH 2021-12-31 13:51:29 +01:00
741b8701e5 docs(README): correct command creating new user 2021-12-31 13:51:29 +01:00
bb1f0f082e Merge pull request 'docs(README): instruction to create first user' (#24) from aileoia/gitea:master into master
Reviewed-on: #24
2021-12-29 19:31:41 +00:00
cec9c2c061 docs(README): instruction to create first user 2021-12-29 18:13:43 +01:00
3wc
fee8fd5342 Goodbye, emojis! 😢
[ci skip]
2021-11-23 12:19:04 +02:00
3wc
83a9e9da6b chore: fix README bullet formatting
[ci skip]
2021-11-22 13:42:03 +02:00
3wc
ee34764179 Update metadata
[ci skip]
2021-11-21 21:51:51 +02:00
3wc
d0488d3a61 Add preliminary backups 2021-11-21 21:51:11 +02:00
7009473b38 chore: release patch version 2021-11-02 21:45:37 +01:00
7 changed files with 163 additions and 42 deletions

View File

@ -2,6 +2,9 @@ TYPE=gitea
DOMAIN=gitea.example.com DOMAIN=gitea.example.com
LETS_ENCRYPT_ENV=production LETS_ENCRYPT_ENV=production
COMPOSE_FILE="compose.yml"
COMPOSE_FILE="$COMPOSE_FILE:compose.mariadb.yml"
# COMPOSE_FILE="$COMPOSE_FILE:compose.postgres.yml"
GITEA_DOMAIN=git.example.com GITEA_DOMAIN=git.example.com
GITEA_ALLOW_ONLY_EXTERNAL_REGISTRATION=true GITEA_ALLOW_ONLY_EXTERNAL_REGISTRATION=true
@ -11,6 +14,8 @@ GITEA_DISABLE_REGISTRATION=false
GITEA_ENABLE_NOTIFY_MAIL=true GITEA_ENABLE_NOTIFY_MAIL=true
GITEA_ENABLE_OPENID_SIGNIN=true GITEA_ENABLE_OPENID_SIGNIN=true
GITEA_ENABLE_OPENID_SIGNUP=true GITEA_ENABLE_OPENID_SIGNUP=true
GITEA_DISABLE_GRAVATAR=false
GITEA_ENABLE_FEDERATED_AVATAR=true
GITEA_MAILER_FROM=noreply@example.com GITEA_MAILER_FROM=noreply@example.com
GITEA_MAILER_USER=noreply@example.com GITEA_MAILER_USER=noreply@example.com
@ -25,7 +30,15 @@ SECRET_JWT_SECRET_VERSION=v1 # length=43
SECRET_SECRET_KEY_VERSION=v1 # length=64 SECRET_SECRET_KEY_VERSION=v1 # length=64
# SMTP Mailer # SMTP Mailer
# COMPOSE_FILE="compose.yml:compose.smtp.yml" # COMPOSE_FILE="$COMPOSE_FILE:compose.smtp.yml"
# GITEA_SMTP_MAILER_ENABLED=1 # GITEA_SMTP_MAILER_ENABLED=1
# GITEA_MAILER_HOST=mail.gandi.net:465 # GITEA_MAILER_HOST=mail.gandi.net:465
# SECRET_SMTP_PASSWORD_VERSION=v1 # SECRET_SMTP_PASSWORD_VERSION=v1
# OATH2 Options
# GITEA_REGISTER_EMAIL_CONFIRM=replace-me
# GITEA_REGISTER_EMAIL_CONFIRM=replace-me
# GITEA_OAUTH2_USERNAME=replace-me
# GITEA_UPDATE_AVATAR=replace-me
# GITEA_ACCOUNT_LINKING=replace-me
# GITEA_OAUTH2_CLIENT_ENABLED=replace-me

View File

@ -1,18 +1,16 @@
# Gitea # Gitea
[![Build Status](https://drone.coopcloud.tech/api/badges/coop-cloud/gitea/status.svg)](https://drone.coopcloud.tech/coop-cloud/gitea) [![Build Status](https://build.coopcloud.tech/api/badges/coop-cloud/gitea/status.svg)](https://build.coopcloud.tech/coop-cloud/gitea)
<!-- metadata --> <!-- metadata -->
* **Category**: Development
- **Category**: Development * **Status**: 3, stable
- **Status**: ❷💛 * **Image**: [`gitea/gitea`](https://hub.docker.com/gitea/gitea), 4, upstream
- **Image**: [`gitea/gitea`](https://hub.docker.com/gitea/gitea), ❶💚, upstream * **Healthcheck**: Yes
- **Healthcheck**: Yes * **Backups**: Yes
- **Backups**: No * **Email**: ?
- **Email**: ? * **Tests**: 2
- **Tests**: ❷💛 * **SSO**: 3 (OAuth)
- **SSO**: ❶💚 (OAuth)
<!-- endmetadata --> <!-- endmetadata -->
## Basic usage ## Basic usage
@ -24,3 +22,40 @@
4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to 4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
your Docker swarm box your Docker swarm box
5. `abra app YOURAPPDOMAIN deploy` 5. `abra app YOURAPPDOMAIN deploy`
## Create first user
Run
```bash
abra app run YOURAPPNAME app gitea -c /etc/gitea/app.ini admin user create --username USERNAME --admin --random-password --email EMAIL
```
See the [Gitea command-line documentation](https://docs.gitea.io/en-us/command-line/) for more options. Make sure not to forget the `-c /etc/gitea/app.ini`.
## Enable SSH
You most certainly want to be able to access your repository over SSH. To do so, make sure you uncomment the right lines in the configuration for `traefik`.
```
abra app config YOURTRAEFIKAPP
```
There uncomment or add these lines:
```
GITEA_SSH_ENABLED=1
COMPOSE_FILE="compose.yml:compose.gitea.yml"
```
Then redeploy traefik:
```
abra app undeploy YOURTRAEFIKAPP
abra app deploy YOURTRAEFIKAPP
```
You might need to wait a bit. To check if it worked, you can run
```
telnet my.gitea.example.com 2222
```
Once you have added a public SSH key, you can check that you can connect to your gitea server with
```
ssh -T -p 2222 git@my.gitea.example.com
```
Note that gitea should be configured to listen to port 2222, i.e. `GITEA_SSH_PORT=2222` in the gitea config.

14
abra.sh
View File

@ -1,2 +1,14 @@
export APP_INI_VERSION=v7 export APP_INI_VERSION=v9
export DOCKER_SETUP_SH_VERSION=v1 export DOCKER_SETUP_SH_VERSION=v1
abra_backup_app() {
_abra_backup_dir "app:/var/lib/gitea"
}
abra_backup_db() {
_abra_backup_mysql "db" "gitea"
}
abra_backup() {
abra_backup_app && abra_backup_db
}

View File

@ -7,6 +7,10 @@ NAME = {{ env "GITEA_DB_NAME" }}
PASSWD = {{ secret "db_password" }} PASSWD = {{ secret "db_password" }}
USER = {{ env "GITEA_DB_USER" }} USER = {{ env "GITEA_DB_USER" }}
[picture]
DISABLE_GRAVATAR = {{ env "GITEA_DISABLE_GRAVATAR" }}
ENABLE_FEDERATED_AVATAR = {{ env "GITEA_ENABLE_FEDERATED_AVATAR" }}
[service] [service]
ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ env "GITEA_ALLOW_ONLY_EXTERNAL_REGISTRATION" }} ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ env "GITEA_ALLOW_ONLY_EXTERNAL_REGISTRATION" }}
AUTO_WATCH_NEW_REPOS = {{ env "GITEA_AUTO_WATCH_NEW_REPOS" }} AUTO_WATCH_NEW_REPOS = {{ env "GITEA_AUTO_WATCH_NEW_REPOS" }}
@ -53,6 +57,15 @@ MAILER_TYPE = smtp
IS_TLS_ENABLED = true IS_TLS_ENABLED = true
{{ end }} {{ end }}
{{ if eq (env "GITEA_OAUTH2_CLIENT_ENABLED") "1" }}
[oauth2_client]
REGISTER_EMAIL_CONFIRM = {{ env "GITEA_REGISTER_EMAIL_CONFIRM" }}
ENABLE_AUTO_REGISTRATION = {{ env "GITEA_ENABLE_AUTO_REGISTRATION" }}
USERNAME = {{ env "GITEA_OAUTH2_USERNAME" }}
UPDATE_AVATAR = {{ env "GITEA_UPDATE_AVATAR" }}
ACCOUNT_LINKING = {{ env "GITEA_ACCOUNT_LINKING" }}
{{ end }}
[markup.restructuredtext] [markup.restructuredtext]
ENABLED = true ENABLED = true
FILE_EXTENSIONS = .rst FILE_EXTENSIONS = .rst

37
compose.mariadb.yml Normal file
View File

@ -0,0 +1,37 @@
version: '3.8'
services:
app:
environment:
- GITEA_DB_TYPE=mysql
- GITEA_DB_HOST="db:3306"
- GITEA_DB_NAME=gitea
- GITEA_DB_USER=gitea
db:
image: "mariadb:10.9"
command: |
mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
- MYSQL_DATABASE=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
secrets:
- db_password
- db_root_password
volumes:
- "mariadb:/var/lib/mysql"
networks:
- internal
secrets:
db_password:
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
external: true
db_root_password:
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
external: true
volumes:
mariadb:
internal:

30
compose.postgres.yml Normal file
View File

@ -0,0 +1,30 @@
version: '3.8'
services:
app:
environment:
- GITEA_DB_TYPE=postgres
- GITEA_DB_HOST="db:5432"
- GITEA_DB_NAME=gitea
- GITEA_DB_USER=gitea
db:
image: postgres:9.6
environment:
- POSTGRES_DB=gitea
- POSTGRES_USER=gitea
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
secrets:
- db_password
volumes:
- db:/var/lib/postgresql/data
networks:
- internal
secrets:
db_password:
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
external: true
volumes:
db:
internal:

View File

@ -3,7 +3,7 @@ version: "3.8"
services: services:
app: app:
image: "gitea/gitea:1.15.3-rootless" image: "gitea/gitea:1.17.3-rootless"
configs: configs:
- source: app_ini - source: app_ini
target: /etc/gitea/app.ini target: /etc/gitea/app.ini
@ -19,10 +19,6 @@ services:
- GITEA_ALLOW_ONLY_EXTERNAL_REGISTRATION - GITEA_ALLOW_ONLY_EXTERNAL_REGISTRATION
- GITEA_APP_NAME - GITEA_APP_NAME
- GITEA_AUTO_WATCH_NEW_REPOS - GITEA_AUTO_WATCH_NEW_REPOS
- GITEA_DB_HOST="db:3306"
- GITEA_DB_NAME=gitea
- GITEA_DB_TYPE=mysql
- GITEA_DB_USER=gitea
- GITEA_DISABLE_REGISTRATION - GITEA_DISABLE_REGISTRATION
- GITEA_DOMAIN=${DOMAIN} - GITEA_DOMAIN=${DOMAIN}
- GITEA_ENABLE_NOTIFY_MAIL - GITEA_ENABLE_NOTIFY_MAIL
@ -30,6 +26,14 @@ services:
- GITEA_ENABLE_OPENID_SIGNUP - GITEA_ENABLE_OPENID_SIGNUP
- GITEA_SMTP_MAILER_ENABLED - GITEA_SMTP_MAILER_ENABLED
- GITEA_SSH_PORT - GITEA_SSH_PORT
- GITEA_DISABLE_GRAVATAR
- GITEA_ENABLE_FEDERATED_AVATAR
- GITEA_REGISTER_EMAIL_CONFIRM
- GITEA_ENABLE_AUTO_REGISTRATION
- GITEA_OAUTH2_USERNAME
- GITEA_UPDATE_AVATAR
- GITEA_ACCOUNT_LINKING
- GITEA_OAUTH2_CLIENT_ENABLED
volumes: volumes:
- data:/var/lib/gitea - data:/var/lib/gitea
- config:/etc/gitea - config:/etc/gitea
@ -51,24 +55,8 @@ services:
- "traefik.tcp.routers.${STACK_NAME}-ssh.rule=HostSNI(`*`)" - "traefik.tcp.routers.${STACK_NAME}-ssh.rule=HostSNI(`*`)"
- "traefik.tcp.routers.${STACK_NAME}-ssh.entrypoints=gitea-ssh" - "traefik.tcp.routers.${STACK_NAME}-ssh.entrypoints=gitea-ssh"
- "traefik.tcp.services.${STACK_NAME}-ssh.loadbalancer.server.port=${GITEA_SSH_PORT}" - "traefik.tcp.services.${STACK_NAME}-ssh.loadbalancer.server.port=${GITEA_SSH_PORT}"
- coop-cloud.${STACK_NAME}.version=1.1.1+1.15.3-rootless - coop-cloud.${STACK_NAME}.version=1.3.1+1.17.3-rootless
db:
image: "mariadb:10.6"
command: |
mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
- MYSQL_DATABASE=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
secrets:
- db_password
- db_root_password
volumes:
- "mariadb:/var/lib/mysql"
networks:
- internal
networks: networks:
internal: internal:
@ -86,12 +74,6 @@ configs:
template_driver: golang template_driver: golang
secrets: secrets:
db_password:
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
external: true
db_root_password:
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
external: true
internal_token: internal_token:
name: ${STACK_NAME}_internal_token_${SECRET_INTERNAL_TOKEN_VERSION} name: ${STACK_NAME}_internal_token_${SECRET_INTERNAL_TOKEN_VERSION}
external: true external: true
@ -105,4 +87,3 @@ secrets:
volumes: volumes:
data: data:
config: config:
mariadb: