diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index 962f2175..ebd499c0 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -34,3 +34,6 @@ %li %h5= link_to "SSH keys", help_ssh_path + + %li + %h5= link_to "GitLab Rake Tasks", help_raketasks_path diff --git a/app/views/help/raketasks.html.haml b/app/views/help/raketasks.html.haml new file mode 100644 index 00000000..62cfa152 --- /dev/null +++ b/app/views/help/raketasks.html.haml @@ -0,0 +1,55 @@ +%h3.page_title GitLab Rake Tasks +.back_link + = link_to help_path do + ← to index +%hr + +%p.slead + GitLab provides some specific rake tasks to enable special features or perform maintenance tasks. + +%ul.nav.nav-tabs.log-tabs + %li.active + = link_to "Features", "#features", 'data-toggle' => 'tab' + %li + = link_to "Maintenance", "#maintenance", 'data-toggle' => 'tab' + %li + = link_to "User Management", "#user_management", 'data-toggle' => 'tab' + %li + = link_to "Backup & Restore", "#backup_restore", 'data-toggle' => 'tab' + +.tab-content + .tab-pane.active#features + .file_holder + .file_title + %i.icon-file + Features + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "raketasks", "features.md")) + + .tab-pane#maintenance + .file_holder + .file_title + %i.icon-file + Maintenance + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "raketasks", "maintenance.md")) + + .tab-pane#user_management + .file_holder + .file_title + %i.icon-file + User Management + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "raketasks", "user_management.md")) + + .tab-pane#backup_restore + .file_holder + .file_title + %i.icon-file + Backup & Restore + .file_content.wiki + = preserve do + = markdown File.read(Rails.root.join("doc", "raketasks", "backup_restore.md")) diff --git a/config/routes.rb b/config/routes.rb index 1e24e0a5..f1527977 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,6 +31,7 @@ Gitlab::Application.routes.draw do get 'help/system_hooks' => 'help#system_hooks' get 'help/markdown' => 'help#markdown' get 'help/ssh' => 'help#ssh' + get 'help/raketasks' => 'help#raketasks' # # Admin Area diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md new file mode 100644 index 00000000..575467b4 --- /dev/null +++ b/doc/raketasks/backup_restore.md @@ -0,0 +1,82 @@ +### Create a backup of the GitLab system + +Creates a backup archive of the database and all repositories. This archive will be saved in backup_path (see `config/gitlab.yml`). +The filename will be `[TIMESTAMP]_gitlab_backup.tar`. This timestamp can be used to restore an specific backup. + +``` +bundle exec rake gitlab:app:backup_create +``` + +Example output: + +``` +Dumping database tables: +- Dumping table events... [DONE] +- Dumping table issues... [DONE] +- Dumping table keys... [DONE] +- Dumping table merge_requests... [DONE] +- Dumping table milestones... [DONE] +- Dumping table namespaces... [DONE] +- Dumping table notes... [DONE] +- Dumping table projects... [DONE] +- Dumping table protected_branches... [DONE] +- Dumping table schema_migrations... [DONE] +- Dumping table services... [DONE] +- Dumping table snippets... [DONE] +- Dumping table taggings... [DONE] +- Dumping table tags... [DONE] +- Dumping table users... [DONE] +- Dumping table users_projects... [DONE] +- Dumping table web_hooks... [DONE] +- Dumping table wikis... [DONE] +Dumping repositories: +- Dumping repository abcd... [DONE] +- Dumping repository gitolite-admin.git... [DONE] +Creating backup archive: $TIMESTAMP_gitlab_backup.tar [DONE] +Deleting tmp directories...[DONE] +Deleting old backups... [SKIPPING] +``` + +### Restore a previously created backup + +``` +bundle exec rake gitlab:app:backup_restore +``` + +Options: + +``` +BACKUP=timestamp_of_backup (required if more than one backup exists) +``` + +Example output: + +``` +Unpacking backup... [DONE] +Restoring database tables: +-- create_table("events", {:force=>true}) + -> 0.2231s +[...] +- Loading fixture events...[DONE] +- Loading fixture issues...[DONE] +- Loading fixture keys...[SKIPPING] +- Loading fixture merge_requests...[DONE] +- Loading fixture milestones...[DONE] +- Loading fixture namespaces...[DONE] +- Loading fixture notes...[DONE] +- Loading fixture projects...[DONE] +- Loading fixture protected_branches...[SKIPPING] +- Loading fixture schema_migrations...[DONE] +- Loading fixture services...[SKIPPING] +- Loading fixture snippets...[SKIPPING] +- Loading fixture taggings...[SKIPPING] +- Loading fixture tags...[SKIPPING] +- Loading fixture users...[DONE] +- Loading fixture users_projects...[DONE] +- Loading fixture web_hooks...[SKIPPING] +- Loading fixture wikis...[SKIPPING] +Restoring repositories: +- Restoring repository abcd... [DONE] +- Restoring repository gitolite-admin.git... [DONE] +Deleting tmp directories...[DONE] +``` diff --git a/doc/raketasks/features.md b/doc/raketasks/features.md new file mode 100644 index 00000000..2a66b1ca --- /dev/null +++ b/doc/raketasks/features.md @@ -0,0 +1,36 @@ +### Enable usernames and namespaces for user projects + +This command will enable the namespace feature introduced in v4.0. It will move every project in its namespace folder. + +Note: + +* Because the **repository location will change**, you will need to **update all your git url's** to point to the new location. +* Username can be changed at [Profile / Account](/profile/account) + +**Example:** + +Old path: `git@example.org:myrepo.git` +New path: `git@example.org:username/myrepo.git` or `git@example.org:groupname/myrepo.git` + +``` +bundle exec rake gitlab:activate_namespaces +``` + + +### Enable auto merge + +This command will enable the auto merge feature. After this you will be able to **merge a merge request** via GitLab and use the **online editor**. + +``` +bundle exec rake gitlab:app:enable_automerge +``` + +Example output: + +``` +Creating satellite for abcd.git +[git clone output] +Creating satellite for abcd2.git +[git clone output] +done +``` diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md new file mode 100644 index 00000000..7bbb6571 --- /dev/null +++ b/doc/raketasks/maintenance.md @@ -0,0 +1,82 @@ +### Setup production application + +Runs the following rake tasks: + +* db:setup (Create the database, load the schema, and initialize with the seed data) +* db:seed_fu (Loads seed data for the current environment.) +* gitlab:app:enable_automerge (see "Features") + +``` +bundle exec rake gitlab:app:setup +``` + + +### Check GitLab installation status + +[Trouble-Shooting-Guide](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide) + +``` +bundle exec rake gitlab:app:status +``` + +Example output: + +``` +config/database.yml............exists +config/gitlab.yml............exists +/home/git/repositories/............exists +/home/git/repositories/ is writable?............YES +Can clone gitolite-admin?............YES +Can git commit?............YES +UMASK for .gitolite.rc is 0007? ............YES +/home/git/.gitolite/hooks/common/post-receive exists? ............YES + +Validating projects repositories: +* abcd.....post-receive file ok +* abcdtest.....post-receive file missing + +Finished + +``` + + +### Rebuild each key at gitolite config + +This will send all users ssh public keys to gitolite and grant them access (based on their permission) to their projects. + +``` +bundle exec rake gitlab:gitolite:update_keys +``` + + +### Rebuild each project at gitolite config + +This makes sure that all projects are present in gitolite and can be accessed. + +``` +bundle exec rake gitlab:gitolite:update_repos +``` + +### Import bare repositories into GitLab project instance + +Notes: + +* project owner will be a first admin +* existing projects will be skipped + +How to use: + +1. copy your bare repos under git base_path (see `config/gitlab.yml` git_host -> base_path) +2. run the command below + +``` +bundle exec rake gitlab:import:repos RAILS_ENV=production +``` + +Example output: + +``` +Processing abcd.git + * Created abcd (abcd.git) +[...] +``` diff --git a/doc/raketasks/user_management.md b/doc/raketasks/user_management.md new file mode 100644 index 00000000..e4ca5280 --- /dev/null +++ b/doc/raketasks/user_management.md @@ -0,0 +1,16 @@ +### Add user to as a developer to all projects + +``` +bundle exec rake add_user_to_project_teams[username@domain.tld] +``` + + +### Add all users to all projects + +Notes: + +* admin users are added as masters + +``` +bundle exec rake add_users_to_project_teams +```