Skip to content

gitolite_tmp_dir not (re)created, write access not properly checked in Config Test #327

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
FlorianMuenchbach opened this issue Jan 19, 2015 · 12 comments
Assignees
Labels

Comments

@FlorianMuenchbach
Copy link

Hi!

I've just setup a new redmine server with gitolite (working when used without redmine) and this plugin.

Just in case it matters:
Redmine is running in a subdirectory instead of port 3000, I changed the routes in [REDMINE]/config/routes.rb and for all the plugins as well.
Git hosting is configured to use another configuration file (includes/redmine.conf).

I am using redmine 2.6.0.stable, gitolite v3.6.2-12 and redmine_git_hosting v0.8-beta.

I tried to create a new repository but it did not work, so I investigated the logs and found:
ERROR [GitHosting] Error while getting Gitolite physical repositories list
I've been playing arround with the settings for a while and "rescued" everything several times but it did not help: the error remains and all the parameters in Config Test are green...
In the end I deleted gitolite_tmp_dir at /tmp/redmine_git_hosting/git/gitolite-admin.git (actualy I deleted everything below redmine_git_hosting) and restarted the server. I had the hope it will recover itself.
What I got then was:

INFO [GitHosting] Create tmp directory : '/tmp/redmine_git_hosting/git/gitolite-admin.git'
INFO [GitHosting] Testing if Gitolite user 'git' can sudo to Redmine user 'redmine'...
INFO [GitHosting] OK!
INFO [GitHosting] Testing if Redmine user 'redmine' can sudo to Gitolite user 'git'...
INFO [GitHosting] OK!
INFO [GitHosting] Unset Git hooks global parameter : multimailhook.smtpuser
INFO [GitHosting] Unset Git hooks global parameter : multimailhook.smtppass
INFO [GitHosting] Installing Redmine Gitolite mirroring SSH keys ...
INFO [GitHosting] Done !
ERROR [GitHosting] Error while getting Gitolite physical repositories list

But /tmp/redmine_git_hosting/git/gitolite-admin.git was not recreated. It still appeared in green in Config Test.

I recreated the folders manually but it remains empty, whatever I do. Also Config Test seems not to realize if the redmine user does not have write permissions for the folder at all.

Even after a full server reboot the problem remained and gitolite_tmp_dir is not recreated.

@FlorianMuenchbach
Copy link
Author

Some more info:
git hosting seems to be doing something with the gitolite-admin repository.
The gitolite-admin git log shows a lot of mostly empty commits:

$  git log --stat 
commit 66ef28b3839b4d1644a77994f910497849ef1980
Author: Redmine Git Hosting <[email protected]>
Date:   Mon Jan 19 09:45:43 2015 +0100

    update_projects : test

commit 6269f5627429d222932a85c2da6827e096e410b1
Merge: 9eef675 9eef675
Author: Redmine Git Hosting <[email protected]>
Date:   Mon Jan 19 09:45:41 2015 +0100

    [gitolite-rugged] Merged `origin/master` into `master`

commit 9eef6757574659efd1ad06a5f58701f00002f6f7
Author: Redmine Git Hosting <[email protected]>
Date:   Mon Jan 19 09:25:06 2015 +0100

    update_projects : test

commit 57337fa7846fb52f85ed65b9a1b84949fce49ced
Merge: 87d1568 87d1568
Author: Redmine Git Hosting <[email protected]>
Date:   Mon Jan 19 09:25:06 2015 +0100

    [gitolite-rugged] Merged `origin/master` into `master`

commit 87d1568c0de7a023b01fe8fb3c32ad76f2bb3073
Author: Redmine Git Hosting <[email protected]>
Date:   Mon Jan 19 09:22:25 2015 +0100

    resync_all_ssh_keys : Add SSH key : redmine_flo_5@[...]

commit fff08d18299db16645d357d4373c0055c8103f8f
Merge: 08b0b92 08b0b92
Author: Redmine Git Hosting <[email protected]>
Date:   Mon Jan 19 09:22:24 2015 +0100

    [gitolite-rugged] Merged `origin/master` into `master`

[...]

commit 044e88e4964016db37cb9e0962bc57e63cf8e8cd
Author: Redmine Git Hosting <[email protected]>
Date:   Mon Jan 19 08:46:32 2015 +0100

    add_repository : redmine_repos/test

[...]

commit 131785dd741998cea64273c2f72b114848a9a77d
Author: Redmine Git Hosting <[email protected]>
Date:   Mon Jan 19 08:39:47 2015 +0100

    add_ssh_key : Add SSH key : redmine_flo_5@[...]

 keydir/redmine_git_hosting/redmine_flo_5/[...]/redmine_flo_5.pub | 1 +
 1 file changed, 1 insertion(+)

The only time something was actually changed was when I added my pubkey...

@n-rodriguez
Copy link
Contributor

