mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-24 23:46:30 -05:00
Gitea persistent storage config #6746
Closed
opened 2025-11-02 07:05:18 -06:00 by GiteaMirror
·
32 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v1.16.1
v1.16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1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#6746
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @songmeo on GitHub (Jan 24, 2021).
Gitea version: 1.13.1
Description
https://github.com/go-gitea/gitea/issues/14176#issuecomment-752671335
It's not documented that only data partition is persistent and everything under /app/gitea/data is not. This is not only about avatars but also other things like attachments, mail queues, etc. What if people restart their Gitea instances and find out that all data not under /data is lost?
@t-rood commented on GitHub (Jan 30, 2022):
here, too. easy to showcase by removing the container and adding back in. is it "supported" to add a volume link to /app/gitea/data AFTER the initial setup has completed or can we move the respective locations back to the default mapped volume path using app.ini?
@wxiaoguang commented on GitHub (Jan 31, 2022):
It sounds like this problem need to be looked into
@lafriks commented on GitHub (Jan 31, 2022):
It's not supposed to have something in
/app/gitea/data. How did it end up there?Everything should be under
/datahttps://github.com/go-gitea/gitea/blob/main/Dockerfile#L59
or under
/var/lib/giteaand/etc/giteafor rootless docker:https://github.com/go-gitea/gitea/blob/main/Dockerfile.rootless#L68
@t-rood commented on GitHub (Jan 31, 2022):
when I upload a custom avatar picture for a user or an organization, they are displayed fine even after container restart. If I then throw away and recreate the docker container, the icons are broken. I use the default folder/volume mappings as shown below, so where are those uploads stored if not on /data mapping?
this is my compose.yml extract:
@lafriks commented on GitHub (Jan 31, 2022):
What values for paths do you have in app.ini?
@t-rood commented on GitHub (Jan 31, 2022):
copied from runtime instance right after first initialization, as below:
@lafriks commented on GitHub (Jan 31, 2022):
Just noticed in issue description it says you are running 1.13.1, that's right? It's quite old one
@lafriks commented on GitHub (Jan 31, 2022):
You should upgrade to at least 1.15.x or 1.16.0. I think there have been quite a lot changes related to paths as we have quite same bunch of problems due to how historically paths was handled
@t-rood commented on GitHub (Jan 31, 2022):
I added back to a historic thread, my bad. I'm deploying via :latest tag which displays "1.16.0 built with GNU Make 4.3, go1.17.6"
@t-rood commented on GitHub (Jan 31, 2022):
and I started with this version. never used any older build. just sayin'. But isn't it "interesting" I'm facing the same historic issue, so maybe a regression?
@lafriks commented on GitHub (Jan 31, 2022):
I just spent 10 minutes looking for this issue :D it's 2021 jan not 2022 :D
Anyway I can not reproduce this issue. Just deployed new gitea instance with
:latesttag and all paths are correct.I used such stack yaml:
@t-rood commented on GitHub (Jan 31, 2022):
read again please. I didn't claim about app.ini malfunction. I use the above defaults, upload a custom avatar png to both the organization and the user profile, redeploy the container using the previous /data mapping and the avatars are broken. So they obviously are NOT saved into /data, but elsewhere....
@lafriks commented on GitHub (Jan 31, 2022):
yes, by paths are correct I meant that attachments/avatars etc are saved in
/datasubdirectories.@lafriks commented on GitHub (Jan 31, 2022):
and nothing is lost between container restarts (even user session data)
@t-rood commented on GitHub (Jan 31, 2022):
if I restart the container, the avatars are still there. if I redeploy the container, they are lost. so this prooves they are etiher not in /data or the linkage to custom avatar pngs is not preserved in /data or database. result is the same: persistency is not preserved when upgrading to a never build or containers get moved around. that's not how docker is designed to be.
@lafriks commented on GitHub (Jan 31, 2022):
just removed and created new stack and all is working:

@t-rood commented on GitHub (Jan 31, 2022):
when I do the same, I have broken rectangles around custom avatars. only the build-in ones work fine.
@lafriks commented on GitHub (Jan 31, 2022):
do you have docker swarm with multiple hosts? could be that
/volume1/dockeris not the same on all of them?also I noticed your app.ini is quite different from one gitea generated for me:
@t-rood commented on GitHub (Jan 31, 2022):
I'm using sqlite3(local) and you postgress but that's it all. I'm using a single-node repro, so the volume is perfectly mounted all the time. otherwise my repositoriers wouldn't show up after redeploying...
@lafriks commented on GitHub (Jan 31, 2022):
You are also missing
picture,attachmentsections and quite some other settings (ex.PROVIDER_CONFIGundersessions)@lafriks commented on GitHub (Jan 31, 2022):
these missing could be your problem:
@t-rood commented on GitHub (Jan 31, 2022):
that has been the originally created app.ini before I used the mountpoint so it came right out of initialization on containers first time launch when the gitea has be spawn - it was not a download from "elsewhere" on the internet. when I drill the filesystem of my running container I see the avatars landing in /app/gitea/data/avatars and this is the original post in this thread. so the issue directly comes from the "factory" app.ini. for sure I can take your additional path sections but I'm wondering why the initialization sequence is that much broken.
@t-rood commented on GitHub (Jan 31, 2022):
and is that "everything" now when it comes to path adjustments as the "default" seems not really been fixed to /data at all? When paths are ommitted, they should not end up in /app/gitea/data....
@t-rood commented on GitHub (Jan 31, 2022):
actually have these all under /app/gitea/data:
and not all of them are part of your ini, too. when you drill down your running container, is /app/gitea/data empty at all?
@lafriks commented on GitHub (Jan 31, 2022):
I do not have even
/app/gitea/datadirectory created, there is only /app/gitea/gitea binary.Mine was also generated by gitea, so it's hard to tell how did you end up with different app.ini than me.
GItea (when it was forked from Gogs years ago) inherited behavior that paths by default are relative to the binary so we have been dealing with that for quite some time and it could be that not all places have been tracked down yet. As we try to keep breaking changes to minimum and it can be hard to maintain that balance.
@t-rood commented on GitHub (Jan 31, 2022):
from a docker perspective I don't see how can handle the relative paths to gitea binary other than what I observe now. and I can recreate the issue over and over.
thinking what's easier now: fixing each misleading relative path by app.ini [and your ini doesn't cover all folders yet, too, even if your dir tree even doesn't exist] , or adding an additional persistency mount point to the /app/gitea/data directory - so back to what @songmeo pointed out a year ago?
@t-rood commented on GitHub (Jan 31, 2022):
could it happen because of the sqlite3 localdb driver instead of remotesql with postgres? just guessing.
@lafriks commented on GitHub (Jan 31, 2022):
All new paths added in latest versions to gitea are not relative to binary but to
APP_DATA_PATH. It does not matter sqlite or postgres.Also I have been running multiple gitea instances in docker and none have been problems with paths in between upgrades (without changing app.ini), so I would say it's stabilized now
@t-rood commented on GitHub (Jan 31, 2022):
then I'll go for the APP_DATA_PATH, which is also not in my app.ini yet, for whatever reason. but I can change this for sure. ;-) thnx.
@lafriks commented on GitHub (Jan 31, 2022):
Oh, I missed that somehow.
APP_DATA_PATHis actually most important one 😆@t-rood commented on GitHub (Jan 31, 2022):
ready for closure. thnx again.
@lafriks commented on GitHub (Jan 31, 2022):
I will close issue as I can't reproduce issue with not correctly generated app.ini (nor for new, nor with upgrade from older versions)