OTRS Test Site with different database

Moderator: crythias

Locked
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

OTRS Test Site with different database

Post by dstover »

I am trying to implement an OTRS test site on the same machine as the production one and am having difficulties. Even though I am able to access the test site by the test URL and have configured a different database name in Config.pm, the test site is still using the production database. It appears to be due to otrs.Scheduler.pl not stopping and starting up correctly.

How do you set up an OTRS test site on the same machine as the production site and have them coexist peacefully, while using different databases?

Thanks in advance for any assistance...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
wurzel
Znuny guru
Posts: 3274
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: OTRS Test Site with different database

Post by wurzel »

Hi,

I would think it is possible with an correctly configured webserver (vhosts), 2 database(names), and two file directories. (never did this)

But without looking on your configuration, it is not easy to see, what you've done.

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

Please let me know what information you would need and I will attempt to provide it. Also, is there a problem running two versions of otrs.Scheduler.pl or can I get by with one?

Thanks in advance...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
wurzel
Znuny guru
Posts: 3274
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: OTRS Test Site with different database

Post by wurzel »

Hi,

Information. All you have about:

your
webserver
webserver configuration
database
database configuration
your OTRS versions
your OTRS File Hirarchy

I did not say, that I can help you with. But without this information no one is able to ;)

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

Information. All you have about:

your
webserver

Apache 2.2.22
webserver configuration
Two sites - otrs and otrs2
database
MySQL 5.5.31
database configuration
Two identical databases - otrs and otrsbeta
your OTRS versions
3.2.7 for both systems
your OTRS File Hirarchy
Standard

The issue is that the test system runs fine but is pointing to the production database (otrs), even though the test database (otrsbeta) is pointed to in the Config.pm.

Thanks in advance for any assistance...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
wurzel
Znuny guru
Posts: 3274
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: OTRS Test Site with different database

Post by wurzel »

Hi,

if your systems is 'fine' except the pointing to the correct database, it seems, that your Config.pm setting is wrong. Or you have wrong permissions on database.
Whatever. Without a look on it... no chance.

Give more information about configuration, as mentioned before. Config.pm settings would be a start.
Or output from otrs.CheckDB.pl

you see? We need information. You don't event show the important information from your OS. Your signature is not presenting anything. How can you expect help? :(


Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

Here are my config.pm file contents. I have attached the otrs.CheckDB output as files. Please let me know any more information you might need. I apologize for the initial lack of data.

CONFIG.PM for production OTRS

Code: Select all

# --
# Kernel/Config.pm - Config file for OTRS kernel
# Copyright (C) 2001-2013 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
#  Note:
#
#  -->> Most OTRS configuration should be done via the OTRS web interface
#       and the SysConfig. Only for some configuration, such as database
#       credentials and customer data source changes, you should edit this
#       file. For changes do customer data sources you can copy the definitions
#       from Kernel/Config/Defaults.pm and paste them in this file.
#       Config.pm will not be overwritten when updating OTRS.
# --

package Kernel::Config;

use strict;
use warnings;
use utf8;

sub Load {
    my $Self = shift;

    # ---------------------------------------------------- #
    # database settings                                    #
    # ---------------------------------------------------- #

    # The database host
    $Self->{'DatabaseHost'} = 'localhost';

    # The database name
    $Self->{'Database'} = 'otrs';

    # The database user
    $Self->{'DatabaseUser'} = 'otrs';

    # The password of database user. You also can use bin/otrs.CryptPassword.pl
    # for crypted passwords
    $Self->{'DatabasePw'} = 'hot';

    # The database DSN for MySQL ==> more: "perldoc DBD::mysql"
    $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";

    # The database DSN for PostgreSQL ==> more: "perldoc DBD::Pg"
    # if you want to use a local socket connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
    # if you want to use a TCP/IP connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};host=$Self->{DatabaseHost};";
    # if you have PostgresSQL 8.1 or earlier, activate the legacy driver with this line:
#    $Self->{DatabasePostgresqlBefore82} = 1;

    # The database DSN for Microsoft SQL Server - only supported if OTRS is
    # installed on Windows as well
#    $Self->{DatabaseDSN} = "DBI:ODBC:driver={SQL Server};Database=$Self->{Database};Server=$Self->{DatabaseHost},1433";

    # The database DSN for Oracle ==> more: "perldoc DBD::oracle"
#    $ENV{ORACLE_HOME} = '/u01/app/oracle/product/10.2.0/client_1';
#    $ENV{NLS_DATE_FORMAT} = 'YYYY-MM-DD HH24:MI:SS';
#    $ENV{NLS_LANG} = "american_america.utf8";

#    $Self->{DatabaseDSN} = "DBI:Oracle:sid=OTRS;host=$Self->{DatabaseHost};port=1522;";

    # ---------------------------------------------------- #
    # fs root directory
    # ---------------------------------------------------- #
    $Self->{Home} = '/opt/otrs';

    # ---------------------------------------------------- #
    # insert your own config settings "here"               #
    # config settings taken from Kernel/Config/Defaults.pm #
    # ---------------------------------------------------- #
    # $Self->{SessionUseCookie} = 0;
    # $Self->{CheckMXRecord} = 0;

    # ---------------------------------------------------- #

    # ---------------------------------------------------- #
    # data inserted by installer                           #
    # ---------------------------------------------------- #
    # $DIBI$

    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
    #                                                      #
    # end of your own config options!!!                    #
    #                                                      #
    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
}

