Skip to content

Gitea migration in docker #5763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danst0 opened this issue Jan 18, 2019 · 12 comments
Closed

Gitea migration in docker #5763

danst0 opened this issue Jan 18, 2019 · 12 comments

Comments

@danst0
Copy link

danst0 commented Jan 18, 2019

I have a docker container with gitea (latest) running.
I just realized that gitea is not running anymore. The error in the log is:

019/01/18 20:48:58 [I] Migration: add approval whitelists to protected branches
2019/01/18 20:48:58 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Unknown col "is_empty" in index is_bare of table repository, columns [id owner_id lower_name name description website default_branch num_watches num_stars num_forks num_issues num_closed_issues num_pulls
num_closed_pulls num_milestones num_closed_milestones is_private is_empty is_mirror is_fork fork_id size created_unix updated_unix is_fsck_enabled topics]

After that Gitea restarts and repeats

gitea     | 2019/01/18 20:48:52 [T] AppPath: /app/gitea/gitea
gitea     | 2019/01/18 20:48:52 [T] AppWorkPath: /app/gitea
gitea     | 2019/01/18 20:48:52 [T] Custom path: /data/gitea
gitea     | 2019/01/18 20:48:52 [T] Log path: /data/gitea/log
gitea     | 2019/01/18 20:48:53 [T] AppPath: /app/gitea/gitea
gitea     | 2019/01/18 20:48:53 [T] AppWorkPath: /app/gitea
@zeripath
Copy link
Contributor

Hi!

It looks like you were unfortunately bitten by a bug in migration earlier. Have you downloaded the latest version of the docker again and changed the table version's value from 79 to 78

see #5762

@danst0
Copy link
Author

danst0 commented Jan 18, 2019

My version is 74... I migrated from an older installation.

@zeripath
Copy link
Contributor

OK, just check you have the absolute latest gitea docker. Then try running the migrate command.

@danst0
Copy link
Author

danst0 commented Jan 18, 2019

executing /app/gitea/gitea migrate as git user worked!
Thank you very much!

@MNickelson
Copy link

I'm currently having this issue on the gitea:latest being updated by watchtower. Running migrate is giving me that same error.
Can you point me to the documentation for how to stop gitea and change the table version?

@zeripath
Copy link
Contributor

Take a look at #5797

When did this happen?

@danst0
Copy link
Author

danst0 commented Jan 25, 2019

I'm currently having this issue on the gitea:latest being updated by watchtower. Running migrate is giving me that same error.
Can you point me to the documentation for how to stop gitea and change the table version?

In the end I did not need to change the version number, however I used sqlite3 on the database file to check the version. Were do you store your database? SQLite as well or mysql?

Since I am new to docker, I used portainer, which gives you an easy way to open an console into your container.

@zeripath
Copy link
Contributor

zeripath commented Jan 25, 2019

Hmm the db on sqlite is where you found it, on mysql it depends on the container providing it.

I need to just check what happened though.

What version of Gitea were you using and when did you upgrade to latest?

I'm worried that although our migration command works automigration isn't working.

@zeripath
Copy link
Contributor

For any future people looking for how to migrate on docker:

You can get to a command prompt on any docker running instance by: docker exec -i -t $IMAGE_ID /bin/bash -i

You can start a docker instance without running the entry point using docker start -i -t $IMAGE_ID /bin/bash -i

Once at a command line you can su -u git and change directory to /app/gitea and then run /app/gitea/gitea migrate


Please note I'm typing these commands from memory on my phone so some of the options might be slightly different but you should get the gist.

@MNickelson
Copy link

I'm also pretty new to docker, but this is what I've been able to put together.
I think I have an older version that doesn't seem to support the -t flag on the start command. I can log into the container though and running gitea --version spits out Gitea version d663930 built with go1.11.5 : bindata, sqlite, sqlite_unlock_notify
Looking through the logs, this problem appears to have started on the 18th (it's admittedly not a frequently used instance)

Going through the logs, the problem seems to start here:

2019/01/17 19:20:44 [W] parseRemoteUpdateOutput: unexpected update line " + 3818147...047e361 bugfix/idea-issues -> bugfix/idea-issues (forced update)"
2019/01/17 20:10:38 [W] parseRemoteUpdateOutput: unexpected update line " + 8532f6b...1e0c4bc refs/pull/137/head -> refs/pull/137/head (forced update)"
2019/01/17 20:45:34 [I] Log Mode: File(Info) 2019/01/17 20:45:34 [I] XORM Log Mode: File(Info)
2019/01/17 20:45:34 [I] Cache Service Enabled
2019/01/17 20:45:34 [I] Session Service Enabled
2019/01/17 20:45:34 [I] Git Version: 2.18.1
2019/01/17 20:45:35 [I] SQLite3 Supported 2019/01/17 20:45:35 [I] Run Mode: Production
2019/01/17 20:45:36 [I] Listen: http://0.0.0.0:3000
2019/01/17 20:45:36 [I] LFS server enabled
2019/01/18 00:55:33 [I] Log Mode: File(Info) 2019/01/18 00:55:33 [I] XORM Log Mode: File(Info)
2019/01/18 00:55:33 [I] Cache Service Enabled 2019/01/18 00:55:33 [I] Session Service Enabled
2019/01/18 00:55:33 [I] Migration: rename repo is_bare to repo is_empty 2019/01/18 00:55:34 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Unknown col "is_empty" in index is_bare of table
repository, columns [id owner_id lower_name name description website default_branch num_watches num_stars num_forks num_issues num_closed_issues num_pulls num_closed_pulls num_
milestones num_closed_milestones is_private is_empty is_mirror is_fork fork_id size created_unix updated_unix is_fsck_enabled topics]

The unexpected update line is preceded by number of similar lines with different commits.

@zeripath
Copy link
Contributor

zeripath commented Jan 26, 2019

Yeah you were bitten by the broken migrate. Update your docker and follow the instructions in #5797 in particular

#5797 (comment)

@MNickelson
Copy link

Thanks for your help

DROP INDEX IF EXISTS IDX_repository_is_bare;

and then restarting did the trick.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants