flipswitchingmonkey / gitea-spk

spk (Synology package) to install gitea into Synology NAS
MIT License
105 stars 23 forks source link

How to update Gitea version on Synology #21

Open alsmnn opened 5 years ago

alsmnn commented 5 years ago

Hey and thanks for the great work with the synology package. I'm running Gitea 1.6.1 on my Synology Diskstation and I would like to upgrade to the latest release of Gitea. How can I do that without risking any data loss on the Diskstation? Do I just have to stop the running instance of Gitea and install a "new" package manually?

Thanks and best regards, @AljoLe

Kasurus commented 5 years ago

Hey, i just did a update from 1.7.2 to 1.7.4 on my Synology DS215j. Seems to work perfectly fine. I performed the following steps:

  1. Do a Backup
  2. Move the gitea-dump-1482906742.zip to a different folder. the /usr/local/gitea/gitea folder will be overwritten. (if you are using https you will want to backup your key.pem and cert.pem files. or store them permanently in a different folder that does not get overwritten. i did not do that.)
  3. Stop gitea in the synology paket-centre
  4. Install the new version via the paket-centre
  5. Gitea was not able to start, because i did not backup the SSL/TLS certificates in step 2. so i had to generate new ones.
  6. For ssh to work i had to execute the rewrite „.ssh/authorized_keys“-file option from the gitea admin-dashboard
  7. After that it just worked as before the update
alsmnn commented 5 years ago

Thanks for the answer. When gitea is installed for the first time, the internal user gitea will be created. What is the standard password for that user? I need this in order to perform a backup. Thanks in advance

alsmnn commented 5 years ago

I managed to switch to the gitea user, but the dump command doesn't work. It throws the following error:
Failed to connect to database: Unknown database type: I am using MariaDB 10 with Version 10.3.7-0051 Any suggestions? I can save all these files manually, but I would prefer the dump command. I have all the repositories on /volume1/git/gitea/, are they save if I install the new version or should I back them up separately?

Kasurus commented 5 years ago

I am using the same MariaDB Version and did not get an error. Perhaps ask/look at the gitea forum? In my case the repos are stored in /usr/local/gitea/gitea/gitea-repositories and there were no issues after the update. I am still testing gitea so i was not too worried about the update failing. i am not shure what happens when you update your version....

alsmnn commented 5 years ago

I made a manual backup and everything else worked just fine. Thank you for the help! Can be closed now

VitaliyAT commented 4 years ago

I made a manual backup and everything else worked just fine. Thank you for the help! Can be closed now

No. Because it's not clear what did you do manually, but this is common theme and all search engines link here. Do not make trash from theme. We already have lot of dirty pages around Internet like a spam that have no structured and useful.

For example, right now I have old gitea on MariaDB10 compiled and installed by me few years ago. According some video on YT. Apologize all of us made it so. I don't even remember folder where it was installed. And I don't understand where is what. What in DataBase, what in files. That's why I ask about step-by-step to-do list for upgrade gitea on Synology.

Or other idea was migrate to Docker updatable gitea. But it ask me about data base on first run and I am not sure that it will not be deleted or damaged. I prefer use already fulled database instead manually copy-past from old one to new. May be some have such expirience like migrate from "compiled, normally not upgradeble gitea" to "upgadable docker's gitea" on Synology DSM?

wkobiela commented 4 years ago

VitaliyAT, create backup - follow steps mentioned here https://github.com/flipswitchingmonkey/gitea-spk/issues/29 then: cd /usr/local/gitea/gitea/ ./gitea dump -c /usr/local/gitea/gitea/custom/conf/app.ini this dump includes your custom conf file. Move dump file to somewhere safe.

And then run script mentioned in my issue from console, to update Gitea. https://github.com/flipswitchingmonkey/gitea-spk/issues/30 Just save this as script.sh in file manager, then navigate to that folder using SSH and run ./script.sh dont forget to change lines 24 and 34 depending on your CPU architecture.

This should work, if you have gitea installed from package center as .spk.

VitaliyAT commented 4 years ago

Not working good:

:/usr/local/gitea/gitea$ ./gitea dump -c /usr/local/gitea/gitea/custom/conf/app.ini 2020/07/20 10:04:39 ...s/setting/setting.go:671:NewContext() [F] Failed to create '/var/services/homes/tester1/.ssh': mkdir /var/services/homes: permission denied

OK, let's try it through sudo:

2020/07/20 10:04:45 ...s/setting/setting.go:831:NewContext() [F] Expect user 'gitea' but current user is: root

Hmm, restart session and try login as gitea user

Access denied

OK, let's give gitea user rights for using SSH. Go to DSM Control Panel Users - no I have not gitea user at all.

Do you have any suggestions?

вт, 16 июн. 2020 г. в 13:59, Wuszek notifications@github.com:

