Skip to content

gogs restore in Docker failure - GOGS_CUSTOM /data/gogs is moved #7684

Open
@vallon

Description

@vallon

Gogs version

v0.13.0

Git version

  • Server: n/a
  • Client: n/a

Operating system

Docker v0.13.0

Database

sqlite3

Describe the bug

I've had some trouble migrating from a non-Docker installation of gogs to a dockerized version. I dumped the old gogs version 0.11.91.0811, and then tried to load into the docker container with:

source /app/gogs/docker/s6/gogs/setup # creates log symlinks
gosu $USER mkdir /data/tmp # same vol as /data so rename works
gosu $USER /app/gogs/gogs restore --verbose --from /restore/gogs-backup.zip --config /restore/app.ini --tempdir /data/tmp

But, after this, I end up with:

/data/git/...
/data/gogs/ (empty)
/data/gogs.bak/data/gogs.db
/data/gogs.bak/conf
/data/gogs.bak/log/...

It appears to be:

  1. ENV GOGS_CUSTOM /data/gogs
    sets GOGS_CUSTOM=/data/gogs
  2. func CustomDir() string {
    computes conf.CustomDir() to be getenv("GOGS_CUSTOM") with fallback to WorkDir()/"custom".
  3. conf.CustomDir() is "/data/gogs"
  4. if osutil.IsDir(conf.CustomDir()) {
    tries to restore "$archivedir/custom" directory by renaming the old $GOGS_CUSTOM to $GOGS_CUSTOM.bak, then moving the archive/custom dir to $GOGS_CUSTOM.

That has renamed /data/gogs/data/gogs.db to /data/gogs.bak/data/gogs.db.

To reproduce

It seems what is required:

  • gogs restore in Docker (where GOGS_CUSTOM=/data/gogs)
  • backup archive contains a "custom" dir (v0.11.91.0811 backup fails if there is no custom dir)
  • database.type = sqlite3; database.path = data/gogs.db

Expected behavior

database should be in correct place after restore.

Since I am starting with a fresh /data directory, my workaround is to mv /data/gogs.bak/* /data/gogs/.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    💊 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions