ENG | Moving from Gitea to Forgejo
This describes migration from
gitea-1.21.11
toforgejo-7.0
. This guide will likely be obsolete in the future as versions will diverge.As of 2024-12, there is already statement Gitea 1.22 is the last version to allow a transparent upgrade to Forgejo
Currently all that is required is changing perhaps six lines in docker compose file.
This article builds on previous ones about Gitea and Backup and recovery , basically combines them with slight modification of docker compose file. At time of writing, Gitea install guide is valid. All of this is just for testing.
Backup gitea and related docker-compose.yml
Testing docker compose
Forgejo docker images are here
I tried slight modifications to docker-compose-gitea.yml and running it on virtual machine.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Based on https://docs.gitea.com/installation/install-with-docker-rootless
# and previous docker-compose.yml file
# Changelog:
# 2023-07-03: Initial version
# 2024-04-13: upgrade from 1.20 to 1.21
# 2024-06-28: change gitea to forgejo-7
version: "3"
volumes:
gitea-data:
gitea-config:
gitea-db:
services:
gitea-db:
image: lscr.io/linuxserver/mariadb:latest
container_name: gitea-mariadb
restart: unless-stopped
environment:
- PUID=1000
- TZ=${TIMEZONE}
- MYSQL_DATABASE=${GITEA_DB_NAME}
- MYSQL_USER=${GITEA_DB_USER}
- MYSQL_PASSWORD=${GITEA_DB_PASS}
- MYSQL_ROOT_PASSWORD=${GITEA_DB_PASS}
volumes:
- gitea-db:/config
env_file:
- /home/pavel/docker/.env
gitea-server:
# image: docker.io/gitea/gitea:1.21.11-rootless
image: codeberg.org/forgejo/forgejo:7.0-rootless
container_name: gitea
restart: always
environment:
- FORGEJO__database__DB_TYPE=mysql
- FORGEJO__database__HOST=gitea-db:3306
- FORGEJO__database__NAME=${GITEA_DB_NAME}
- FORGEJO__database__USER=${GITEA_DB_USER}
- FORGEJO__database__PASSWD=${GITEA_DB_PASS}
volumes:
#- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- gitea-data:/var/lib/gitea
- gitea-config:/etc/gitea
ports:
- "8082:3000"
- "2222:2222"
depends_on:
- gitea-db
env_file:
- /home/pavel/docker/.env
I tested this in virtual machine using podman-compose -f docker-compose-forgejo.yml up
and it already works. First user is registered and gets admin rights. Inspecting configuration and filesystem using podman exec --user=root -it gitea sh
shows that config file is /etc/gitea/app.ini
and data are /var/lib/gitea
directory.
Testing with existing data
Now let’s test backup and restoration guide to recreate setup at virtual computer.
1
2
3
4
5
[pavel@marten -=- /home/pavel/backup]$ tar cfv gitea.tar gitea*2024-06-28.tar.zst
gitea-config-2024-06-28.tar.zst
gitea-data-2024-06-28.tar.zst
gitea-db-2024-06-28.tar.zst
[pavel@marten -=- /home/pavel/backup]$ podman cp gitea.tar nginx:/config/www
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
pavel@lmde:~/docker$ podman ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
73e05a7a6069 lscr.io/linuxserver/mariadb:latest 35 minutes ago Up 35 minutes ago gitea-mariadb
cb9e1848672d codeberg.org/forgejo/forgejo:7.0.4-rootless 35 minutes ago Up 35 minutes ago 0.0.0.0:2222->2222/tcp, 0.0.0.0:8082->3000/tcp gitea
pavel@lmde:~/docker$ cd
pavel@lmde:~$ mkdir backup
pavel@lmde:~$ cd backup/
pavel@lmde:~/backup$ wget https://www.pavelp.cz/gitea.tar
--2024-06-28 20:08:16-- https://www.pavelp.cz/gitea.tar
Resolving www.pavelp.cz (www.pavelp.cz)... 104.21.32.91, 172.67.185.80, 2606:4700:3037::ac43:b950, ...
Connecting to www.pavelp.cz (www.pavelp.cz)|104.21.32.91|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 49735680 (47M) [application/octet-stream]
Saving to: ‘gitea.tar’
gitea.tar 100%[===================================================================================================>] 47.43M 5.86MB/s in 8.2s
2024-06-28 20:08:25 (5.77 MB/s) - ‘gitea.tar’ saved [49735680/49735680]
pavel@lmde:~/backup$ tar xfv gitea.tar
gitea-config-2024-06-28.tar.zst
gitea-data-2024-06-28.tar.zst
gitea-db-2024-06-28.tar.zst
pavel@lmde:~/backup$ cd ~/docker
pavel@lmde:~/docker$ podman-compose -f docker-compose-forgejo.yml stop
['podman', '--version', '']
using podman version: 4.3.1
podman stop -t 10 gitea
WARN[0010] StopSignal SIGTERM failed to stop container gitea in 10 seconds, resorting to SIGKILL
gitea
exit code: 0
podman stop -t 10 gitea-mariadb
gitea-mariadb
exit code: 0
pavel@lmde:~/docker$ podman volume rm -f docker_gitea-config docker_gitea-data docker_gitea-db
docker_gitea-config
docker_gitea-data
docker_gitea-db
pavel@lmde:~/docker$ podman volume create docker_gitea-config
docker_gitea-config
pavel@lmde:~/docker$ podman volume create docker_gitea-data
docker_gitea-data
pavel@lmde:~/docker$ podman volume create docker_gitea-db
docker_gitea-db
pavel@lmde:~/docker$ zstd -d < ~/backup/gitea-config-2024-06-28.tar.zst | podman volume import docker_gitea-config -
pavel@lmde:~/docker$ zstd -d < ~/backup/gitea-data-2024-06-28.tar.zst | podman volume import docker_gitea-data -
pavel@lmde:~/docker$ zstd -d < ~/backup/gitea-db-2024-06-28.tar.zst | podman volume import docker_gitea-db -
NOTE: we need remove volumes attached to containers, they exist even thou they are not running.
Now watch it burn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
pavel@lmde:~/docker$ podman-compose -f docker-compose-forgejo.yml up
['podman', '--version', '']
using podman version: 4.3.1
** excluding: set()
podman volume inspect docker_gitea-db || podman volume create docker_gitea-db
['podman', 'volume', 'inspect', 'docker_gitea-db']
['podman', 'network', 'exists', 'docker_default']
podman create --name=gitea-mariadb --label io.podman.compose.config-hash=123 --label io.podman.compose.project=docker --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=docker --label com.docker.compose.project.working_dir=/home/pavel/docker --label com.docker.compose.project.config_files=docker-compose-forgejo.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=gitea-db --env-file /home/pavel/docker/.env -e PUID=1000 -e TZ=Europe/Prague -e MYSQL_DATABASE=gitea -e MYSQL_USER=gitea -e MYSQL_PASSWORD=gitea -e MYSQL_ROOT_PASSWORD=gitea -v docker_gitea-db:/config --net docker_default --network-alias gitea-db --restart unless-stopped lscr.io/linuxserver/mariadb:latest
50bbd60ea2b7c1b271cb9c553654f0667d3b56aae79c78c8a20356caca4ae4ca
exit code: 0
podman volume inspect docker_gitea-data || podman volume create docker_gitea-data
['podman', 'volume', 'inspect', 'docker_gitea-data']
podman volume inspect docker_gitea-config || podman volume create docker_gitea-config
['podman', 'volume', 'inspect', 'docker_gitea-config']
['podman', 'network', 'exists', 'docker_default']
podman create --name=gitea --label io.podman.compose.config-hash=123 --label io.podman.compose.project=docker --label io.podman.compose.version=0.0.1 --label com.docker.compose.project=docker --label com.docker.compose.project.working_dir=/home/pavel/docker --label com.docker.compose.project.config_files=docker-compose-forgejo.yml --label com.docker.compose.container-number=1 --label com.docker.compose.service=gitea-server --env-file /home/pavel/docker/.env -e FORGEJO__database__DB_TYPE=mysql -e FORGEJO__database__HOST=gitea-db:3306 -e FORGEJO__database__NAME=gitea -e FORGEJO__database__USER=gitea -e FORGEJO__database__PASSWD=gitea -v /usr/share/zoneinfo/Europe/Prague:/etc/localtime:ro -v docker_gitea-data:/var/lib/gitea -v docker_gitea-config:/etc/gitea --net docker_default --network-alias gitea-server -p 8082:3000 -p 2222:2222 --restart always codeberg.org/forgejo/forgejo:7.0.4-rootless
be654c7e2cc18dc52a948aa772790551c9d242643a971af5174d4c4fac80f75f
exit code: 0
podman start -a gitea-mariadb
[migrations] started
[migrations] no migrations found
───────────────────────────────────────
██╗ ███████╗██╗ ██████╗
██║ ██╔════╝██║██╔═══██╗
██║ ███████╗██║██║ ██║
██║ ╚════██║██║██║ ██║
███████╗███████║██║╚██████╔╝
╚══════╝╚══════╝╚═╝ ╚═════╝
Brought to you by linuxserver.io
───────────────────────────────────────
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID: 1000
User GID: 911
───────────────────────────────────────
Linuxserver.io version: 10.11.8-r0-ls147
Build-date: 2024-06-25T07:42:46+00:00
───────────────────────────────────────
podman start -a gitea
[custom-init] No custom files found, skipping...
240628 20:29:42 mysqld_safe Logging to '/config/databases/50bbd60ea2b7.err'.
240628 20:29:42 mysqld_safe Starting mariadbd daemon with databases from /config/databases
2024/06/28 20:29:43 cmd/web.go:242:runWeb() [I] Starting Forgejo on PID: 2
2024/06/28 20:29:43 cmd/web.go:111:showWebStartupMessage() [I] Forgejo version: 7.0.4+gitea-1.21.11 built with GNU Make 4.4.1, go1.22.4 : bindata, timetzdata, sqlite, sqlite_unlock_notify
2024/06/28 20:29:43 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/06/28 20:29:43 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /usr/local/bin/gitea
2024/06/28 20:29:43 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /var/lib/gitea
2024/06/28 20:29:43 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /var/lib/gitea/custom
2024/06/28 20:29:43 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /etc/gitea/app.ini
2024/06/28 20:29:43 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server
2024/06/28 20:29:43 routers/init.go:114:InitWebInstalled() [I] Git version: 2.43.4, Wire Protocol Version 2 Enabled (home: /var/lib/gitea/home)
Connection to localhost (::1) 3306 port [tcp/mysql] succeeded!
2024/06/28 20:29:44 ...g/config_provider.go:329:deprecatedSetting() [E] Deprecated config option `[log]` `ROUTER` present. Use `[log]` `logger.router.MODE` instead. This fallback will be/has been removed in 1.21
2024/06/28 20:29:44 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled
2024/06/28 20:29:44 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
2024/06/28 20:29:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/attachments
2024/06/28 20:29:44 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
2024/06/28 20:29:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/avatars
2024/06/28 20:29:44 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
2024/06/28 20:29:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/data/repo-avatars
2024/06/28 20:29:44 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
2024/06/28 20:29:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/git/lfs
2024/06/28 20:29:44 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
2024/06/28 20:29:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/repo-archive
2024/06/28 20:29:44 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
2024/06/28 20:29:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/packages
2024/06/28 20:29:44 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
2024/06/28 20:29:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/actions_log
2024/06/28 20:29:44 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
2024/06/28 20:29:44 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /var/lib/gitea/actions_artifacts
2024/06/28 20:29:44 routers/init.go:133:InitWebInstalled() [I] SQLite3 support is enabled
2024/06/28 20:29:44 routers/common/db.go:23:InitDBEngine() [I] Beginning ORM engine initialization.
2024/06/28 20:29:44 routers/common/db.go:30:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2024/06/28 20:29:44 cmd/web.go:194:serveInstalled() [I] PING DATABASE mysql
[ls.io-init] done.
2024/06/28 20:29:44 ...dels/db/collation.go:184:preprocessDatabaseCollation() [W] Current database is using a case-insensitive collation "utf8mb4_general_ci", although Forgejo could work with it, there might be some rare cases which don't work as expected.
2024/06/28 20:29:44 ...ations/migrations.go:682:Migrate() [I] Migration[280]: Rename user themes
2024/06/28 20:29:44 ...ations/migrations.go:682:Migrate() [I] Migration[281]: Add auth_token table
2024/06/28 20:29:44 ...ations/migrations.go:682:Migrate() [I] Migration[282]: Add Index to pull_auto_merge.doer_id
2024/06/28 20:29:44 ...ations/migrations.go:682:Migrate() [I] Migration[283]: Add combined Index to issue_user.uid and issue_id
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[284]: Add ignore stale approval column on branch table
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[285]: Add PreviousDuration to ActionRun
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[286]: Add support for SHA256 git repositories
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[287]: Use Slug instead of ID for Badges
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[288]: Add user_blocking table
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[289]: Add default_wiki_branch to repository table
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[290]: Add PayloadVersion to HookTask
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[291]: Add Index to attachment.comment_id
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[292]: Ensure every project has exactly one default column - No Op
2024/06/28 20:29:45 ...ations/migrations.go:682:Migrate() [I] Migration[293]: Ensure every project has exactly one default column
2024/06/28 20:29:45 cmd/web.go:194:serveInstalled() [W] Table system_setting Column version db default is , struct default is 1
2024/06/28 20:29:45 cmd/web.go:194:serveInstalled() [W] Table badge has column slug but struct has not related field
2024/06/28 20:29:46 cmd/web.go:194:serveInstalled() [W] Table repository has column default_wiki_branch but struct has not related field
2024/06/28 20:29:46 cmd/web.go:194:serveInstalled() [W] Table project column board_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
2024/06/28 20:29:46 cmd/web.go:194:serveInstalled() [W] Table project column card_type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
2024/06/28 20:29:46 cmd/web.go:194:serveInstalled() [W] Table project column type db type is INT(10) UNSIGNED, struct type is INT UNSIGNED
2024/06/28 20:29:46 cmd/web.go:194:serveInstalled() [W] Table review_state Column commit_sha db nullable is true, struct nullable is false
2024/06/28 20:29:46 cmd/web.go:194:serveInstalled() [W] Table label Column archived_unix db default is , struct default is NULL
2024/06/28 20:29:46 routers/init.go:139:InitWebInstalled() [I] ORM engine initialization successful!
2024/06/28 20:29:46 ...er/issues/indexer.go:76:func1() [I] PID 2: Initializing Issue Indexer: bleve
2024/06/28 20:29:46 ...xer/stats/indexer.go:41:populateRepoIndexer() [I] Populating the repo stats indexer with existing repositories
2024/06/28 20:29:46 modules/ssh/ssh.go:331:Listen() [I] Adding SSH host key: /var/lib/gitea/ssh/gitea.rsa
2024/06/28 20:29:46 ...er/issues/indexer.go:153:func2() [I] Issue Indexer Initialization took 7.055524ms
2024/06/28 20:29:46 ...xer/stats/indexer.go:87:populateRepoIndexer() [I] Done (re)populating the repo stats indexer with existing repositories
2024/06/28 20:29:46 modules/ssh/init.go:26:Init() [I] SSH server started on :2222. Cipher list ([[email protected] aes128-ctr aes192-ctr aes256-ctr [email protected] [email protected]]), key exchange algorithms ([curve25519-sha256 ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 diffie-hellman-group14-sha256 diffie-hellman-group14-sha1]), MACs ([[email protected] hmac-sha2-256 hmac-sha1])
2024/06/28 20:29:46 ...s/graceful/server.go:50:NewServer() [I] Starting new SSH server: tcp::2222 on PID: 2
2024/06/28 20:29:46 ...s/actions/cleanup.go:36:cleanExpiredArtifacts() [I] Found 0 expired artifacts
2024/06/28 20:29:46 ...s/actions/cleanup.go:60:cleanNeedDeleteArtifacts() [I] Found 0 artifacts pending deletion
2024/06/28 20:29:46 cmd/web.go:304:listen() [I] Listen: http://0.0.0.0:3000
2024/06/28 20:29:46 cmd/web.go:308:listen() [I] AppURL(ROOT_URL): https://git.pavelp.cz/
2024/06/28 20:29:46 cmd/web.go:311:listen() [I] LFS server enabled
2024/06/28 20:29:46 ...s/graceful/server.go:50:NewServer() [I] Starting new Web server: tcp:0.0.0.0:3000 on PID: 2
2024/06/28 20:29:46 ...eb/routing/logger.go:102:func1() [I] router: completed GET /user/events for 10.89.0.5:32864, 200 OK in 0.2ms @ events/events.go:18(events.Events)
Deployment
Because everything worked, we can now take docker-compose-forgejo.yml from virtual machine.
Stop and remove Gitea:
1
2
3
4
5
6
[pavel@marten -=- /home/pavel/docker]$ podman-compose -f ~/docker/docker-compose-gitea.yml stop
gitea
gitea-mariadb
[pavel@marten -=- /home/pavel/docker]$ rm docker-compose-gitea.yml
[pavel@marten -=- /home/pavel/docker]$ podman container rm gitea
gitea
And start forgejo (then stop it using ctrl+c and start it again in background with up -d
):
1
2
3
4
5
6
7
8
9
10
[pavel@marten -=- /home/pavel/docker]$ podman-compose -f ~/docker/docker-compose-forgejo.yml start
Error: no container with name or ID "gitea" found: no such container
gitea-mariadb
[pavel@marten -=- /home/pavel/docker]$ podman-compose -f ~/docker/docker-compose-forgejo.yml up
Error: no container with name or ID "gitea" found: no such container
gitea-mariadb
Trying to pull codeberg.org/forgejo/forgejo:7.0.4-rootless...
Getting image source signatures
Copying blob 863415bfe761 done |
Copying blob ab10b618dafa done |
Commit changes:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[pavel@marten -=- /home/pavel/docker]$ git status
git status
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
renamed: docker-compose-gitea.yml -> docker-compose-forgejo.yml
[pavel@marten -=- /home/pavel/docker]$ git commit -m "gitea -> forgejo"
[main 3b3b1c3] gitea -> forgejo
1 file changed, 10 insertions(+), 8 deletions(-)
rename docker-compose-gitea.yml => docker-compose-forgejo.yml (71%)
[pavel@marten -=- /home/pavel/docker]$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 889 bytes | 889.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
To https://git.pavelp.cz/pavel.perina/docker-files.git
c86ff3e..3b3b1c3 main -> main
Review all the changes
Not many changes. Yes, it was that easy. There are minor flaws remaining:
- Gitea logo remained at some places (because of caching)
- “Gitea: Git with a cup of tea” remained on home page. Can be changed by
podman exec --user=root -it gitea sh
,vi /etc/gitea/app.ini
to “Forgejo: Beyond coding. We forge.”
Addendum 2025-04-18
I upgraded Forgejo from v7 to v11 (both LTS versions).
Due to warnings, I upgraded app.ini
file a bit, note that change of ROOT_URL happenes automatically as it is overwritten by environment variable:
1
2
3
4
5
[log]
ROUTER = console --> logger.router.MODE = ,
[server]
ROOT_URL = http://gitea:3000/ --> ROOT_URL = https://git.pavelp.cz/
Also, there were some changes in docker-compose files in December 2024.
Up-to-date docker-compose file looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Based on https://docs.gitea.com/installation/install-with-docker-rootless
# and previous docker-compose.yml file
# Changelog:
# 2023-07-03: Initial version
# 2024-04-13: upgrade from gitea 1.20 to 1.21
# 2024-06-28: upgrade to forgejo-7.0
# 2024-12-05: name attribute
# 2024-12-21: external volumes
# 2025-04-18: upgrade to forgejo-11.0, change ROOT_URL and app.ini
name: gitea
version: "3.5"
volumes:
gitea-data:
external: true
name: docker_gitea-data
gitea-config:
external: true
name: docker_gitea-config
gitea-db:
external: true
name: docker_gitea-db
services:
gitea-db:
image: lscr.io/linuxserver/mariadb:latest
container_name: gitea-mariadb
restart: unless-stopped
environment:
- PUID=1000
- TZ=${TIMEZONE}
- MYSQL_DATABASE=${GITEA_DB_NAME}
- MYSQL_USER=${GITEA_DB_USER}
- MYSQL_PASSWORD=${GITEA_DB_PASS}
- MYSQL_ROOT_PASSWORD=${GITEA_DB_PASS}
volumes:
- gitea-db:/config
env_file:
- /home/pavel/docker/.env
networks:
- shared_network
gitea-server:
image: codeberg.org/forgejo/forgejo:11.0-rootless
container_name: gitea
restart: always
environment:
- FORGEJO__database__DB_TYPE=mysql
- FORGEJO__database__HOST=gitea-db:3306
- FORGEJO__database__NAME=${GITEA_DB_NAME}
- FORGEJO__database__USER=${GITEA_DB_USER}
- FORGEJO__database__PASSWD=${GITEA_DB_PASS}
- FORGEJO__server__ROOT_URL=https://git.pavelp.cz/
volumes:
#- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
- gitea-data:/var/lib/gitea
- gitea-config:/etc/gitea
ports:
- "8082:3000"
- "2222:2222"
depends_on:
- gitea-db
env_file:
- /home/pavel/docker/.env
networks:
- shared_network
networks:
shared_network:
external: true
Changelog
- 2024-06-29: Docker image from
7.0.4-rootless
to7.0-rootless
to get latest bugfix version without breaking changes. - 2024-12-25: Updated article validity for Gitea 1.22
- 2025-04-18: Addendum, Forgejo 11.0 LTS