Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
309e2cea
Commit
309e2cea
authored
Jan 17, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2650 from riyad/setup-task-warning
Improve setup task, by making it less dangerous
parents
4bb1664a
65c35466
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
21 deletions
+47
-21
doc/install/installation.md
doc/install/installation.md
+1
-1
doc/raketasks/maintenance.md
doc/raketasks/maintenance.md
+0
-13
lib/tasks/gitlab/setup.rake
lib/tasks/gitlab/setup.rake
+19
-7
lib/tasks/gitlab/task_helpers.rake
lib/tasks/gitlab/task_helpers.rake
+27
-0
No files found.
doc/install/installation.md
View file @
309e2cea
...
...
@@ -260,7 +260,7 @@ used for the `email.from` setting in `config/gitlab.yml`)
## Initialise Database and Activate Advanced Features
sudo -u gitlab -H bundle exec rake gitlab:
app:
setup RAILS_ENV=production
sudo -u gitlab -H bundle exec rake gitlab:setup RAILS_ENV=production
## Install Init Script
...
...
doc/raketasks/maintenance.md
View file @
309e2cea
### 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 RAILS_ENV=production
```
### Gather information about GitLab and the system it runs on
This command gathers information about your GitLab installation and the System
...
...
lib/tasks/gitlab/setup.rake
View file @
309e2cea
namespace
:gitlab
do
namespace
:app
do
desc
"GITLAB | Setup production application"
task
:setup
=>
[
'db:setup'
,
'db:seed_fu'
,
'gitlab:enable_automerge'
]
desc
"GITLAB | Setup production application"
task
:setup
=>
:environment
do
setup
end
def
setup
warn_user_is_not_gitlab
puts
"This will create the necessary database tables and seed the database."
puts
"You will lose any previous data stored in the database."
ask_to_continue
puts
""
Rake
::
Task
[
"db:setup"
].
invoke
Rake
::
Task
[
"db:seed_fu"
].
invoke
Rake
::
Task
[
"gitlab:enable_automerge"
].
invoke
rescue
Gitlab
::
TaskAbortedByUserError
puts
"Quitting..."
.
red
exit
1
end
end
lib/tasks/gitlab/task_helpers.rake
View file @
309e2cea
module
Gitlab
class
TaskAbortedByUserError
<
StandardError
;
end
end
namespace
:gitlab
do
# Ask if the user wants to continue
#
# Returns "yes" the user chose to continue
# Raises Gitlab::TaskAbortedByUserError if the user chose *not* to continue
def
ask_to_continue
answer
=
prompt
(
"Do you want to continue (yes/no)? "
.
blue
,
%w{yes no}
)
raise
Gitlab
::
TaskAbortedByUserError
unless
answer
==
"yes"
end
# Check which OS is running
#
# It will primarily use lsb_relase to determine the OS.
...
...
@@ -22,6 +35,20 @@ namespace :gitlab do
os_name
.
try
(
:squish!
)
end
# Prompt the user to input something
#
# message - the message to display before input
# choices - array of strings of acceptible answers or nil for any answer
#
# Returns the user's answer
def
prompt
(
message
,
choices
=
nil
)
begin
print
(
message
)
answer
=
STDIN
.
gets
.
chomp
end
while
choices
.
present?
&&
!
choices
.
include?
(
answer
)
answer
end
# Runs the given command and matches the output agains the given pattern
#
# Returns nil if nothing matched
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment