Compare commits
	
		
			8 Commits
		
	
	
		
			2.9.1+1.22
			...
			work-path
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 616d4437ed | |||
| daf4a26f72 | |||
| 7fec94eaec | |||
| 0bfb666dd0 | |||
| 2554109fab | |||
| bd57d6121b | |||
| cae11a78e6 | |||
| 8e8809fd07 | 
@ -17,6 +17,7 @@ steps:
 | 
				
			|||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      APP_INI_VERSION: v1
 | 
					      APP_INI_VERSION: v1
 | 
				
			||||||
      DOCKER_SETUP_SH_VERSION: v1
 | 
					      DOCKER_SETUP_SH_VERSION: v1
 | 
				
			||||||
 | 
					      PG_BACKUP_VERSION: v1
 | 
				
			||||||
      DOMAIN: gitea.swarm-test.autonomic.zone
 | 
					      DOMAIN: gitea.swarm-test.autonomic.zone
 | 
				
			||||||
      GITEA_ALLOW_ONLY_EXTERNAL_REGISTRATION: true
 | 
					      GITEA_ALLOW_ONLY_EXTERNAL_REGISTRATION: true
 | 
				
			||||||
      GITEA_APP_NAME: Git with solidaritea
 | 
					      GITEA_APP_NAME: Git with solidaritea
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ 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.yml"
 | 
				
			||||||
 | 
					ENABLE_BACKUPS=true
 | 
				
			||||||
COMPOSE_FILE="$COMPOSE_FILE:compose.mariadb.yml"
 | 
					COMPOSE_FILE="$COMPOSE_FILE:compose.mariadb.yml"
 | 
				
			||||||
# COMPOSE_FILE="$COMPOSE_FILE:compose.postgres.yml"
 | 
					# COMPOSE_FILE="$COMPOSE_FILE:compose.postgres.yml"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -50,7 +51,8 @@ SECRET_SECRET_KEY_VERSION=v1 # length=64
 | 
				
			|||||||
# SMTP Mailer
 | 
					# SMTP Mailer
 | 
				
			||||||
# COMPOSE_FILE="$COMPOSE_FILE: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_ADDR=mail.gandi.net
 | 
				
			||||||
 | 
					# GITEA_MAILER_PORT=465
 | 
				
			||||||
# SECRET_SMTP_PASSWORD_VERSION=v1
 | 
					# SECRET_SMTP_PASSWORD_VERSION=v1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# OATH2 Options
 | 
					# OATH2 Options
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										3
									
								
								abra.sh
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								abra.sh
									
									
									
									
									
								
							@ -1,5 +1,6 @@
 | 
				
			|||||||
export APP_INI_VERSION=v18
 | 
					export APP_INI_VERSION=v20
 | 
				
			||||||
export DOCKER_SETUP_SH_VERSION=v1
 | 
					export DOCKER_SETUP_SH_VERSION=v1
 | 
				
			||||||
 | 
					export PG_BACKUP_VERSION=v1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
