Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Moderator: crythias

Post Reply
turnip
Znuny newbie
Posts: 13
Joined: 20 Aug 2010, 04:50
Znuny Version: 4.0.7

Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by turnip »

I've been using OTRS on CentOS/Apache for 7 years until last month. I got tired of Linux and the need to maintain two separate VMs (Linux & Windows), so I decided to move OTRS, phpBB and as my main .NET website to Windows Server 2012 R2 running IIS 8.5.

I was disappointed to learn that otrs.com doesn't seem to support OTRS on Windows anymore and offers an "appliance" instead. I already had a kind of Linux appliance, and I found it hard to manage in the long term. Besides, it's much more convenient to have just Windows with a single IP address, with OTRS and phpBB located at website.com\otrs and website.com\forum. So I proceeded with my plan and am very satisfied with the result. OTRS on Windows runs faster than my old Linux installation.

I'd like to share my experience, in the hope that otrs.com will reconsider its stance on Windows.

(to be continued)
Nick
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by jojo »

There are several (non OTRS) issues with Perl webapplications on windows.
  • No stable setup for Apache + mod_perl
  • PerlEx (needs Active State Perl Licence) for IIS seems EOL
  • Slower than on the same hardware with Linux
  • bad debugging for IIS
Some OTRS specific issues
  • Mails can only be handled by direct smtp
  • Slower than on the same hardware with Linux
  • updates are more difficult
  • less stable on load
Your setup seems to be quite small, so actually it might be working on windows. My experience with OTRS on the different platforms are that Windows is not suitable.
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
turnip
Znuny newbie
Posts: 13
Joined: 20 Aug 2010, 04:50
Znuny Version: 4.0.7

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by turnip »

No stable setup for Apache + mod_perl
To my personal taste, IIS is more pleasant to deal with, even after I used Apache for OTRS/phpBB for the last 7 years.
PerlEx (needs Active State Perl Licence) for IIS seems EOL
Yes, Active Perl is expensive, but I used free Strawberry Perl. PerlEx is not needed.
Slower than on the same hardware with Linux
It's not the case for me. I used FastCGI, works beautifully.
bad debugging for IIS
I had to do some debugging to make it work. I should say it was OK for my purposes.

I will post the instructions over the weekend. Sorry for the delay.
Nick
turnip
Znuny newbie
Posts: 13
Joined: 20 Aug 2010, 04:50
Znuny Version: 4.0.7

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by turnip »

By the way, what did you mean by "Mails can only be handled by direct smtp", the lack of sendmail? In my setup, OTRS sends emails to the local (the same machine) Microsoft SMTP Server, the latter then forwards mail to Google Mail Relay for actual delivery.
Nick
turnip
Znuny newbie
Posts: 13
Joined: 20 Aug 2010, 04:50
Znuny Version: 4.0.7

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by turnip »

