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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
e65cc4f8
Commit
e65cc4f8
authored
Feb 16, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2994 from dasbh/master
Fix gitlab:setup task on fresh installation
parents
d6394a00
4bc7d98d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
+15
-9
lib/gitlab/backend/shell.rb
lib/gitlab/backend/shell.rb
+10
-5
lib/tasks/gitlab/setup.rake
lib/tasks/gitlab/setup.rake
+2
-2
lib/tasks/gitlab/shell.rake
lib/tasks/gitlab/shell.rake
+3
-2
No files found.
lib/gitlab/backend/shell.rb
View file @
e65cc4f8
...
...
@@ -10,7 +10,7 @@ module Gitlab
# add_repository("gitlab/gitlab-ci")
#
def
add_repository
(
name
)
system
(
"
/home/git
/gitlab-shell/bin/gitlab-projects add-project
#{
name
}
.git"
)
system
(
"
#{
gitlab_shell_user_home
}
/gitlab-shell/bin/gitlab-projects add-project
#{
name
}
.git"
)
end
# Import repository
...
...
@@ -21,7 +21,7 @@ module Gitlab
# import_repository("gitlab/gitlab-ci", "https://github.com/randx/six.git")
#
def
import_repository
(
name
,
url
)
system
(
"
/home/git
/gitlab-shell/bin/gitlab-projects import-project
#{
name
}
.git
#{
url
}
"
)
system
(
"
#{
gitlab_shell_user_home
}
/gitlab-shell/bin/gitlab-projects import-project
#{
name
}
.git
#{
url
}
"
)
end
# Remove repository from file system
...
...
@@ -32,7 +32,7 @@ module Gitlab
# remove_repository("gitlab/gitlab-ci")
#
def
remove_repository
(
name
)
system
(
"
/home/git
/gitlab-shell/bin/gitlab-projects rm-project
#{
name
}
.git"
)
system
(
"
#{
gitlab_shell_user_home
}
/gitlab-shell/bin/gitlab-projects rm-project
#{
name
}
.git"
)
end
# Add new key to gitlab-shell
...
...
@@ -41,7 +41,7 @@ module Gitlab
# add_key("key-42", "sha-rsa ...")
#
def
add_key
(
key_id
,
key_content
)
system
(
"
/home/git
/gitlab-shell/bin/gitlab-keys add-key
#{
key_id
}
\"
#{
key_content
}
\"
"
)
system
(
"
#{
gitlab_shell_user_home
}
/gitlab-shell/bin/gitlab-keys add-key
#{
key_id
}
\"
#{
key_content
}
\"
"
)
end
# Remove ssh key from gitlab shell
...
...
@@ -50,11 +50,16 @@ module Gitlab
# remove_key("key-342", "sha-rsa ...")
#
def
remove_key
(
key_id
,
key_content
)
system
(
"
/home/git
/gitlab-shell/bin/gitlab-keys rm-key
#{
key_id
}
\"
#{
key_content
}
\"
"
)
system
(
"
#{
gitlab_shell_user_home
}
/gitlab-shell/bin/gitlab-keys rm-key
#{
key_id
}
\"
#{
key_content
}
\"
"
)
end
def
url_to_repo
path
Gitlab
.
config
.
gitlab_shell
.
ssh_path_prefix
+
"
#{
path
}
.git"
end
def
gitlab_shell_user_home
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
gitlab_shell
.
ssh_user
}
"
)
end
end
end
lib/tasks/gitlab/setup.rake
View file @
e65cc4f8
namespace
:gitlab
do
desc
"GITLAB | Setup production application"
task
:setup
=>
:environment
do
setup
setup
_db
end
def
setup
def
setup
_db
warn_user_is_not_gitlab
puts
"This will create the necessary database tables and seed the database."
...
...
lib/tasks/gitlab/shell.rake
View file @
e65cc4f8
...
...
@@ -25,12 +25,13 @@ namespace :gitlab do
def
setup
warn_user_is_not_gitlab
gitlab_shell_authorized_keys
=
File
.
join
(
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
gitlab_shell
.
ssh_user
}
"
),
'.ssh/authorized_keys'
)
puts
"This will rebuild an authorized_keys file."
puts
"You will lose any data stored in
/home/git/.ssh/authorized_keys
."
puts
"You will lose any data stored in
#{
gitlab_shell_authorized_keys
}
."
ask_to_continue
puts
""
system
(
"echo '# Managed by gitlab-shell' >
/home/git/.ssh/authorized_keys
"
)
system
(
"echo '# Managed by gitlab-shell' >
#{
gitlab_shell_authorized_keys
}
"
)
Key
.
find_each
(
batch_size:
1000
)
do
|
key
|
if
Gitlab
::
Shell
.
new
.
add_key
(
key
.
shell_id
,
key
.
key
)
...
...
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