preparing dev server to work off svn

Discussion in 'Developers' Forum' started by nveid, Aug 28, 2011.

  1. nveid

    nveid ISPConfig Developer ISPConfig Developer

    I'm trying to prepare my server to work off of svn, curious if some other developers can help me with how they manage this?

    1) What config files do I need to copy from my current live installation to the svn installation in order for it to work correctly when I switch my test system over?

    2) Is there a database update script I can run while running my system ISPConfig directly off subversion repo checkout?
     
  2. nveid

    nveid ISPConfig Developer ISPConfig Developer

    Welp.. Answered my own question & thought I'd give the quickest setup to someone who might search the forums in the future.

    1. do your svn check out as normal

    2. cp -sr /path/to/your/svn /path/for/a/copy

    3. Backup Up the following configuration files:
    At /usr/local/ispconfig/server/lib​
    config.inc.php mysql_clientdb.conf​
    At /usr/local/ispconfig/interface/lib​
    config.inc.php​

    4. Get rid of your server/interface directories, and move your symbolic link farms into the place of server/interface.

    5. Move your configuration files back in place.. Everything should be peachy.

    Now when you make changes or when your pulling new changes svn diff works correctly off your work to the repo.

    And the update script in install/ directory works beautiful without not affecting my setup & just updating sql entries in the database.

    EDIT:
    There is 2 limitations preventing this setup, however I solved it in my current checkout(I'm using git-svn.. so I just stash my changes I'm not committing), if Falko or Till say its okay I'll commit these changes. Basically its this..
    1. At server.php.. Its using a require(), its not so symbolic link friendly.. Have to specify an absolute path. So here's the needed change.

    diff --git a/server/server.php b/server/server.php
    old mode 100644
    new mode 100755
    index c171d48..967d13a
    --- a/server/server.php
    +++ b/server/server.php
    @@ -1,5 +1,4 @@
    <?php
    -
    /*
    Copyright (c) 2007-2011, Till Brehm, projektfarm Gmbh
    All rights reserved.
    @@ -28,8 +27,11 @@
    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */

    -require('lib/config.inc.php');
    -require('lib/app.inc.php');

    +// $script_path allows development work of using a symbolic link farm
    +// to use along side git or svn
    +$script_path = dirname($_SERVER["SCRIPT_FILENAME"]);
    +require("$script_path/lib/config.inc.php");
    +require("$script_path/lib/app.inc.php");


    set_time_limit(0);
    ini_set('error_reporting', E_ALL & ~E_NOTICE);


    2. At server/lib/app.inc.php, the code explicitly disallows symbolic linked classes. This is the diff I did to allow this changed.

    --- a/server/lib/app.inc.php
    +++ b/server/lib/app.inc.php
    @@ -75,7 +75,8 @@ class app {
    if(is_array($cl)) {
    foreach($cl as $classname) {
    if(!@is_object($this->$classname)) {
    - if(is_file($conf['classpath'].'/'.$classname.'.inc.php') && !is_link($conf['classpath'].'/'.$classname.'.inc.php')) {
    + // Nveid: Why was this protected against links?
    + if(is_file($conf['classpath'].'/'.$classname.'.inc.php') || is_link($conf['classpath'].'/'.$classname.'.inc.php')) {

    include_once($conf['classpath'].'/'.$classname.'.inc.php');
    $this->$classname = new $classname;
    }
    @@ -91,7 +92,7 @@ class app {
    $cl = explode(',',$classes);
    if(is_array($cl)) {
    foreach($cl as $classname) {
    - if(is_file($conf['classpath'].'/'.$classname.'.inc.php') && !is_link($conf['classpath'].'/'.$classname.'.inc.php')) {
    + if(is_file($conf['classpath'].'/'.$classname.'.inc.php') || is_link($conf['classpath'].'/'.$classname.'.inc.php')) {
    include_once($conf['classpath'].'/'.$classname.'.inc.php');
    } else {
    die('Unable to load: '.$conf['classpath'].'/'.$classname.'.inc.php');
     
    Last edited: Aug 29, 2011
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Might be better to define e.g. a constant like "devsystem" in config.inc.php that is checked if security functions should be disabled instead of removing the code to protect the function from loading symlinks.
     
  4. nveid

    nveid ISPConfig Developer ISPConfig Developer

    Ok, submitted a revision whereas there is a define for DEVSYSTEM in config.inc.php defaulting to 0. Set to 1, it allows the classes to be loaded as symbolic links.
     
  5. Mark_NL

    Mark_NL New Member

    I'm having trouble using this method ..

    It works silky smooth for "just" editing files.

    The problem i have is this:

    - Clean os install
    - svn checkout
    - install ispconfig
    ---
    - create a website -> OK!
    ---
    - backup config libs
    - delete interface / server dirs
    - cp -sr /usr/src/trunk /usr/src/copy
    - copy interface / server dirs to /usr/local/ispconfig
    - restore config libs
    - DEVSYSTEM = 1
    - create a website -> NOT OK!

    The Apache config files, the web folders etc, nothing is created on the system.

    Did I miss something? or was this a "know problem" when using this method?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Have you enabled loglevel debug and then executed the server.sh script manually to see which exact error you get?
     
  7. Mark_NL

    Mark_NL New Member

    Yes i did, when it's not working i only get this:
    Code:
    root@ispc3dev:/usr/local/ispconfig# /usr/local/ispconfig/server/server.sh
    09.09.2011-13:34 - DEBUG - Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    09.09.2011-13:34 - DEBUG - Found 1 changes, starting update process.
    09.09.2011-13:34 - DEBUG - Processed datalog_id 13
    09.09.2011-13:34 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    finished.
    when it does work i get a whole lot of other debug info.
     
  8. nveid

    nveid ISPConfig Developer ISPConfig Developer

    Your using define('DEVSYSTEM',1) in config.inc.php in ~/server/lib/config.inc.php right? Check your permissions as well and the /var/log/ispconfig/cron.log, could be that server.sh and cron_dailly.sh doesn't have the correct permissions (thats happened a couple times with me, had to change the permissions back). Oh, and check the permissions in the repo directory since its symbolically linked.
     

Share This Page