* Having some problem with instaweb @ 2011-06-23 1:06 Gurjeet Singh 2011-06-23 8:23 ` Jakub Narebski 0 siblings, 1 reply; 10+ messages in thread From: Gurjeet Singh @ 2011-06-23 1:06 UTC (permalink / raw) To: git I am on Linux Mint 10 and I tried the following command: $ git instaweb -d apache2 -p 1234 --start Syntax error on line 1 of /mnt/storage/gurjeet/.git/gitweb/httpd.conf: Invalid command 'server.document-root', perhaps misspelled or defined by a module not included in the server configuration Could not execute http daemon apache2 -f. /mnt/storage/gurjeet/ is my $HOME. I have tried commenting out that first line, but then the error complains about line 2 'server.port = 1234' Any help appreciated. Thanks in advance. PS: I am told that no subscription is required on this mailing list, since people usually do reply-all; so relying on that. -- Gurjeet Singh EnterpriseDB Corporation The Enterprise PostgreSQL Company ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Having some problem with instaweb 2011-06-23 1:06 Having some problem with instaweb Gurjeet Singh @ 2011-06-23 8:23 ` Jakub Narebski 2011-06-23 11:48 ` Gurjeet Singh 0 siblings, 1 reply; 10+ messages in thread From: Jakub Narebski @ 2011-06-23 8:23 UTC (permalink / raw) To: Gurjeet Singh; +Cc: git, Eric Wong, Jakub Narebski CC-ing Eric Wong, author of git-instaweb. Gurjeet Singh <singh.gurjeet@gmail.com> writes: > I am on Linux Mint 10 and I tried the following command: > > $ git instaweb -d apache2 -p 1234 --start > Syntax error on line 1 of /mnt/storage/gurjeet/.git/gitweb/httpd.conf: > Invalid command 'server.document-root', perhaps misspelled or defined > by a module not included in the server configuration > Could not execute http daemon apache2 -f. Hmmm... it looks like starts apache2, but generates config file (httpd.conf) for lighttpd instead. Ahh... actually you started apache2, but didn't generate configuration file for it, so git-instaweb re-uses previous config file... which by default is lighttpd: start, --start Start the httpd instance and exit. This does not generate any of the configuration files for spawning a new instance. Try using $ git instaweb -d apache2 -p 1234 -b lynx then exiting web browser. BTW. I think that git-instaweb should be more helpful here... will investigate. > /mnt/storage/gurjeet/ is my $HOME. Nb. it doesn't mater where $HOME is, but where is git repository you were in when calling git-instaweb. BTW. in the future it would be good idea to tell what git version are you using. -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Having some problem with instaweb 2011-06-23 8:23 ` Jakub Narebski @ 2011-06-23 11:48 ` Gurjeet Singh 2011-06-23 19:29 ` Jakub Narebski 0 siblings, 1 reply; 10+ messages in thread From: Gurjeet Singh @ 2011-06-23 11:48 UTC (permalink / raw) To: Jakub Narebski; +Cc: git, Eric Wong On Thu, Jun 23, 2011 at 4:23 AM, Jakub Narebski <jnareb@gmail.com> wrote: > CC-ing Eric Wong, author of git-instaweb. > > Gurjeet Singh <singh.gurjeet@gmail.com> writes: > >> I am on Linux Mint 10 and I tried the following command: >> >> $ git instaweb -d apache2 -p 1234 --start >> Syntax error on line 1 of /mnt/storage/gurjeet/.git/gitweb/httpd.conf: >> Invalid command 'server.document-root', perhaps misspelled or defined >> by a module not included in the server configuration >> Could not execute http daemon apache2 -f. > > Hmmm... it looks like starts apache2, but generates config file > (httpd.conf) for lighttpd instead. > > Ahh... actually you started apache2, but didn't generate configuration > file for it, so git-instaweb re-uses previous config file... which by > default is lighttpd: > > start, --start > Start the httpd instance and exit. This does not generate any of the > configuration files for spawning a new instance. Now that's very unintuitive.... I am the impatient kind, and didn't read the whole paragraph. I assumed --start would just start the webserver (maybe run in daemon mode). > > Try using > > $ git instaweb -d apache2 -p 1234 -b lynx That worked.. I do not have lynx, but it did start apache2 and I was able to browse the repo. > > then exiting web browser. > > > BTW. I think that git-instaweb should be more helpful here... will > investigate. > >> /mnt/storage/gurjeet/ is my $HOME. > > Nb. it doesn't mater where $HOME is, but where is git repository you > were in when calling git-instaweb. Got it. I have some files of my home directory in a Git repository, so $HOME is where the repository is. I have quite a few development related Git repositories under $HOME/dev/ and instaweb shows all of them on the first page (with description etc). IOW, is it supposed to recurse down all directories to look for .git/ directories? .git dev/EDB-ADVISORS/.git dev/EDBAS/.git dev/PCS/.git dev/PEM/.git dev/PGAGENT/.git dev/POSTGRES/.git dev/SERVICESTOOLS/.git dev/SLONY/.git Is this expected? > > > BTW. in the future it would be good idea to tell what git version are > you using. I am at 1.7.1 Thanks for the help, and thanks to everyone around Git for a great piece of software. -- Gurjeet Singh EnterpriseDB Corporation The Enterprise PostgreSQL Company ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Having some problem with instaweb 2011-06-23 11:48 ` Gurjeet Singh @ 2011-06-23 19:29 ` Jakub Narebski 2011-06-23 19:50 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Jakub Narebski 0 siblings, 1 reply; 10+ messages in thread From: Jakub Narebski @ 2011-06-23 19:29 UTC (permalink / raw) To: Gurjeet Singh; +Cc: git, Eric Wong On Thu, 23 Jun 2011, Gurjeet Singh wrote: > On Thu, Jun 23, 2011 at 4:23 AM, Jakub Narebski <jnareb@gmail.com> wrote: >> Gurjeet Singh <singh.gurjeet@gmail.com> writes: >> >>> I am on Linux Mint 10 and I tried the following command: >>> >>> $ git instaweb -d apache2 -p 1234 --start >>> Syntax error on line 1 of /mnt/storage/gurjeet/.git/gitweb/httpd.conf: >>> Invalid command 'server.document-root', perhaps misspelled or defined >>> by a module not included in the server configuration >>> Could not execute http daemon apache2 -f. >> >> Hmmm... it looks like starts apache2, but generates config file >> (httpd.conf) for lighttpd instead. >> >> Ahh... actually you started apache2, but didn't generate configuration >> file for it, so git-instaweb re-uses previous config file... which by >> default is lighttpd: >> >> start, --start >> Start the httpd instance and exit. This does not generate any of the >> configuration files for spawning a new instance. > > Now that's very unintuitive.... I am the impatient kind, and didn't > read the whole paragraph. I assumed --start would just start the > webserver (maybe run in daemon mode). I'm working on it... actually the patch series is ready to send; it will be sent as a reply to this email. I just hope that it wouldn't be lost being deeper in thread... >>> /mnt/storage/gurjeet/ is my $HOME. >> >> Nb. it doesn't mater where $HOME is, but where is git repository you >> were in when calling git-instaweb. > > Got it. I have some files of my home directory in a Git repository, so > $HOME is where the repository is. > > I have quite a few development related Git repositories under > $HOME/dev/ and instaweb shows all of them on the first page (with > description etc). IOW, is it supposed to recurse down all directories > to look for .git/ directories? > > .git > dev/EDB-ADVISORS/.git > dev/EDBAS/.git > dev/PCS/.git > dev/PEM/.git > dev/PGAGENT/.git > dev/POSTGRES/.git > dev/SERVICESTOOLS/.git > dev/SLONY/.git > > Is this expected? It is expected behavior. It is consequence of the fact that the default gitweb mode is to search for repositories recursively starting from given root; git-instaweb set this $projectsroot to the one directory up from $GIT_DIR. Alternate solution would be for git-instaweb to generate projects list file for gitweb with only single repository listed... Nevertheless usually you don't have repositories inside of working directory of other repositories. There was even idea floated to deprecate such support, but it didn't gained traction. One expected exception is when you use _submodules_; in this case you would probably want to see both supermodule and submodules (subrepositories). That is why I think that current git-instaweb behavior has sense. -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/4] git-instaweb: Improving handling of --start/--restart 2011-06-23 19:29 ` Jakub Narebski @ 2011-06-23 19:50 ` Jakub Narebski 2011-06-23 19:55 ` [PATCH 1/4] git-instaweb: Extract configuring web server into configure_httpd Jakub Narebski ` (4 more replies) 0 siblings, 5 replies; 10+ messages in thread From: Jakub Narebski @ 2011-06-23 19:50 UTC (permalink / raw) To: git; +Cc: Gurjeet Singh, Eric Wong This series fixes the issue reported by Gurheet Singh in "Having some problem with instaweb", in that --start/--restart doesn't generate configuration, which is documented: start, --start Start the httpd instance and exit. This does not generate any of the configuration files for spawning a new instance. but unexpected. The first three patches are independent refactoring to make final change smaller and easier to review, thoug they have merit even taken standalone. --- Jakub Narebski (4): git-instaweb: Check that correct config file exists for (re)start git-instaweb: Move all actions at the end of script git-instaweb: Use $conf, not $fqgitdir/gitweb/httpd.conf git-instaweb: Extract web server configuration into configure_httpd Documentation/git-instaweb.txt | 8 ++-- git-instaweb.sh | 84 ++++++++++++++++++++++++++-------------- 2 files changed, 58 insertions(+), 34 deletions(-) -- Jakub Narebski ShadeHawk on #git Poland ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] git-instaweb: Extract configuring web server into configure_httpd 2011-06-23 19:50 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Jakub Narebski @ 2011-06-23 19:55 ` Jakub Narebski 2011-06-23 19:56 ` [PATCH 2/4] git-instaweb: Use $conf, not $fqgitdir/gitweb/httpd.conf Jakub Narebski ` (3 subsequent siblings) 4 siblings, 0 replies; 10+ messages in thread From: Jakub Narebski @ 2011-06-23 19:55 UTC (permalink / raw) To: git; +Cc: Gurjeet Singh, Eric Wong This is preparatory work for making start/restart check that git-instaweb set up correct configuration, and generate it if it is missing. Pure refactoring, no functional changes. Signed-off-by: Jakub Narebski <jnareb@gmail.com> --- As usual, you can check this change with $ git blame -w --date=short -C -C HEAD^.. -- git-instaweb.sh | grep -C 3 -e '^[^^]' | less -S assuming that it is checked out (HEAD == this commit). Thanks Junio for the tip! Nb. it would be nice to have an option to 'git diff' which would function like '-w' but ignore code movement... git-instaweb.sh | 46 +++++++++++++++++++++++++--------------------- 1 files changed, 25 insertions(+), 21 deletions(-) diff --git a/git-instaweb.sh b/git-instaweb.sh index 8bfa8a0..49bab7b 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -587,32 +587,36 @@ our \$projects_list = \$projectroot; EOF } +configure_httpd() { + case "$httpd" in + *lighttpd*) + lighttpd_conf + ;; + *apache2*|*httpd*) + apache2_conf + ;; + webrick) + webrick_conf + ;; + *mongoose*) + mongoose_conf + ;; + *plackup*) + plackup_conf + ;; + *) + echo "Unknown httpd specified: $httpd" + exit 1 + ;; + esac +} + gitweb_conf resolve_full_httpd mkdir -p "$fqgitdir/gitweb/$httpd_only" -case "$httpd" in -*lighttpd*) - lighttpd_conf - ;; -*apache2*|*httpd*) - apache2_conf - ;; -webrick) - webrick_conf - ;; -*mongoose*) - mongoose_conf - ;; -*plackup*) - plackup_conf - ;; -*) - echo "Unknown httpd specified: $httpd" - exit 1 - ;; -esac +configure_httpd start_httpd url=http://127.0.0.1:$port ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] git-instaweb: Use $conf, not $fqgitdir/gitweb/httpd.conf 2011-06-23 19:50 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Jakub Narebski 2011-06-23 19:55 ` [PATCH 1/4] git-instaweb: Extract configuring web server into configure_httpd Jakub Narebski @ 2011-06-23 19:56 ` Jakub Narebski 2011-06-23 20:59 ` [PATCH 3/4] git-instaweb: Move all actions at the end of script Jakub Narebski ` (2 subsequent siblings) 4 siblings, 0 replies; 10+ messages in thread From: Jakub Narebski @ 2011-06-23 19:56 UTC (permalink / raw) To: git; +Cc: Gurjeet Singh, Eric Wong Don't repeat yourself: use "$conf" instead of its [current] contents, namely "$fqgitdir/gitweb/httpd.conf". Signed-off-by: Jakub Narebski <jnareb@gmail.com> --- Straighforward improvement. Note that currently $conf is constant, and doesn't change its value. git-instaweb.sh | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git-instaweb.sh b/git-instaweb.sh index 49bab7b..2be22a0 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -103,7 +103,7 @@ start_httpd () { case "$httpd" in *mongoose*|*plackup*) #These servers don't have a daemon mode so we'll have to fork it - $full_httpd "$fqgitdir/gitweb/httpd.conf" & + $full_httpd "$conf" & #Save the pid before doing anything else (we'll print it later) pid=$! @@ -117,7 +117,7 @@ $pid EOF ;; *) - $full_httpd "$fqgitdir/gitweb/httpd.conf" + $full_httpd "$conf" if test $? != 0; then echo "Could not execute http daemon $httpd." exit 1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] git-instaweb: Move all actions at the end of script 2011-06-23 19:50 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Jakub Narebski 2011-06-23 19:55 ` [PATCH 1/4] git-instaweb: Extract configuring web server into configure_httpd Jakub Narebski 2011-06-23 19:56 ` [PATCH 2/4] git-instaweb: Use $conf, not $fqgitdir/gitweb/httpd.conf Jakub Narebski @ 2011-06-23 20:59 ` Jakub Narebski 2011-06-23 21:01 ` [PATCH 4/4] git-instaweb: Check that correct config file exists for (re)start Jakub Narebski 2011-06-28 3:22 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Eric Wong 4 siblings, 0 replies; 10+ messages in thread From: Jakub Narebski @ 2011-06-23 20:59 UTC (permalink / raw) To: git; +Cc: Gurjeet Singh, Eric Wong As a nice side-effect now the order of parameters does not matter: $ git instaweb --httpd=apache2 --start is now (after this patch) the same as $ git instaweb --start --httpd=apache2 Before this commit --start, --stop, --restart (and their subcommand versions start, stop, restart) exited immediately. This is preparatory work for making start/restart check that correct configuration is set up; this change was required to have access in start_httpd to requested web browser etc. Signed-off-by: Jakub Narebski <jnareb@gmail.com> --- Unfortunately there are no tests for git-instaweb, so I couldn't test if it is really no much of a functional change. BTW. if you thought of a better subject for this commit, please speak up. git-instaweb.sh | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/git-instaweb.sh b/git-instaweb.sh index 2be22a0..9a2f20f 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -27,6 +27,7 @@ httpd="$(git config --get instaweb.httpd)" root="$(git config --get instaweb.gitwebdir)" port=$(git config --get instaweb.port) module_path="$(git config --get instaweb.modulepath)" +action="browse" conf="$GIT_DIR/gitweb/httpd.conf" @@ -148,17 +149,13 @@ while test $# != 0 do case "$1" in --stop|stop) - stop_httpd - exit 0 + action="stop" ;; --start|start) - start_httpd - exit 0 + action="start" ;; --restart|restart) - stop_httpd - start_httpd - exit 0 + action="restart" ;; -l|--local) local=true @@ -611,6 +608,22 @@ configure_httpd() { esac } +case "$action" in +stop) + stop_httpd + exit 0 + ;; +start) + start_httpd + exit 0 + ;; +restart) + stop_httpd + start_httpd + exit 0 + ;; +esac + gitweb_conf resolve_full_httpd ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] git-instaweb: Check that correct config file exists for (re)start 2011-06-23 19:50 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Jakub Narebski ` (2 preceding siblings ...) 2011-06-23 20:59 ` [PATCH 3/4] git-instaweb: Move all actions at the end of script Jakub Narebski @ 2011-06-23 21:01 ` Jakub Narebski 2011-06-28 3:22 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Eric Wong 4 siblings, 0 replies; 10+ messages in thread From: Jakub Narebski @ 2011-06-23 21:01 UTC (permalink / raw) To: git; +Cc: Gurjeet Singh, Eric Wong Currently start/restart does not generate any configuration files for spawning a new instance. This means that $ git instaweb --http=<server> --start might pick up stale 'httpd.conf' file for a different web server (e.g. for default lighttpd when requesting apache2). This commit changes that, and makes git-instaweb generate web server config file and/or gitweb config file if don't exists. This required naming config files after the name of web server (alternate solution would be to somehow mark for which web server was config file generated). Note that web servers that embed configuration in server script file, namely webrick and plackup, and which delete "$conf" in their *_conf function, would have their config (server script) always regenerated. Note: this commit introduces a bit of code repetition (but only a few lines). Reported-by: Gurjeet Singh <singh.gurjeet@gmail.com> Signed-off-by: Jakub Narebski <jnareb@gmail.com> --- This is an actual fix. Though I haven't checked if git-instaweb behaves sanely if you switch between web servers with --start... Documentation/git-instaweb.txt | 8 ++++---- git-instaweb.sh | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt index 08f85ba..ea95c90 100644 --- a/Documentation/git-instaweb.txt +++ b/Documentation/git-instaweb.txt @@ -51,8 +51,8 @@ OPTIONS start:: --start:: - Start the httpd instance and exit. This does not generate - any of the configuration files for spawning a new instance. + Start the httpd instance and exit. Regenerate configuration files + as necessary for spawning a new instance. stop:: --stop:: @@ -62,8 +62,8 @@ stop:: restart:: --restart:: - Restart the httpd instance and exit. This does not generate - any of the configuration files for spawning a new instance. + Restart the httpd instance and exit. Regenerate configuration files + as necessary for spawning a new instance. CONFIGURATION ------------- diff --git a/git-instaweb.sh b/git-instaweb.sh index 9a2f20f..01a1b05 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -99,6 +99,12 @@ start_httpd () { # here $httpd should have a meaningful value resolve_full_httpd + mkdir -p "$fqgitdir/gitweb/$httpd_only" + conf="$fqgitdir/gitweb/$httpd_only.conf" + + # generate correct config file if it doesn't exist + test -f "$conf" || configure_httpd + test -f "$fqgitdir/gitweb/gitweb_config.perl" || gitweb_conf # don't quote $full_httpd, there can be arguments to it (-f) case "$httpd" in @@ -628,6 +634,7 @@ gitweb_conf resolve_full_httpd mkdir -p "$fqgitdir/gitweb/$httpd_only" +conf="$fqgitdir/gitweb/$httpd_only.conf" configure_httpd ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] git-instaweb: Improving handling of --start/--restart 2011-06-23 19:50 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Jakub Narebski ` (3 preceding siblings ...) 2011-06-23 21:01 ` [PATCH 4/4] git-instaweb: Check that correct config file exists for (re)start Jakub Narebski @ 2011-06-28 3:22 ` Eric Wong 4 siblings, 0 replies; 10+ messages in thread From: Eric Wong @ 2011-06-28 3:22 UTC (permalink / raw) To: Jakub Narebski; +Cc: git, Gurjeet Singh Jakub Narebski <jnareb@gmail.com> wrote: > This series fixes the issue reported by Gurheet Singh in "Having some > problem with instaweb", in that --start/--restart doesn't generate > configuration, which is documented: Everything looks reasonable, thanks! Acked and pushed to "instaweb" branch on git://bogomips.org/git-svn.git -- Eric Wong ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-06-28 3:24 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-06-23 1:06 Having some problem with instaweb Gurjeet Singh 2011-06-23 8:23 ` Jakub Narebski 2011-06-23 11:48 ` Gurjeet Singh 2011-06-23 19:29 ` Jakub Narebski 2011-06-23 19:50 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Jakub Narebski 2011-06-23 19:55 ` [PATCH 1/4] git-instaweb: Extract configuring web server into configure_httpd Jakub Narebski 2011-06-23 19:56 ` [PATCH 2/4] git-instaweb: Use $conf, not $fqgitdir/gitweb/httpd.conf Jakub Narebski 2011-06-23 20:59 ` [PATCH 3/4] git-instaweb: Move all actions at the end of script Jakub Narebski 2011-06-23 21:01 ` [PATCH 4/4] git-instaweb: Check that correct config file exists for (re)start Jakub Narebski 2011-06-28 3:22 ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Eric Wong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).