Below is how I moved OTRS 4.0.7 from CentOS/MySQL to Windows Server 2012 R2/IIS 8.5/SQL Server Express 2014.
  1. Install the IIS CGI role.
  2. Create an IIS website running the "MyAppPool" application pool with the "ApplicationPoolIdentity".
  3. Install 64-bit Perl from strawberryperl.com to C:\Strawberry (in my case, 5.20.2.1-64bit).
  4. Create local user "otrs", allow "Log on as a batch job", "Log on as a service".
  5. mkdir c:\opt\otrs\
  6. Allow "otrs" and "IIS AppPool\MyAppPool" to modify c:\opt\otrs\, "this folder, subfolder and files".
  7. Extract OTRS 4.0.7 to c:\opt\otrs\
  8. c:\opt\otrs\bin\otrs.CheckModules.pl
    "OCL.DLL missing" is OK as it relates to DBD::Oracle
  9. As an admin, install reported missing Perl modules:
    cpan
    install Crypt::Eksblowfish::Bcrypt ...
  10. Activate default config files
    cd c:\opt\otrs\
    copy Kernel\Config.pm.dist Kernel\Config.pm
    copy Kernel\Config\GenericAgent.pm.dist Kernel\Config\GenericAgent.pm
  11. Check if all needed Perl modules are installed (should display "syntax OK"):
    perl -cw c:\opt\otrs\bin\cgi-bin\index.pl
    perl -cw c:\opt\otrs\bin\cgi-bin\customer.pl
    perl -cw c:\opt\otrs\bin\otrs.PostMaster.pl
  12. c:\opt\otrs\bin\otrs.SetPermissions.pl doesn't seem to be needed for Windows.
  13. Either IIS or CGI::FastCGI has a bug which prevents the passing of Windows environment variables to a FastCGI script. It's easier to fix CGI::FastCGI:
    - Copy C:\Strawberry\perl\lib\CGI\Fast.pm to C:\opt\otrs\Custom\CGI\Fast.pm
    - Edit C:\opt\otrs\Custom\CGI\Fast.pm as follows:
    Fast.pm.zip

    Code: Select all

    ...
    use if $] >= 5.019, 'deprecate';
    
    # Add the following code at the top of the module
    %CGI::Fast::OrigEnv = %ENV;
    
    sub AppendOrigEnvWin32
    {
        if ( $^O eq 'MSWin32' ) 
        {
            foreach $_ (keys(%CGI::Fast::OrigEnv))
            {
                if((!exists $ENV{$_})
                    && ($_ ne "_FCGI_X_PIPE_"))
                {
                    $ENV{$_} = %CGI::Fast::OrigEnv{$_};
                }
            }
        }
    }
    ...
    
    # Replace the following line as shown:
    #return $CGI::Q = $self->SUPER::new($initializer, @param);
    
            $CGI::Q = $self->SUPER::new($initializer, @param);
    
            AppendOrigEnvWin32();
            return $CGI::Q;
    }
    
    
(to be continued)
You do not have the required permissions to view the files attached to this post.
Nick
turnip
Znuny newbie
Posts: 13
Joined: 20 Aug 2010, 04:50
Znuny Version: 4.0.7

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by turnip »

(continued)

14. If you need POP3S/POP3TLS/SMTPS/SMTPTLS:

The availability of POP3S and POP3TLS protocols displayed by C:\opt\otrs\bin\fcgi-bin\installer.pl (wich uses
C:\opt\otrs\Kernel\Modules\Installer.pm) is determined by Kernel::System::MailAccount::MailAccountBackendList() which
tries to load modules from C:\opt\otrs\Kernel\System\MailAccount\, such as POP3S.pm and POP3TLS.pm. Those modules
depend on Net::SSLGlue::POP3 (supplied in C:\opt\otrs\Kernel\cpan-lib\Net\SSLGlue\). The latter, in turn, may produce
the following error "cannot find and replace IO::Socket::INET superclass". IO::Socket::INET is an old class which doesn't
support IPv6. In our installation, Net::SMTP uses more advanced IO::Socket::IP, hence the error. It also means Net::SSLGlue is
not needed, so we need to remove references to it:
- Copy POP3S.pm and POP3TLS.pm from C:\opt\otrs\Kernel\System\MailAccount\ to C:\opt\otrs\Custom\Kernel\System\MailAccount\
- In the copied modules, comment out the following line:

Code: Select all

#use Net::SSLGlue::POP3;
Fix SMTPS.pm and SMTPTLS.pm in a similar way:
- Copy from C:\opt\otrs\Kernel\System\Email\ to C:\opt\otrs\Custom\Kernel\System\Email\
- In the copied modules, comment out the following line:

Code: Select all

#use Net::SSLGlue::SMTP;
Alternatively, you can try to actually fix SSLGlue as follows (though I see no point in this):
  • Copy POP3.pm and SMTP.pm from C:\opt\otrs\Kernel\cpan-lib\Net\SSLGlue\ to C:\opt\otrs\Custom\Net\SSLGlue\
  • Edit C:\opt\otrs\Custom\Net\SSLGlue\POP3.pm as follows:
    [old] grep { s{^IO::Socket::INET$}{Net::POP3::_SSL_Socket} } @ISA
    [new] grep { s{^(IO::Socket::INET|IO::Socket::IP)$}{Net::POP3::_SSL_Socket} } @ISA
  • Edit C:\opt\otrs\Custom\Net\SSLGlue\SMTP.pm as follows:
    [old] grep { s{^IO::Socket::INET$}{Net::SMTP::_SSL_Socket} } @ISA
    [new] grep { s{^(IO::Socket::INET|IO::Socket::IP)$}{Net::SMTP::_SSL_Socket} } @ISA