# ---------------------------------------------------- #
# needed system stuff (don't edit this)                #
# ---------------------------------------------------- #
use strict;
use warnings;

use vars qw(@ISA);

use Kernel::Config::Defaults;
push (@ISA, 'Kernel::Config::Defaults');

# -----------------------------------------------------#

1;
CONFIG.PM of OTRSBETA

Code: Select all

# --
# Kernel/Config.pm - Config file for OTRS kernel
# Copyright (C) 2001-2013 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
#  Note:
#
#  -->> Most OTRS configuration should be done via the OTRS web interface
#       and the SysConfig. Only for some configuration, such as database
#       credentials and customer data source changes, you should edit this
#       file. For changes do customer data sources you can copy the definitions
#       from Kernel/Config/Defaults.pm and paste them in this file.
#       Config.pm will not be overwritten when updating OTRS.
# --

package Kernel::Config;

use strict;
use warnings;
use utf8;

sub Load {
    my $Self = shift;

    # ---------------------------------------------------- #
    # database settings                                    #
    # ---------------------------------------------------- #

    # The database host
    $Self->{'DatabaseHost'} = 'localhost';

    # The database name
    $Self->{'Database'} = 'otrsbeta';

    # The database user
    $Self->{'DatabaseUser'} = 'otrs';

    # The password of database user. You also can use bin/otrs.CryptPassword.pl
    # for crypted passwords
    $Self->{'DatabasePw'} = 'hot';

    # The database DSN for MySQL ==> more: "perldoc DBD::mysql"
    $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";

    # The database DSN for PostgreSQL ==> more: "perldoc DBD::Pg"
    # if you want to use a local socket connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
    # if you want to use a TCP/IP connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};host=$Self->{DatabaseHost};";
    # if you have PostgresSQL 8.1 or earlier, activate the legacy driver with this line:
#    $Self->{DatabasePostgresqlBefore82} = 1;

    # The database DSN for Microsoft SQL Server - only supported if OTRS is
    # installed on Windows as well
#    $Self->{DatabaseDSN} = "DBI:ODBC:driver={SQL Server};Database=$Self->{Database};Server=$Self->{DatabaseHost},1433";

    # The database DSN for Oracle ==> more: "perldoc DBD::oracle"
#    $ENV{ORACLE_HOME} = '/u01/app/oracle/product/10.2.0/client_1';
#    $ENV{NLS_DATE_FORMAT} = 'YYYY-MM-DD HH24:MI:SS';
#    $ENV{NLS_LANG} = "american_america.utf8";

#    $Self->{DatabaseDSN} = "DBI:Oracle:sid=OTRS;host=$Self->{DatabaseHost};port=1522;";

    # ---------------------------------------------------- #
    # fs root directory
    # ---------------------------------------------------- #
    $Self->{Home} = '/opt/otrs2/otrs';
    $Self->{FQDN} = 'otrslamp.emacinc.com';
    

    # ---------------------------------------------------- #
    # insert your own config settings "here"               #
    # config settings taken from Kernel/Config/Defaults.pm #
    # ---------------------------------------------------- #
    # $Self->{SessionUseCookie} = 0;
    # $Self->{CheckMXRecord} = 0;

    # ---------------------------------------------------- #

    # ---------------------------------------------------- #
    # data inserted by installer                           #
    # ---------------------------------------------------- #
    # $DIBI$

    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
    #                                                      #
    # end of your own config options!!!                    #
    #                                                      #
    # ---------------------------------------------------- #
    # ---------------------------------------------------- #
}