abra_backup_app() {
 | 
					abra_backup_app() {
 | 
				
			||||||
  _abra_backup_dir "app:/var/lib/gitea"
 | 
					  _abra_backup_dir "app:/var/lib/gitea"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
APP_NAME = {{ env "GITEA_APP_NAME" }}
 | 
					APP_NAME = {{ env "GITEA_APP_NAME" }}
 | 
				
			||||||
 | 
					WORK_PATH=/var/lib/gitea
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[database]
 | 
					[database]
 | 
				
			||||||
DB_TYPE = {{ env "GITEA_DB_TYPE" }}
 | 
					DB_TYPE = {{ env "GITEA_DB_TYPE" }}
 | 
				
			||||||
@ -71,11 +72,12 @@ JWT_SECRET = {{ secret "jwt_secret" }}
 | 
				
			|||||||
[mailer]
 | 
					[mailer]
 | 
				
			||||||
ENABLED        = true
 | 
					ENABLED        = true
 | 
				
			||||||
FROM           = {{ env "GITEA_MAILER_FROM" }}
 | 
					FROM           = {{ env "GITEA_MAILER_FROM" }}
 | 
				
			||||||
HOST           = {{ env "GITEA_MAILER_HOST" }}
 | 
					PROTOCOL       = smtps
 | 
				
			||||||
 | 
					SMTP_ADDR      = {{ env "GITEA_MAILER_ADDR" }}
 | 
				
			||||||
 | 
					SMTP_PORT      = {{ env "GITEA_MAILER_PORT" }}
 | 
				
			||||||
USER           = {{ env "GITEA_MAILER_USER" }}
 | 
					USER           = {{ env "GITEA_MAILER_USER" }}
 | 
				
			||||||
PASSWD         = {{ secret "smtp_password" }}
 | 
					PASSWD         = {{ secret "smtp_password" }}
 | 
				
			||||||
MAILER_TYPE    = smtp
 | 
					MAILER_TYPE    = smtp
 | 
				
			||||||
IS_TLS_ENABLED = true
 | 
					 | 
				
			||||||
{{ end }}
 | 
					{{ end }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{{ if eq (env "GITEA_OAUTH2_CLIENT_ENABLED") "1" }}
 | 
					{{ if eq (env "GITEA_OAUTH2_CLIENT_ENABLED") "1" }}
 | 
				
			||||||
 | 
				
			|||||||
@ -2,4 +2,4 @@ version: '3.8'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  app:
 | 
					  app:
 | 
				
			||||||
    image: codeberg.org/forgejo/forgejo:1.21.11-1-rootless
 | 
					    image: codeberg.org/forgejo/forgejo:9.0.1-rootless
 | 
				
			||||||
 | 
				
			|||||||
@ -11,10 +11,9 @@ services:
 | 
				
			|||||||
    image: "mariadb:10.11.2"
 | 
					    image: "mariadb:10.11.2"
 | 
				
			||||||
    deploy:
 | 
					    deploy:
 | 
				
			||||||
      labels:
 | 
					      labels:
 | 
				
			||||||
          backupbot.backup: "true"
 | 
					 | 
				
			||||||
          backupbot.backup.pre-hook: 'mysqldump --single-transaction -u root -p"$$(cat /run/secrets/db_root_password)" gitea > /var/lib/mysql/backup.sql'
 | 
					          backupbot.backup.pre-hook: 'mysqldump --single-transaction -u root -p"$$(cat /run/secrets/db_root_password)" gitea > /var/lib/mysql/backup.sql'
 | 
				
			||||||
          backupbot.backup.post-hook: "rm -rf /var/lib/mysql/backup.sql"
 | 
					          backupbot.backup.volumes.mariadb.path: "backup.sql"
 | 
				
			||||||
          backupbot.backup.path: "/var/lib/mysql/backup.sql"
 | 
					          backupbot.restore.post-hook: "mariadb -u root -p\"$$(cat /run/secrets/db_root_password)\" gitea < /var/lib/mysql/backup.sql"
 | 
				
			||||||
    command: |
 | 
					    command: |
 | 
				
			||||||
      mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
 | 
					      mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
@ -40,4 +39,3 @@ secrets:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
volumes:
 | 
					volumes:
 | 
				
			||||||
  mariadb:
 | 
					  mariadb:
 | 
				
			||||||
  internal:
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -8,13 +8,12 @@ services:
 | 
				
			|||||||
      - GITEA_DB_NAME=gitea
 | 
					      - GITEA_DB_NAME=gitea
 | 
				
			||||||
      - GITEA_DB_USER=gitea
 | 
					      - GITEA_DB_USER=gitea
 | 
				
			||||||
  db:
 | 
					  db:
 | 
				
			||||||
    image: postgres:15.7
 | 
					    image: postgres:15.8
 | 
				
			||||||
    deploy:
 | 
					    deploy:
 | 
				
			||||||
      labels:
 | 
					      labels:
 | 
				
			||||||
          backupbot.backup: "true"
 | 
					        backupbot.backup.pre-hook: "/pg_backup.sh backup"
 | 
				
			||||||
          backupbot.backup.pre-hook: "PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /var/lib/postgresql/data/backup.sql"
 | 
					        backupbot.backup.volumes.db.path: "backup.sql"
 | 
				
			||||||
          backupbot.backup.post-hook: "rm -r /var/lib/postgresql/data/backup.sql"
 | 
					        backupbot.restore.post-hook: '/pg_backup.sh restore'
 | 
				
			||||||
          backupbot.backup.path: "/var/lib/postgresql/data"
 | 
					 | 
				
			||||||
    environment: 
 | 
					    environment: 
 | 
				
			||||||
      - POSTGRES_DB=gitea
 | 
					      - POSTGRES_DB=gitea
 | 
				
			||||||
      - POSTGRES_USER=gitea
 | 
					      - POSTGRES_USER=gitea
 | 
				
			||||||
@ -25,6 +24,10 @@ services:
 | 
				
			|||||||
      - db:/var/lib/postgresql/data
 | 
					      - db:/var/lib/postgresql/data
 | 
				
			||||||
    networks:
 | 
					    networks:
 | 
				
			||||||
      - internal
 | 
					      - internal
 | 
				
			||||||
 | 
					    configs:
 | 
				
			||||||
 | 
					        - source: pg_backup
 | 
				
			||||||
 | 
					          target: /pg_backup.sh
 | 
				
			||||||
 | 
					          mode: 0555
 | 
				
			||||||
 | 
					
 | 
				
			||||||
secrets:
 | 
					secrets:
 | 
				
			||||||
  db_password:
 | 
					  db_password:
 | 
				
			||||||
@ -33,4 +36,8 @@ secrets:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
volumes:
 | 
					volumes:
 | 
				
			||||||
  db:
 | 
					  db:
 | 
				
			||||||
  internal:
 | 
					
 | 
				
			||||||
 | 
					configs:
 | 
				
			||||||
 | 
					  pg_backup:
 | 
				
			||||||
 | 
					    name: ${STACK_NAME}_pg_backup_${PG_BACKUP_VERSION}
 | 
				
			||||||
 | 
					    file: pg_backup.sh
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,8 @@ services:
 | 
				
			|||||||
  app:
 | 
					  app:
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      - GITEA_MAILER_FROM
 | 
					      - GITEA_MAILER_FROM
 | 
				
			||||||
      - GITEA_MAILER_HOST
 | 
					      - GITEA_MAILER_ADDR
 | 
				
			||||||
 | 
					      - GITEA_MAILER_PORT
 | 
				
			||||||
      - GITEA_MAILER_USER
 | 
					      - GITEA_MAILER_USER
 | 
				
			||||||
    secrets:
 | 
					    secrets:
 | 
				
			||||||
      - smtp_password
 | 
					      - smtp_password
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@ version: "3.8"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  app:
 | 
					  app:
 | 
				
			||||||
    image: "gitea/gitea:1.22.0-rootless"
 | 
					    image: "gitea/gitea:1.22.3-rootless"
 | 
				
			||||||
    configs:
 | 
					    configs:
 | 
				
			||||||
      - source: app_ini
 | 
					      - source: app_ini
 | 
				
			||||||
        target: /etc/gitea/app.ini
 | 
					        target: /etc/gitea/app.ini
 | 
				
			||||||
@ -71,7 +71,7 @@ services:
 | 
				
			|||||||
        failure_action: rollback
 | 
					        failure_action: rollback
 | 
				
			||||||
        order: start-first
 | 
					        order: start-first
 | 
				
			||||||
      labels:
 | 
					      labels:
 | 
				
			||||||
        - "backupbot.backup=true"
 | 
					        - "backupbot.backup=${ENABLE_BACKUPS:-true}"
 | 
				
			||||||
        - "traefik.enable=true"
 | 
					        - "traefik.enable=true"
 | 
				
			||||||
        - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
 | 
					        - "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
 | 
				
			||||||
        - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
 | 
					        - "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
 | 
				
			||||||
@ -85,7 +85,7 @@ services:
 | 
				
			|||||||
        - "traefik.http.middlewares.${STACK_NAME}_cors.headers.accesscontrolalloworiginlist=https://${GITEA_CORS_ALLOW_DOMAIN}"
 | 
					        - "traefik.http.middlewares.${STACK_NAME}_cors.headers.accesscontrolalloworiginlist=https://${GITEA_CORS_ALLOW_DOMAIN}"
 | 
				
			||||||
        - "traefik.http.middlewares.${STACK_NAME}_cors.headers.accesscontrolmaxage=100"
 | 
					        - "traefik.http.middlewares.${STACK_NAME}_cors.headers.accesscontrolmaxage=100"
 | 
				
			||||||
        - "traefik.http.middlewares.${STACK_NAME}_cors.headers.addvaryheader=true"
 | 
					        - "traefik.http.middlewares.${STACK_NAME}_cors.headers.addvaryheader=true"
 | 
				
			||||||
        - coop-cloud.${STACK_NAME}.version=2.9.1+1.22.0-rootless
 | 
					        - coop-cloud.${STACK_NAME}.version=3.0.1+1.22.3-rootless
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
networks:
 | 
					networks:
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										34
									
								
								pg_backup.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								pg_backup.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BACKUP_FILE='/var/lib/postgresql/data/backup.sql'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function backup {
 | 
				
			||||||
 | 
					  export PGPASSWORD=$(cat $POSTGRES_PASSWORD_FILE)
 | 
				
			||||||
 | 
					  pg_dump -U ${POSTGRES_USER} ${POSTGRES_DB} > $BACKUP_FILE
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function restore {
 | 
				
			||||||
 | 
					    cd /var/lib/postgresql/data/
 | 
				
			||||||
 | 
					    restore_config(){
 | 
				
			||||||
 | 
					        # Restore allowed connections
 | 
				
			||||||
 | 
					        cat pg_hba.conf.bak > pg_hba.conf
 | 
				
			||||||
 | 
					        su postgres -c 'pg_ctl reload'
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    # Don't allow any other connections than local
 | 
				
			||||||
 | 
					    cp pg_hba.conf pg_hba.conf.bak
 | 
				
			||||||
 | 
					    echo "local all all trust" > pg_hba.conf
 | 
				
			||||||
 | 
					    su postgres -c 'pg_ctl reload'
 | 
				
			||||||
 | 
					    trap restore_config EXIT INT TERM
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Recreate Database
 | 
				
			||||||
 | 
					    psql -U ${POSTGRES_USER} -d postgres -c "DROP DATABASE ${POSTGRES_DB} WITH (FORCE);" 
 | 
				
			||||||
 | 
					    createdb -U ${POSTGRES_USER} ${POSTGRES_DB}
 | 
				
			||||||
 | 
					    psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -1 -f $BACKUP_FILE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    trap - EXIT INT TERM
 | 
				
			||||||
 | 
					    restore_config
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$@
 | 
				
			||||||
							
								
								
									
										3
									
								
								release/3.0.0+1.22.2-rootless
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								release/3.0.0+1.22.2-rootless
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					BEWARE! 🚨 This release updates to the newer Gitea SMTP settings format.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you are using SMTP, you will need to split the old GITEA_MAILER_HOST into separate GITEA_MAILER_ADDR (hostname) and GITEA_MAILER_PORT settings.
 | 
				
			||||||
		Reference in New Issue
	
	Block a user