You don't have to worry about the above if you install local Microsoft SMTP Server. You can then configure OTRS to send emails over unencrypted SMTP to 127.0.0.1 (make sure the external SMTP interfaces are firewalled). The SMTP server can then either deliver emails directly to the destination, or act as a relay, forwarding emails to say smtp-relay.gmail.com for further delivery.

(to be continued)
Nick
turnip
Znuny newbie
Posts: 13
Joined: 20 Aug 2010, 04:50
Znuny Version: 4.0.7

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by turnip »

(continued)

15. In IIS Manager, add the following virtual directories to the website:
otrs -> c:\opt\otrs\bin\fcgi-bin
otrs-web -> c:\opt\otrs\var\httpd\htdocs

16. Edit %windir%\system32\inetsrv\config\applicationHost.config to add/modify the following section:

Code: Select all

        <fastCgi>
            <application fullPath="C:\Strawberry\perl\bin\perl.exe" arguments="C:\opt\otrs\bin\fcgi-bin\customer.pl" monitorChangesTo="C:\opt\otrs\Kernel\Config\Files\ZZZAuto.pm" stderrMode="IgnoreAndReturn200" idleTimeout="1800" />
            <application fullPath="C:\Strawberry\perl\bin\perl.exe" arguments="C:\opt\otrs\bin\fcgi-bin\index.pl" monitorChangesTo="C:\opt\otrs\Kernel\Config\Files\ZZZAuto.pm" stderrMode="IgnoreAndReturn200" idleTimeout="1800" />
            <application fullPath="C:\Strawberry\perl\bin\perl.exe" arguments="C:\opt\otrs\bin\fcgi-bin\installer.pl" monitorChangesTo="C:\opt\otrs\Kernel\Config\Files\ZZZAuto.pm" stderrMode="IgnoreAndReturn200" />
            <application fullPath="C:\Strawberry\perl\bin\perl.exe" arguments="C:\opt\otrs\bin\fcgi-bin\nph-genericinterface.pl" monitorChangesTo="C:\opt\otrs\Kernel\Config\Files\ZZZAuto.pm" stderrMode="IgnoreAndReturn200" />
            <application fullPath="C:\Strawberry\perl\bin\perl.exe" arguments="C:\opt\otrs\bin\fcgi-bin\public.pl" monitorChangesTo="C:\opt\otrs\Kernel\Config\Files\ZZZAuto.pm" stderrMode="IgnoreAndReturn200" idleTimeout="1800" />
        </fastCgi>
Alternatively, you can register the FastCGI handlers in the IIS Manager GUI.

Note: I will comment on the monitorChangesTo part later on.

17. Create C:\opt\otrs\bin\fcgi-bin\web.config with the following content:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- C:\opt\otrs\bin\fcgi-bin\web.config -->
<configuration>
    <system.webServer>
        <handlers>
            <add name="otrs-customer.pl" path="customer.pl" verb="*" modules="FastCgiModule" scriptProcessor="C:\Strawberry\perl\bin\perl.exe|C:\opt\otrs\bin\fcgi-bin\customer.pl" resourceType="File" />
            <add name="otrs-index.pl" path="index.pl" verb="*" modules="FastCgiModule" scriptProcessor="C:\Strawberry\perl\bin\perl.exe|C:\opt\otrs\bin\fcgi-bin\index.pl" resourceType="File" />
            <add name="otrs-installer.pl" path="installer.pl" verb="*" modules="FastCgiModule" scriptProcessor="C:\Strawberry\perl\bin\perl.exe|C:\opt\otrs\bin\fcgi-bin\installer.pl" resourceType="File" />
            <add name="otrs-nph-genericinterface.pl" path="nph-genericinterface.pl" verb="*" modules="FastCgiModule" scriptProcessor="C:\Strawberry\perl\bin\perl.exe|C:\opt\otrs\bin\fcgi-bin\nph-genericinterface.pl" resourceType="File" />
            <add name="otrs-public.pl" path="public.pl" verb="*" modules="FastCgiModule" scriptProcessor="C:\Strawberry\perl\bin\perl.exe|C:\opt\otrs\bin\fcgi-bin\public.pl" resourceType="File" requireAccess="Script" />
        </handlers>
    </system.webServer>
</configuration>
18. Create C:\opt\otrs\var\httpd\htdocs\web.config with the following content:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- C:\opt\otrs\var\httpd\htdocs\web.config -->
<configuration>
   <system.webServer>
      <staticContent>
         <remove fileExtension=".css" />
         <mimeMap fileExtension=".css" mimeType="text/css; charset=UTF-8" />
         <remove fileExtension=".js" />
         <mimeMap fileExtension=".js" mimeType="application/javascript; charset=UTF-8" />
      </staticContent>
      <rewrite>
         <outboundRules>
            <rule name="Cache css-cache for 30 days" preCondition="/skins/*/*/css-cache/*.css">
               <match serverVariable="RESPONSE_Cache-Control" pattern="(.*)" />
               <conditions>
               </conditions>
               <action type="Rewrite" value="max-age=2592000 must-revalidate" />
            </rule>
            <rule name="Cache css thirdparty for 4 hours, including icon fonts" preCondition="/skins/*/*/css/thirdparty/*.(css|woff|svg)">
               <match serverVariable="RESPONSE_Cache-Control" pattern="(.*)" />
               <conditions>
               </conditions>
               <action type="Rewrite" value="max-age=14400 must-revalidate" />
            </rule>
            <rule name="Cache js-cache for 30 days" preCondition="/js/js-cache/*.js">
               <match serverVariable="RESPONSE_Cache-Control" pattern="(.*)" />
               <conditions>
               </conditions>
               <action type="Rewrite" value="max-age=2592000 must-revalidate" />
            </rule>
            <rule name="Cache js thirdparty for 4 hours" preCondition="/js/thirdparty/*.js">
               <match serverVariable="RESPONSE_Cache-Control" pattern="(.*)" />
               <conditions>
               </conditions>
               <action type="Rewrite" value="max-age=14400 must-revalidate" />
            </rule>
            <preConditions>
               <preCondition name="/skins/*/*/css-cache/*.css">
                  <add input="{URL}" pattern="/skins/[^/]+/[^/]+/css-cache/.+\.css$" />
               </preCondition>>
               <preCondition name="/skins/*/*/css/thirdparty/*.(css|woff|svg)">
                  <add input="{URL}" pattern="/skins/[^/]+/[^/]+/css/thirdparty/.+\.((css)|(woff)|(svg))$" />
               </preCondition>>
               <preCondition name="/js/js-cache/*.js">
                  <add input="{URL}" pattern="/js/js-cache/.+\.js$" />
               </preCondition>>
               <preCondition name="/js/thirdparty/*.js">
                  <add input="{URL}" pattern="/js/thirdparty/.+\.js$" />
               </preCondition>>
            </preConditions>
         </outboundRules>
      </rewrite>
   </system.webServer>
</configuration>
19. Install IIS URL Rewrite.

20. Open http://localhost/otrs/installer.pl in a browser and follow the installer.
  • Choose Syslog as LogModule, which will log to the Event Log. Don't choose File, as C:\opt\otrs\Kernel\System\Log\File.pm tries to redirect STDERR and ends up with "Operation 'OPEN' not supported on FCGI::Stream handle" displayed by C:\Strawberry\perl\lib\FCGI.pm.
21. Install OTRS modules (I used only the FAQ module).

22. Install the "OTRS Scheduler" service:
  • C:\opt\otrs\bin\otrs.Scheduler4winInstaller.pl
  • In Control Panel > Services, change the service start to manual (it will be started by the otrs-scheduler_watchdog task), and change Log On credentials to "otrs".
  • Install Microsoft SubInACL
  • "C:\Program Files (x86)\Windows Resource Kits\Tools\subinacl.exe" /service OTRSScheduler /grant=otrs=f
23. In Windows Task Scheduler, add OTRS cron tasks (modify the server name in the attached XML files as needed; also, you will need to enable the tasks after you completed the setup):
tasks.zip
(to be continued)
You do not have the required permissions to view the files attached to this post.
Nick
turnip
Znuny newbie
Posts: 13
Joined: 20 Aug 2010, 04:50
Znuny Version: 4.0.7

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by turnip »

(continued)

24. Edit C:\opt\otrs\bin\otrs.Scheduler4win.pl:
- Change "notice" to "debug":

Code: Select all

...
Priority => 'notice',
Message  => "Scheduler Service status request! PID $SchedulerPID{PID}",
...
- Comment out the check related to Win32::IsAdminUser(). In our setup, it's not needed and shouldn't be there in the first place.

25. As OTRS will be logging to EventLog, it's a good idea to prevent noise there:
- Copy C:\opt\otrs\Kernel\System\Log\SysLog.pm to C:\opt\otrs\Custom\Kernel\System\Log\SysLog.pm, edit the latter:

Code: Select all

sub new {
    ...
    # err, warning [unused], notice [warning], info, debug
    Sys::Syslog::setlogmask( Sys::Syslog::LOG_UPTO(Sys::Syslog::LOG_NOTICE()) );
    return $Self;
}
- Copy C:\opt\otrs\Kernel\System\GenericAgent.pm to C:\opt\otrs\Custom\Kernel\System\GenericAgent.pm, edit the latter:

Code: Select all

            ...
            Priority => 'info',  
            Message  => "Run GenericAgent Job  ...
26. Migrate the database using Microsoft SQL Server Migration Assistant v6.0 for MySQL.

27. Update the config files as per your old installation.

28. Clear the OTRS cache with "c:\opt\otrs\bin\otrs.DeleteCache.pl"

That's pretty much it.

(to be continued)
Nick
turnip
Znuny newbie
Posts: 13
Joined: 20 Aug 2010, 04:50
Znuny Version: 4.0.7

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by turnip »

(continued)

Performance

Generally, it takes time for perl.exe to load itself and OTRS modules. However, with FastCGI, instances of perl.exe remain in memory to handle multiple web requests, which speeds up the things greatly. Note that there will be a delay when a new instance is loaded (for example, after you restarted IIS). It can be fine-tuned with IIS FastCGI settings.

I guess Perl pre-compiling can improve the performance even further.

Known issues
  1. Without the monitorChangesTo element mentioned at step 16 above, you may experience the following problem. When you make changes to SysConfig which affect the configuration files (such as ZZZAuto.pm), the changes get written to the file, but don't get reflected on the webpage. I guess it's because of a bug in OTRS which doesn't reload its config files in FastCGI mode.

    I tried to solve the issue with monitorChangesTo, but it seems to have intermittent issues, too. I didn't have time to investigate further, but will do eventually. It wasn't a big problem for me though, as I already had config files. If it's a problem for you at the setup stage, use normal (not Fast) CGI, then switch to FastCGI once the configuration is done.
  2. Admin Log is empty. It's because OTRS uses a Linux-specific Perl module which doesn't work on Windows. It's not a big deal as the messages go to the Event Log anyway.
The bottom line

I would like the OTRS.COM guys to reconsider their stance in relation to Windows, and to keep OTRS more or less compatible with it. After all, it could be good marketing to claim OTRS compatibility with IIS 8.5. I've discovered several related OTRS bugs and will file them shortly.
Nick
alstonamos
Znuny newbie
Posts: 1
Joined: 16 Apr 2016, 10:21
Znuny Version: sfgsfg

Re: Installing OTRS 4.0.7 on Windows Server 2012 R2, IIS 8.5

Post by alstonamos »

Besides, it's much more convenient to have just Windows with a single IP address, with OTRS and phpBB located at website.com\otrs and website.com\forum. So I proceeded with my plan and am very satisfied with the result. OTRS on Windows runs faster than my old Linux installation???



waleeed
Post Reply