Menu

#53 Separate database and metrics for each project

closed
nobody
None
7
2008-08-27
2006-08-08
Anonymous
No

1. Can you please add option to create separate
database for each project.

2. Provide option to upload all the files in a given
directory in one shot.

3. Provide separate metrics for each project.

Discussion

  • David Multer

    David Multer - 2007-02-16

    Logged In: YES
    user_id=1344296
    Originator: NO

    Actually I would love to see flexible virtual host support similar to what ViewVC does. I would like to create multiple distinct configurations using different URLs. This way you can have unique database, Bugzilla, LXR, email, etc. settings while running from a single codebase.

     
  • David Multer

    David Multer - 2007-05-22

    Logged In: YES
    user_id=1344296
    Originator: NO

    I've actually managed to configure Codestriker to support multiple databases/configurations through the following changes:

    1. Must modify install.pl so that it runs from the project root directory rather than the bin directory. See the diff at the bottom of this message.
    2. Copy the distribution files to a common location across configs. For example, /usr/local/codestriker
    3. Create a unique directory for each virtual host configured in Apache. For example, /usr/local/apache2/htdocs/CONFIG1/codestriker
    4. Create a codestriker.conf file in directory from (3).
    5. Create a directory called "cgi-bin" in directory (3).
    6. Create symbolic links from common to config specific directory. For example, ln -s /usr/local/codestriker/* /usr/local/apache2/htdocs/CONFIG1/codestriker
    7. Run install script in directory (3). For example, ./bin/install.pl

    Updates just require recopying files to (3) and then running (7) again from each virtual host config.

    I would love to see these install.pl changes integrated as part of the mainline.

    25c25
    < use lib '../lib';
    ---
    > use lib 'lib';
    51c51
    < Codestriker->initialise(cwd() . '/..');
    ---
    > Codestriker->initialise(cwd());
    1027c1027
    < mkdir '../cgi-bin', 0755;
    ---
    > mkdir 'cgi-bin', 0755;
    1047c1047
    < $template_vars->{codestriker_lib} = 'use lib \'' . cwd() . '/../lib\';';
    ---
    > $template_vars->{codestriker_lib} = 'use lib \'' . cwd() . '/lib\';';
    1049c1049
    < $template_vars->{codestriker_conf} = '\'' . cwd() . '/..\'';
    ---
    > $template_vars->{codestriker_conf} = '\'' . cwd() . '\'';
    1058,1059c1058,1059
    < open(CODESTRIKER_PL, ">../cgi-bin/codestriker.pl")
    < || die "Unable to create ../cgi-bin/codestriker.pl file: $!";
    ---
    > open(CODESTRIKER_PL, ">cgi-bin/codestriker.pl")
    > || die "Unable to create cgi-bin/codestriker.pl file: $!";
    1061c1061
    < $template->process("codestriker.pl.base", $template_vars,\*CODESTRIKER_PL);
    ---
    > $template->process("bin/codestriker.pl.base", $template_vars,\*CODESTRIKER_PL);
    1066c1066
    < chmod 0755, '../cgi-bin/codestriker.pl';
    ---
    > chmod 0755, 'cgi-bin/codestriker.pl';
    1071c1071
    < chdir('../cgi-bin') ||
    ---
    > chdir('cgi-bin') ||

     
  • David Sitsky

    David Sitsky - 2007-05-22

    Logged In: YES
    user_id=208928
    Originator: NO

    Thanks for that - looks good. When I get time, I'll incorporate your patch and information into the documentation.

     
  • David Multer

    David Multer - 2008-08-08

    Logged In: YES
    user_id=1344296
    Originator: NO

    I see you've done a couple of releases and was hoping to see this change incorporated. Any chance?

     
  • David Sitsky

    David Sitsky - 2008-08-11

    Logged In: YES
    user_id=208928
    Originator: NO

    Yep - thanks for the reminder. Your instructions should certainly go into the manual, but just curious - can't we do what you want while still leaving install.pl in the bin sub-directory?

     
  • David Multer

    David Multer - 2008-08-11

    Logged In: YES
    user_id=1344296
    Originator: NO

    The instructions I provided don't move the install.pl file from the bin directory, but they do require running from the new location one level up. The problem is due to the linked files. Currently the install.pl script finds other files relative to the bin directory through the use of "../" references. Creating symbolic links for multiple installs would cause it to reference the master copy rather than the files unique to each virtual installation.

    In summary, these are the changes I've proposed:
    - Apply the patch I provided. No files are moved, added, or deleted. They are only changed.
    - Change install instructions to run "bin/install.pl" from the codestriker directory rather than "cd bin" followed by "install.pl". Note that anyone trying the old way would get an error, so you should consider the impact of the new install instructions carefully.

     
  • David Sitsky

    David Sitsky - 2008-08-11

    Logged In: YES
    user_id=208928
    Originator: NO

    Hi David,

    I think the ideal case is we modify install.pl so that it can be run from either the top-level directory, or from bin. With some magic, this should be possible. That way, nobody else would be affected by this change.

    I am in the middle of some pretty serious URL refactoring at the moment in the codebase, but this is on my list, unless you want a crack at it.

     
  • David Sitsky

    David Sitsky - 2008-08-11
    • priority: 5 --> 7
     
  • David Sitsky

    David Sitsky - 2008-08-12

    Logged In: YES
    user_id=208928
    Originator: NO

    Actually I'll fix up the script.

     
  • David Sitsky

    David Sitsky - 2008-08-12

    Logged In: YES
    user_id=208928
    Originator: NO

    Hi,

    try these changes to your install.pl and let me know if it works for you. This should allow install.pl to be called from any location. If all is well, I'll add your instructions to the manual.

    Index: install.pl

    RCS file: /cvsroot/codestriker/codestriker/bin/install.pl,v
    retrieving revision 1.19
    retrieving revision 1.20
    diff -u -r1.19 -r1.20
    --- install.pl 10 Jul 2008 10:43:55 -0000 1.19
    +++ install.pl 12 Aug 2008 09:20:22 -0000 1.20
    @@ -22,7 +22,19 @@

    use strict;
    use Config;
    -use lib '../lib';
    +
    +# Determine the location of the Codestriker bin directory. This will
    +# work even if the script was not executed in the bin directory.
    +my $bin_directory;
    +BEGIN {
    + use File::Spec::Functions qw(rel2abs);
    + use File::Basename qw(dirname);
    + my $path = rel2abs($0);
    + $bin_directory = dirname($path);
    +}
    +use lib $bin_directory . "/../lib";
    +
    +chdir $bin_directory;

    require 5.008_0;

     
  • David Multer

    David Multer - 2008-08-12

    Logged In: YES
    user_id=1344296
    Originator: NO

    Actually I can see that it won't work, but you're on the right track. The script shouldn't change into the bin directory. If you find that the current directory is inside bin, then you need to "chdir ..". Then all references to files must be corrected as per my original patch using your new $bin_directory variable.

     
  • David Sitsky

    David Sitsky - 2008-08-13

    Logged In: YES
    user_id=208928
    Originator: NO

    I'm with you now. Ok - I've just committed in that change so it runs from the base directory. Can you try it out? Don't update your other Codestriker files, just install.pl, as the codebase is very unstable at the moment.

    Once I get the ok from you, I'll update the manual.

     
  • David Multer

    David Multer - 2008-08-13

    Logged In: YES
    user_id=1344296
    Originator: NO

    I've verified that the new install.pl works as expected in my virtual configuration environment run from the codestriker base directory. You should also verify that it works in the usual configuration run from the bin subdirectory. Thanks for the changes!

     
  • David Sitsky

    David Sitsky - 2008-08-27
    • status: open --> closed
     
  • David Sitsky

    David Sitsky - 2008-08-27

    Logged In: YES
    user_id=208928
    Originator: NO

    Have updated the Codestriker manual with these instructions, so closing this off now. Will be available in 1.9.7 release.

     

Log in to post a comment.