Skip to content

Backup/Restore commands #1637

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
wants to merge 4 commits into from
Closed

Backup/Restore commands #1637

wants to merge 4 commits into from

Conversation

bkcsoft
Copy link
Member

@bkcsoft bkcsoft commented Apr 28, 2017

Backup/Restore commands! 🎉

NAME:                                                                                                                                                                                                                                                                           
   gitea backup - Backup files and database                                                                                                                                                                                                                                     

DESCRIPTION:
   Backup dumps and compresses all related files and database into zip file,
   which can be used for migrating Gitea to another server. The output format is meant to be
   portable among all supported database engines.

OPTIONS:
   --config FILE, -c FILE   Custom configuration FILE path (default: "custom/conf/app.ini")
   --tempdir PATH, -t PATH  Temporary directory PATH (default: "/tmp")
   --target PATH            Target directory PATH to save backup archive (default: "./")
   --verbose, -v            Show process details
   --db                     Backup the database (default: true)
   --repos                  Backup repositories (default: true)
   --data                   Backup attachments and avatars (default: true)
   --custom                 Backup custom files (default: true)
NAME:
   gitea restore - TBD

TODO-list:

Closes #1292

@bkcsoft bkcsoft added the pr/wip This PR is not ready for review label Apr 28, 2017
bkcsoft added 3 commits April 28, 2017 20:09
- cleanup cmd.Dump, with deprication notice
- don't prefic cmd-commands
@bkcsoft bkcsoft force-pushed the bkcsoft/restore-command branch from ae2bfd5 to 77ef391 Compare April 28, 2017 18:11
@bkcsoft
Copy link
Member Author

bkcsoft commented Apr 28, 2017

Currently seg-faults on dumping database. @lunny do you know why? 🙂

$ ./gitea backup                                                                                                                                                                                                                                                 
panic: runtime error: invalid memory address or nil pointer dereference                                                                                                                                                                                                         
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x849367]

code.gitea.io/gitea/modules/log.(*XORMLogBridge).ShowSQL(0x0, 0xc420188475, 0x1, 0x1)
        /home/bkc/sources/gopath/src/code.gitea.io/gitea/modules/log/xorm.go:134 +0x17
code.gitea.io/gitea/vendor/github.com/go-xorm/xorm.(*Engine).ShowSQL(0xc4201e8960, 0xc420188475, 0x1, 0x1)
        /home/bkc/sources/gopath/src/code.gitea.io/gitea/vendor/github.com/go-xorm/xorm/engine.go:53 +0x52
code.gitea.io/gitea/models.SetEngine(0xc420400140, 0x13351f4)
        /home/bkc/sources/gopath/src/code.gitea.io/gitea/models/models.go:265 +0x1c5
code.gitea.io/gitea/cmd.runBackup(0xc420400140, 0x0, 0x0)
        /home/bkc/sources/gopath/src/code.gitea.io/gitea/cmd/backup.go:82 +0xdb
code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x11d88a0, 0x1390aa8, 0xc420400140, 0xc420072000, 0x0)                                                                                                                                                            
        /home/bkc/sources/gopath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xb9                                                                                                                                                                          
code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x1334fd2, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x135e236, 0x19, 0x0, ...)                                                                                                                                                
        /home/bkc/sources/gopath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xb4b
code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc4200016c0, 0xc42008a060, 0x2, 0x2, 0x0, 0x0)                                                                                                                                                                     
        /home/bkc/sources/gopath/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x65f                                                                                                                                                                         
main.main()
        /home/bkc/sources/gopath/src/code.gitea.io/gitea/main.go:46 +0x455   

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 28, 2017
@bkcsoft bkcsoft requested review from lunny and appleboy April 28, 2017 18:25
@lunny lunny added this to the 1.3.0 milestone Apr 29, 2017
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Apr 29, 2017
}
setting.NewContext()
models.LoadConfigs()
models.SetEngine()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handle error

@lunny
Copy link
Member

lunny commented Aug 27, 2017

Any update @bkcsoft

@strk strk mentioned this pull request Aug 27, 2017
@bkcsoft
Copy link
Member Author

bkcsoft commented Aug 27, 2017

@lunny I'll see if I have time to look at this next week

@hoonetorg
Copy link

Regarding #2682:
When there will be a "gitea restore" command, there should be no reason to use zip iiac.
Also tgz can be handled fine in windows with a lot of programs afaik.

@bkcsoft
Copy link
Member Author

bkcsoft commented Oct 21, 2017

Yeah, I agree that when we have gitea restore we could go for compressed tar-archives instead. Esp. since it's builtin to the language (instead of yet another dependency) https://golang.org/pkg/archive/tar/

@elvarb
Copy link

elvarb commented Dec 6, 2017

Will this be completed soon?

@lafriks
Copy link
Member

lafriks commented Dec 6, 2017

@elvarb there is now other PR #2917

@elvarb
Copy link

elvarb commented Dec 6, 2017

@lafriks ok, glad to see lots of activity :)

@appleboy
Copy link
Member

appleboy commented Jan 2, 2018

@bkcsoft conflicts.

@bkcsoft
Copy link
Member Author

bkcsoft commented Jan 25, 2018

Closing this in favour of #2917

@bkcsoft bkcsoft closed this Jan 25, 2018
@lunny lunny removed this from the 1.x.x milestone Jan 25, 2018
@bkcsoft bkcsoft deleted the bkcsoft/restore-command branch July 4, 2018 22:13
@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
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. pr/wip This PR is not ready for review type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate backup/restore from Gogs
7 participants