# ---------------------------------------------------- #
# needed system stuff (don't edit this)                #
# ---------------------------------------------------- #
use strict;
use warnings;

use vars qw(@ISA);

use Kernel::Config::Defaults;
push (@ISA, 'Kernel::Config::Defaults');

# -----------------------------------------------------#

1;
Thanks very much...Dan.
You do not have the required permissions to view the files attached to this post.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

More information: all files are set to 775 and have an owner and group of otrs2. The Scheduler process is run under the ID otrs2. Is it possible to run two instances of the Scheduler without causing problems?
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
wurzel
Znuny guru
Posts: 3274
Joined: 08 Jul 2010, 22:25
Znuny Version: x.x.x
Real Name: Florian

Re: OTRS Test Site with different database

Post by wurzel »

Hi,

looks good. I think, it should be possible to run 2 schedulers. If you get no information here (and your configuration looks good I think) you can open
a bugreport.

Flo
OTRS 2025 SILVER (Prod)
OTRS 2025 auf Debian 12 (Test)
Znuny 7.x latest version testing auf Debian 12

-- Ich beantworte keine Forums-Fragen PN - No PN please

I won't answer to unfriendly users any more. A greeting and regards are just polite.
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

One more question. Is there anywhere that the database name is referenced inside the OTRS database or somewhere other than Config.pm or Defaults.pm that would be pointing to the database name?

It looks like everything is OK, including the scheduler, but it still points to the production database.

Any help or advice is greatly appreciated....Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS Test Site with different database

Post by crythias »

I would probably suggest changing otrs.Scheduler.pl

change instances of "otrs.Scheduler" to "otrs.Scheduler2"

Also, cron jobs run as the user (otrs) in which they've been scheduled, so you'll want another user (otrs2) with a different HOME directory as context.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

Thanks for your reply. I tried something similar to that earlier but will try it again. I have changed some things since then so it might work now.

I appreciate the information...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

I noticed that I was using the regular otrs user in MySQL, which only had access to the otrs database, not the new one, otrsbeta. I set up a new user that only points to the otrsbeta database. I set up my beta web site so that it uses a different port (8888). I am running the Scheduler under the ID otrs2. I updated the Config.pm and the Defaults.pm to point to the otrsbeta database. I have changed all the instances of otrs.Scheduler in otrs.Scheduler.pl to otrs.Scheduler2 and reloaded the configuration, restarted the Scheduler and restarted Apache. The process_id table is pointing to otrs.Scheduler2 and the correct process ID.

Unfortunately, the beta system is still pointing to the production database. The way I know is that i keeping doing copies of the processes that I have set up (under Process Management) and they show up in both places.

Do I need to totally install the beta system from scratch? I just made a copy before and changed the database name. I am running out of options.

Please advise. Thanks...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS Test Site with different database

Post by crythias »

dstover wrote:The way I know is that i keeping doing copies of the processes that I have set up (under Process Management) and they show up in both places.
The way I'd check is I'd add a customer or ticket and see if it's in the other interface.

I can't tell you why you're having these issues, but it seems like you're referencing the wrong config for beta.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

I tried adding a ticket and it came up in both systems. I have noticed that there is a variable or environment variable called <OTRS_CONFIG_HOME> referenced in multiple places, but I do not know how to find out the value of that or any of the other built-in variables. So I guess the two things I need to know at the moment are:

1) How do I display or otherwise determine the values of the built-in variables?

2) Are there any other config files that I should be aware of besides Config.pm and Defaults.pm?

I appreciate your input very much. Thanks...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

I just verified that the beta system is pointing to the production config files. I renamed both of them and the beta system kept working. So, is there somewhere I can point to the Config.pm and Defaults.pm files?
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: OTRS Test Site with different database

Post by crythias »