VitaliyAT, create backup - follow steps mentioned here

29 https://github.com/flipswitchingmonkey/gitea-spk/issues/29

then: cd /usr/local/gitea/gitea/ ./gitea dump -c /usr/local/gitea/gitea/custom/conf/app.ini this dump includes your custom conf file. Move dump file to somewhere safe.

And then run script mentioned in my issue from console, to update Gitea.

30 https://github.com/flipswitchingmonkey/gitea-spk/issues/30

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flipswitchingmonkey/gitea-spk/issues/21#issuecomment-644633578, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMQJOFOO6QERH2AEY6YCTTRW4X7NANCNFSM4G2IDA5A .

wkobiela commented 4 years ago

Change to user gitea in terminal using su - gitea

if its not working, do the following: sudo -i cd /etc vi group administration -> add gitea to that group, just type gitea among other users there save it

vi passwd /var/packages/Gitea/target -change to-> /var/packages/Gitea/target/gitea /sbin/nologin target -change to-> /bin/sh save it

after this, You should be able to change user to "gitea" by su - gitea and do the backup as mentioned higher in this topic

VitaliyAT commented 4 years ago

1st part is OK - add user to group and create dump... But for some reasons dump file size is jusk 4kilobites. My database not less ten 100Mb. Apologize, it's not the correct dump, isn't it?

Why so? What can it be?

пн, 20 июл. 2020 г. в 11:53, Wuszek notifications@github.com:

Change to user gitea in terminal using su - gitea

if its not working, do the following: sudo -i cd /etc vi group administration -> add gitea to that group, just type gitea among other users there save it

vi passwd /var/packages/Gitea/target -change to-> /var/packages/Gitea/target/gitea /sbin/nologin target -change to-> /bin/sh save it

after this, You should be able to change user to "gitea" by su - gitea and do the backup as mentioned higher iht this topic

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flipswitchingmonkey/gitea-spk/issues/21#issuecomment-660840192, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMQJOGRSYKNV6FU2HXGTCLR4PSXPANCNFSM4G2IDA5A .

wkobiela commented 4 years ago

First of all login to SSH, change to root sudo -i than, change to gitea su - gitea than, go to cd /usr/local/gitea/gitea/ now, try to create buckup without custom conf ./gitea dump if it works, in /usr/local/gitea/gitea there will be file named gitea-dump-some-numbers after that, I just move dump file somewhere where I can download it from DSM mv gitea-dump-... /volume1/homes/.../

Just tried, works fine, my backup is around 50mb

VitaliyAT commented 4 years ago

1) According this https://docs.gitea.io/en-us/backup-and-restore/page I should see something like:

2016/12/27 22:32:09 Creating tmp work dir: /tmp/gitea-dump-417443001 2016/12/27 22:32:09 Dumping local repositories.../home/git/gitea-repositories 2016/12/27 22:32:22 Dumping database... 2016/12/27 22:32:22 Packing dump files... 2016/12/27 22:32:34 Removing tmp work dir: /tmp/gitea-dump-417443001 2016/12/27 22:32:34 Finish dumping in file gitea-dump-1482906742.zip

But I see just:

$ ./gitea dump -c /usr/local/gitea/gitea/custom/conf/app.ini 2020/07/20 15:18:08 ...dules/setting/git.go:83:newGit() [I] Git Version: 2.26.2, Wire Protocol Version 2 Enabled

2) Found folder and file in /tmp folder... But it has a bad structure. Inside it has no any app.ini or any files in the root folder. Just database folder, size around 1Gb 3) If I try dump second time - I found other folder with gitea-repo.zip with size just 4kb (empty inside)

пн, 20 июл. 2020 г. в 13:31, TheJtrg t.vitaliy.a@gmail.com:

1st part is OK - add user to group and create dump... But for some reasons dump file size is jusk 4kilobites. My database not less ten 100Mb. Apologize, it's not the correct dump, isn't it?

Why so? What can it be?

пн, 20 июл. 2020 г. в 11:53, Wuszek notifications@github.com:

Change to user gitea in terminal using su - gitea

if its not working, do the following: sudo -i cd /etc vi group administration -> add gitea to that group, just type gitea among other users there save it

vi passwd /var/packages/Gitea/target -change to-> /var/packages/Gitea/target/gitea /sbin/nologin target -change to-> /bin/sh save it

after this, You should be able to change user to "gitea" by su - gitea and do the backup as mentioned higher iht this topic

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flipswitchingmonkey/gitea-spk/issues/21#issuecomment-660840192, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMQJOGRSYKNV6FU2HXGTCLR4PSXPANCNFSM4G2IDA5A .

wkobiela commented 4 years ago

Here is GIF, where I show you how to create dump, how it should look and where the dump is when its ready. Gitea dump gif