Gitea: Migration from latest gogs (0.11.46.0418) is possible

Created on 21 Jun 2018  路  24Comments  路  Source: go-gitea/gitea

The gitea documentation says you must upgrade from 0.9.146 of gogs, but (at least anecdotally) I'm able to upgrade from the latest version as of this writing (0.11.46.0418). I may submit a PR to the docs after I've run this in production for a few weeks, but for now I want to write this up so others can find it if necessary.

  • Gitea version (or commit ref): 1.4.2+6-gcaee487 built with: bindata, sqlite
  • Git version: 2.15.2
  • Operating system: Alpine Linux 3.7.0
  • Database (use [x]):

    • [ ] PostgreSQL

    • [ ] MySQL

    • [ ] MSSQL

    • [x] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [ ] Yes (provide example URL)

    • [ ] No

    • [x] Not relevant

Description

I migrated from one Docker image to another.

In addition to the steps outlined in the Upgrade from gogs doc, I also had to change every instance of gogs in my conf/app.ini file to gitea. I also had to change my PATH (under [database]) to /data/gitea/data/gitea.db (the gogs container has symlinks from /app that gitea doesn't). Also my ROOT_PATH (under log) changed from /app/gogs/log to /data/gitea/log.

Once I did that, I had gitea 1.0.2 working. Two more changes I had to make owing to my newer gogs version:

  • I had to regenerate my .ssh/authorized_keys file (from the Web UI's admin panel). Failure to do this resulted in the following error:
bash: /app/gogs/gogs: No such file or directory                                                          
fatal: Could not read from remote repository.
  • gogs generated a bunch of git hooks that reference the gogs binary. You can delete them from the UI or the command line (see the find command at https://github.com/go-gitea/gitea/issues/3558#issuecomment-372429183). If you don't delete them you'll receive the following error:
remote: ./hooks/pre-receive.d/pre-receive: line 2: /app/gogs/gogs: No such file or directory             
To ssh://git.example.com:10022/user/repo.git                                 
 ! [remote rejected]   master -> master (pre-receive hook declined) 

Finally - SSH push/pulls didn't work properly for me even after doing all these things until I upgraded to version 1.4. I couldn't upgrade directly - I assume this is related to #4424 - but I was able to go 1.0 禄 11 禄 1.2 禄 1.3 禄 1.4 painlessly. Once I was on 1.4 everything worked properly.

kindocs stale

Most helpful comment

Just upgraded latest Gogs 0.11.66 to Gitea 1.5.1 :+1:

I copied my gogs mysql database, followed https://docs.gitea.io/en-us/upgrade-from-gogs/, edited my app.ini and upgraded from 1.0.2 > 1.1.4 > 1.2.3 > 1.3.3 > 1.4.3 > 1.5.1. A direct upgrade from 1.02 to 1.5.1 failed, so I upgraded step by step.
Afterwards go to Admin panel and regenerate hooks, update ssh keys etc.

Edit: Have a look in gitea-repositories and search for gogs grep -R gogs. There might be some hook leftovers you have to delete.

So far everything seems to work as expected :+1:

All 24 comments

Please feel free to send a PR

I'm going to wait until this has been in production for a while before submitting a PR. I didn't analyze the database structure between a fresh gitea db and my own, for instance.

Have you run into any issues so far?

@furai No, I haven't. I feel pretty confident at this point in what I did, so I'll make a TODO for myself to submit a PR to the documentation.

Did you compare the databases?

@furai I haven't - which is why I need to set aside some time for this task. I was a bit glib in suggesting I just needed to write up my docs.

Thanks, this seems to have worked for me starting from gogs 0.11.56.x.
Obviously I don't know if there are any DB inconsistencies. The DB migration process printed a bunch of yellow warnings (?) while migrating gitea from 1.0 to latest via the different 1.x releases, but maybe that's expected.

Thanks for the instructions鈥攊t was a quick and easy transition from the latest version of Gogs to 1.0.2 and then slowly to 1.1, 1.2, 1.3, 1.4 and finally 1.5. I could've probably went straight to 1.5 but I wanted to play it safe.
I haven't encountered any problem yet but my DB was pretty small.

I'm mostly interested whether PR and comments get migrated and all the settings for webhooks and git hooks. That's the most important thing for me.

I just migrated personally and yes, they all migrated with it. The only thing that had a problem was Discord web hooks had to be manually fixed in the database. (Gogs marks them as ID 3, Gitea is 4. So a simple query fixes it.) My experience with moving to Gitea here: https://github.com/go-gitea/gitea/issues/4538

That's good news. What secret are you talking about in your issue? What can it be used for? I'm trying to figure out if my users might have been relying on it.

With the web hooks, there is a secret key that can be sent with the hooks request. On Gogs, this was more recently changed on how it was sent. It used to be sent as "secretkey" inside of the data (json blob) but was changed to be a header and was also changed to be a hash of the key vs. the raw key itself.

On Gitea, this is reverted back to the old setup of Gogs where its sent in the data and is the raw key.

On Gitea, this is reverted back

To be clear it was not reverted back, Gitea forked from Gogs at a certain point, and no developer contributed the code to Gitea that was contributed to Gogs. There is a ticket for this functionality to be added, however no developer has taken up the cause to add it to Gitea. Perhaps you could.

Edit: #3901 is the ticket I am referencing.

Just upgraded latest Gogs 0.11.66 to Gitea 1.5.1 :+1:

I copied my gogs mysql database, followed https://docs.gitea.io/en-us/upgrade-from-gogs/, edited my app.ini and upgraded from 1.0.2 > 1.1.4 > 1.2.3 > 1.3.3 > 1.4.3 > 1.5.1. A direct upgrade from 1.02 to 1.5.1 failed, so I upgraded step by step.
Afterwards go to Admin panel and regenerate hooks, update ssh keys etc.

Edit: Have a look in gitea-repositories and search for gogs grep -R gogs. There might be some hook leftovers you have to delete.

So far everything seems to work as expected :+1:

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

I was able to directly update from gogs 0.11.79 (archlinux aur) to gitea 1.7.1 (archlinux community) with postgres.

Steps done:

  • Stop Gogs and backup everything
  • Downgrade database to older version update version set version = 13
  • Install gitea (reconfigure, change permission, change paths, ...)
  • Delete old git hooks: rm /var/lib/gitea/repo/*/*.git/hooks/post-receive.d/post-receive /var/lib/gitea/repo/*/*.git/hooks/pre-receive.d/pre-receive and execute Resynchronize pre-receive, update and post-receive hooks of all repositories. in gitea

Afterwards everything was working. While I would not necessarily recommend it, at least I want to mention that it's possible.

(ref: https://github.com/go-gitea/gitea/issues/5318)

Where "update version set version = 13" should be executed?

@KuDeSnik33ra in your database tools connected to Gitea database

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

Migration itself worked fine from gogs 0.11, but all my users were ldap users (except one admin user) and they are not able to login anymore.
The users are there, all have the correct auth source, the ldap auth-settings itself are correct too, but i can't select the auth-method on the login page.

I'm using sqlite database and can't see any other errors in the log or any other place, any idea?

You don't need to select auth method on login page. If you have configured and enabled auth source in login page users should authorize standard username/password login

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

This issue has been automatically closed because of inactivity. You can re-open it if needed.

Where "update version set version = 13" should be executed?

It is a SQL update on the Gogs database. Postgresql in my case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fastidious picture Fastidious  路  3Comments

adpande picture adpande  路  3Comments

tuxfanou picture tuxfanou  路  3Comments

jonasfranz picture jonasfranz  路  3Comments

cookiengineer picture cookiengineer  路  3Comments