dstover wrote:I just verified that the beta system is pointing to the production config files. I renamed both of them and the beta system kept working. So, is there somewhere I can point to the Config.pm and Defaults.pm files?
You can't do what you want to do. Possibly you can disable perl reload, etc. but there are caching and other issues that aren't easy enough to overcome for what it's doing. I just attempted and it's random which config it obeys because of (I believe) Apache2::Reload ... I adjusted apache2-perl-startup.pl to reflect my other path as I believe it's also something related.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

Is it even possible to create an OTRS test site on the same machine as the production site, with a clone of the production database? I can't believe that no one has ever done this. If you know of any way to do this, please let me know.

Thanks for all of your responses...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
dstover
Znuny advanced
Posts: 135
Joined: 04 Jun 2013, 23:14
Znuny Version: 3.3.3
Real Name: Dan Stover
Company: EMAC, Inc.

Re: OTRS Test Site with different database

Post by dstover »

Got it working. Apparently it was a perl issue. I added a line containing the words "PerlOptions +Parent" after the <IfModule mod_perl.c> statement in the Apache site config file, as follows:

Code: Select all

<VirtualHost *:8080>
# --
# added for OTRS (http://otrs.org/)
# --

ScriptAlias /otrs2/ "/opt/otrs2/otrs/bin/cgi-bin/"
Alias /otrs-web/ "/opt/otrs2/otrs/var/httpd/htdocs/"

# activate this if you are using an Oracle database
#SetEnv ORACLE_HOME /path/to/your/oracle/
#SetEnv ORACLE_SID YOUR_SID
#SetEnv NLS_LANG AMERICAN_AMERICA.UTF8
#SetEnv NLS_DATE_FORMAT 'YYYY-MM-DD HH24:MI:SS'

<IfModule mod_perl.c>
    PerlOptions +Parent
    # Setup environment and preload modules
    Perlrequire /opt/otrs2/otrs/scripts/apache2-perl-startup.pl

    # Reload Perl modules when changed on disk
    PerlModule Apache2::Reload
    PerlInitHandler Apache2::Reload

    # general mod_perl2 options
    <Location /otrs2>
         ErrorDocument 403 /otrs2/customer.pl
         ErrorDocument 403 /otrs2/index.pl
         SetHandler  perl-script
         PerlResponseHandler ModPerl::Registry
         Options +ExecCGI
         PerlOptions +ParseHeaders
         PerlOptions +SetupEnv
         Order allow,deny
         Allow from all
    </Location>

    # mod_perl2 options for GenericInterface
    <Location /otrs2/nph-genericinterface.pl>
        PerlOptions -ParseHeaders
    </Location>

</IfModule>

<Directory "/opt/otrs2/otrs/bin/cgi-bin/">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all

    <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/html text/javascript text/css text/xml application/json text/json
    </IfModule>
</Directory>

<Directory "/opt/otrs2/otrs/var/httpd/htdocs/">
    AllowOverride None
    Order allow,deny
    Allow from all

    <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/html text/javascript text/css text/xml application/json text/json
    </IfModule>
</Directory>

<IfModule mod_headers.c>
    <Directory "/opt/otrs2/otrs/var/httpd/htdocs/skins/*/*/css-cache">
        <FilesMatch "\.(css|CSS)$">
            Header set Cache-Control "max-age=2592000 must-revalidate"
        </FilesMatch>
    </Directory>

    <Directory "/opt/otrs2/otrs/var/httpd/htdocs/js/js-cache">
        <FilesMatch "\.(js|JS)$">
            Header set Cache-Control "max-age=2592000 must-revalidate"
        </FilesMatch>
    </Directory>
</IfModule>

</VirtualHost>
Of course, this was after all the other manipulations I did but it was the only thing that worked. I am not going to go back and try to identify what worked and what didn't as I need to get this in place. My opinion is that anyone having this issue should try modifying all paths to point correctly, then modify their Apache site file as above. Reload Apache and hopefully it will work. Please note that this configuration is pointing to port 8080 and there will need to be an entry in /etc/apache2/ports.conf that looks like this:

NameVirtualHost *:8080
Listen 8080

for this to work. I am thinking about removing the "OTRS newbie" from my name and adding "OTRS Intermediate" (assuming that's possible).

I appreciate all of the responses by all. :D Have a great day...Dan.
OTRS 3.3.3
Ubuntu 12.04
MySQL DB
Locked