I changed the routes in [REDMINE]/config/routes.rb and for all the plugins as well.

what do you mean? do you have an example?

@n-rodriguez
Copy link
Contributor

Git hosting is configured to use another configuration file (includes/redmine.conf).

The plugin must know about that. Have you updated your settings in Administration -> Redmine Git Hosting -> Config file tab ?

@n-rodriguez
Copy link
Contributor

I am using redmine 2.6.0.stable, gitolite v3.6.2-12 and redmine_git_hosting v0.8-beta.

v0.8-beta branch has been dropped out. Can you try with the v1.0.0-beta branch?

@n-rodriguez
Copy link
Contributor

In the end I deleted gitolite_tmp_dir at /tmp/redmine_git_hosting/git/gitolite-admin.git (actualy I deleted everything below redmine_git_hosting)

You can safely delete the whole /tmp/redmine_git_hosting directory. It will be recreated if needed.

@n-rodriguez
Copy link
Contributor

I recreated the folders manually but it remains empty

You should not do that. If the gitolite-admin.git directory already exists, the git clone will fail.

@n-rodriguez n-rodriguez self-assigned this Jan 21, 2015
@n-rodriguez
Copy link
Contributor

ERROR [GitHosting] Error while getting Gitolite physical repositories list

What is the Git user's shell? Bash?
Also be sure to have this in <git user home>/.profile or <git user home>/.bashrc :

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$PATH:$HOME/bin"
fi

@FlorianMuenchbach
Copy link
Author

Hi!

I changed the routes in [REDMINE]/config/routes.rb and for all the plugins as well.

what do you mean? do you have an example?

I changed the first line of [REDMINE]/plugins/redmine_git_hosting/config/routes.rb (the original one) to this:

#RedmineApp::Application.routes.draw do
Redmine::Utils::relative_url_root = '/redmine'
RedmineApp::Application.routes.draw do
  scope ActionController::Base.relative_url_root do
      # Handle the public keys plugin to my/account.
      scope "/my" do
        resources :public_keys, :controller => 'gitolite_public_keys'
      end
[...]
end

The plugin must know about that. Have you updated your settings in Administration -> Redmine Git Hosting -> Config file tab ?

I did. I set it to ./includes/redmine.conf assuming that it is relative to the gitolite-admin.git/config directory.

v0.8-beta branch has been dropped out. Can you try with the v1.0.0-beta branch?

Oh, ok. Good to know ;)
I will try the v1.0.0-beta as soon as possible (tonight or tomorrow) and tell you whats going on.

I recreated the folders manually but it remains empty

You should not do that. If the gitolite-admin.git directory already exists, the git clone will fail.

I know, I just recreated the parent directories (/tmp/redmine_git_hosting/git) manual.

ERROR [GitHosting] Error while getting Gitolite physical repositories list

What is the Git user's shell? Bash?

Yes, it's bash. $PATH for the git user is set in .bashrc to [git user home]/bin, which was sufficient for me to setup gitolite (of course...). I actually never bothered to set it in .profile. The error above is gone now. Thanks for the tip.

Anyway, the rest of the problem remains: still no /tmp/.../gitolite-admin directory and empty commits (no files changed).

@FlorianMuenchbach
Copy link
Author

Hi Nicolas,

sorry, I had no time to try v1.0.0-beta earlier...

I just updated it completely fresh from git, applied my modifications to (the new) config/routes.rb, ran bundle install and migrated the plugin.
It now recreates the tmp directory and properly clones the gitolite-admin repository. So far so good.
I deleted all the repositories before the update, because I've been planing to set them up afresh after the update.
My problem now is that when I now go to a project's settings -> repository tab and choose git, redmine shows me the "default" redmine git settings, not the git hosting plugin view.
This might be connected to by changes in the routes file. But it has been working with v7.9 and v8.0-beta... Do you have any idea on this one?

By the way:
I can not confirm this behavior 100%, so I don't want to open a new issue:
I realized that after the update the gitolite_hooks_url has changed back to localhost:3000. Since it was relying on the address set in redmine, it would be cool if this value would be kept after an update until the user decides to change it.

@n-rodriguez
Copy link
Contributor

My problem now is that when I now go to a project's settings -> repository tab and choose git, redmine shows me the "default" redmine git settings, not the git hosting plugin view.
This might be connected to by changes in the routes file. But it has been working with v7.9 and v8.0-beta... Do you have any idea on this one?

#264 (comment)

I have to write the rake task.

@n-rodriguez
Copy link
Contributor

I realized that after the update the gitolite_hooks_url has changed back to localhost:3000. Since it was relying on the address set in redmine, it would be cool if this value would be kept after an update until the user decides to change it.

That may happen. I'm gonna see what I can do... But the simpler would be to add a notice in release notes as it's not critical and the original/default url is proposed next to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants