GUIDE: Configuring Instant Mantis to run as Windows services

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
HunteR-RosE
Posts: 1
Joined: May 23, 2007 1:59 pm

GUIDE: Configuring Instant Mantis to run as Windows services

Post by HunteR-RosE »

I don't know if this is against forums rule to post this information but I figure a lot of people use Mantis in different ways. For me Instant Mantis was a good solution for me because it didn't require any prerequisites in order to run and was easily portable if need be. I have looked around and haven't seen anything on this topic so I thought I'd post how I got things working for anyone else that might be in the same boat.

The servers we were going to use it on could not have Apache and PHP installed on them so our options were limited. Running the full version was not an option. Running the "Instant Mantis" version was our only hope. However, running the instant version had one major limitation for our use... when ever a user would logout of the server, it killed the apache and mysql services. And these are frequently used servers so the webpage would be unavailable throughout the day because people would log on and off.

The solution was to be able to run both Apache and MySQL as services and that is what I'm going to explain how to do with some command lines that create the services, and one modification to two files.

Keep in mind the the following code refers to MY PATHS of where I installed Mantis, so substitute your own paths of where yours is and you should be fine.

Step 1 - CREATE AN APACHE SERVICE TO RUN UNDER WINDOWS SERVICES

From a command prompt go to the bin directory of Apache...

For me it was:
D:\Applications\Mantis\InstantMantis\server\Apache2\bin>

Type the following command:

Code: Select all

apache_im.exe -k install -n "Instant Mantis" -C "DocumentRoot D:\Applications\Mantis\InstantMantis\mantis\mantis_current" -C "Listen 8008" -C "ServerRoot D:\Applications\Mantis\InstantMantis\server\Apache2"
Step 2 - CREATE A MYSQL SERVICE TO RUN UNDER WINDOWS SERVICES

From a command prompt go the bin directory of MySQL

For me it was:

D:\Applications\Mantis\InstantMantis\server\mysql-4.1.16-win32\bin>

Type the following command:

Code: Select all

mysqld.exe --install "mysqld" --defaults-file=D:\Applications\Mantis\InstantMantis\server\mysql-4.1.16-win
32\my.ini
Step 3 - EDIT THE HTTPD.CONF FILE IN APACHE

Go to Line 57, or the line that says, "ServerRoot ".."

Change it to:

Code: Select all

ServerRoot "D:\Applications\Mantis\InstantMantis\server\Apache2"
Step 4 - EDIT THE MY.INI FILE IN MYSQL

Go to Line 87, or the section at the bottom that says, "[mysqld]"

Change the default paths in this section to:

Code: Select all

[mysqld]
# set basedir to your installation path
basedir=D:/Applications/Mantis/InstantMantis/server/mysql-4.1.16-win32
# set datadir to the location of your data directory
datadir=D:/Applications\Mantis/InstantMantis/data

If done correctly you should now have two services created under your Windows services (services.msc), one for "Instant Mantis Apache" and one for "Instant Mantis MySQL". Start both of the services to start your website. Since the website is now controlled by services instead of console windows, you don't have to worry about the processes getting killed.

Also, I don't know if I'll ever look at this post again so please don't ask any questions because I probably don't have the answers. I'm only posting my results because it was a real b!@#$! trying to get "Instant Mantis" working as services, instead of command windows... oh yeah... and so I have a place to look for my documented steps later if it has to be rebuilt.

Have a nice day!
vboctor
Site Admin
Posts: 1289
Joined: Feb 13, 2005 5:11 pm
Location: Redmond, Washington
Contact:

Post by vboctor »

Thanks a lot HunteR-RosE. This is very useful. I will add a link to it from the Wiki or even copy it there.
Migrate your MantisBT to the MantisHub Cloud
Troy
Posts: 1
Joined: Aug 27, 2007 12:26 pm

Post by Troy »

Thanks for the guide. I have a few things to add.

First, when editing my.ini, make sure that you change the two port= lines to match the port in inmstart.cmd.

Second, make sure you use forward slashes for datadir in my.ini. My SQL server seemed to fail until I changed this.

Finally, to help with creating the services, copy the code below and past into a .BAT file. Put the .BAT file in the same place as inmstart.cmd. Double-click the .BAT file, and it will create the services for you without having to worry about paths. You'll still need to edit my.ini and httpd.conf manually, but this should save you some trouble. This .BAT file was based off inmstart.cmd by the way.

Code: Select all

@echo off
TITLE Instant Mantis Server

SET APACHE_PORT=8008
SET MYSQL_PORT=3360

SET INSTANT_MANTIS_ROOT=%CD%
SET DOCUMENT_ROOT=%INSTANT_MANTIS_ROOT%/root/mantis
SET MYSQL_ROOT=%INSTANT_MANTIS_ROOT%\server\mysql-4.1.16-win32
SET DATA_ROOT=%INSTANT_MANTIS_ROOT%\data

ECHO Installing Apache...

"%INSTANT_MANTIS_ROOT%\server\apache2\bin\apache_IM.exe" -k install -n "Instant Mantis" -C "DocumentRoot %DOCUMENT_ROOT%" -C"Listen %Apache_Port%" -C "ServerRoot %INSTANT_MANTIS_ROOT%\server\Apache2"

"%MYSQL_ROOT%\bin\mysqld.exe" --install "InstantMantisSQL" --defaults-file=%MYSQL_ROOT%\my.ini
crusso
Posts: 1
Joined: Oct 01, 2007 9:07 am
Contact:

Mantis as service...

Post by crusso »

I couldn't make it work with the script as is. I had to change it as shown below. (i had to remove the parameters after install -n "Instant Mantis")

regards.

Code: Select all

TITLE Instant Mantis Server 

SET APACHE_PORT=8008 
SET MYSQL_PORT=3360 

SET INSTANT_MANTIS_ROOT=%CD%
SET DOCUMENT_ROOT=%INSTANT_MANTIS_ROOT%/root/mantis
SET MYSQL_ROOT=%INSTANT_MANTIS_ROOT%\server\mysql-4.1.16-win32
SET DATA_ROOT=%INSTANT_MANTIS_ROOT%\data

ECHO Installing Apache... 

"%INSTANT_MANTIS_ROOT%\server\apache2\bin\apache_IM.exe" -k install -n "Instant Mantis"

"%MYSQL_ROOT%\bin\mysqld.exe" --install "InstantMantisSQL" --defaults-file=%MYSQL_ROOT%\my.ini
hmendez
Posts: 1
Joined: Oct 31, 2011 1:19 pm

Re: GUIDE: Configuring Instant Mantis to run as Windows serv

Post by hmendez »

I was able to create the two services, but mysql throws an error while trying to start the service. Anyone knows how to fix this? "Error 1067".
Post Reply