Upload to web server: MantisBT configuration?

delphi package - automated exception handling
Post Reply
CBelanger
Posts: 18
Joined: Wed Sep 12, 2018 11:39 pm

Upload to web server: MantisBT configuration?

Post by CBelanger »

Hello:

I am using Delphi 10.2 Tokyo with madExcept. I have been upgrading a desktop program. The project uses madExcept 4.0.20. Found with this project and madExcept that emails, in any configuration, are not being sent. I consider this a bug, but not my subject of this post, because I wanted to use the web server approach to store bug reports. So the email problem just gave me the incentive to try the web server approach.

We have a VPS Windows Server 2008, R2 site. I tried Bugzilla first, but ran into issues which I could not readily resolve, so I tried MantisBT (latest version).
Setting up Windows IIS, MySQL ok. Ran into some difficulty with PHP, but was resolved by using PHP v5.6 instead of the latest 7.3. Finally was able to run the install.php and that went smoothly.

On to trying this out in my project with madExcept:
I am not clear about what I put into the configuration fields.
for Web Server: http://##.#.###.###/mantisbt
Encrypt is blank
Port is Auto, but it is 80. No ability to change "auto"
No green icon, just red. What is wrong with the web server entry?

next "user name (http auth)" What do I put here? The mantisbt user name? Can it be "administrator"; I did set up another user as Developer; should I use that? Is this the web site's user/pw? or something else?
next "account (bug tracker)" Is this the Mantis user/pw? or something else?

Because the Web Server name is throwing an error (i.e. the icon remain red !), I have no idea what is wrong or for that matter what I should put into the configuration.
Can you please help?
Thank you,
Chuck
Last edited by CBelanger on Thu Sep 13, 2018 1:11 am, edited 1 time in total.
CBelanger
Posts: 18
Joined: Wed Sep 12, 2018 11:39 pm

Re: Upload to web server: MantisBT configuration?

Post by CBelanger »

So, I noticed that when I clicked on the embedded URL for MantisBT for my web server in the post I just made, that it did not reach the site. Also, it displayed without "http://".
If I simply type ##.#.###.###/mantisbt in the browser, it too, does not usually connect to the site, while specifically typing "http://##.#.###.###/mantisbt" does.

Maybe this is part of the issue? How to resolve this if so?
Thank you,
Chuck
CBelanger
Posts: 18
Joined: Wed Sep 12, 2018 11:39 pm

Re: Upload to web server: MantisBT configuration?

Post by CBelanger »

Hi, Mathias:
With now having the source code, I was able to review the code, but I am unable to trace with the debugger.

I moved mad.inc and madExcept.pas into my project's folder. I opened up the madExcept wizard from the project menu. Modified the web server URL to force the timer to fire--and nothing happens! I moved my break point all the way up to madExceptWizard.BugTrackerTimerTimer on the StartCheckBugTracker line, and still not able to trace.

BTW by simply copying the web server URL + the '/api/soap/mantisconnect.php' into a browser, I got the error message that SOAP extension was not enabled. I noticed elsewhere in a forum that supposedly this is enabled by default, but that is clearly not the case. It was a simple matter of un-remming the appropriate line in the php.ini then restarting the server. The SOAP error was gone. Like another post, I see that SOAP api is eventually being replaced by REST.

Still madExcept does not give me a green check icon. Thus the need to trace the code.

Notice that you have default SSL with auto port. I do not have the webserver set up for SSL, nor do I know much about setting this up and will leave it off. Tried "---" setting for Encrypt and 80 for port. Still did not work.

I got Wireshark and on changing those madExcept webserver edit fields to fire a connection attempt what I get seems to suggest a handshake is going on between my computer and the host site and then back, then App data is sent from the host site back to my computer. No error messages, but then I am totally unaware about how to use wireshark and could be missing something.

What is so frustrating is that this is the last step after many months of work to upgrade my application to Delphi 10.2. I discovered that the email of bug reports simply no longer worked which led to me trying the web server approach, which was my long term direction anyway. What makes this difficult for both of us is that this could easily be some setup/config issue and I simply do not know. I have had no experience with setting up a webserver (IIS). I can say I was meticulous about following the Mantis and PHP and MySQL installation and setup instructions.

BTW, because I am using a VPS based on Windows server 2008 R2, I am using the latest Mantis 2.17.0, but PHP is 5.6 because of the older windows, and MySQL is older too. The webserver itself seems to be working fine. I can access the MantisBT web page and have even set up a generic user and project without any problems.

Can you please help me by telling me how I can trace the code to at least see what is going on. That would probably be a good start.
Thank you,
Chuck
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Upload to web server: MantisBT configuration?

Post by madshi »

Please make sure that mad.inc has "{$D+}{$L+}" in it, and that Delphi actually compiled madExcept.pas (you should get a madExcept.dcu file in your project folder). After that, debugging should work.

I'm not really an expert with either WireShark or generally webserver programming, myself, which is why debugging issues like this is always a nightmare for me... :(
CBelanger
Posts: 18
Joined: Wed Sep 12, 2018 11:39 pm

Re: Upload to web server: MantisBT configuration?

Post by CBelanger »

Thank you.
I confirmed that mad.inc does have "{$D+}{$L+}" in it.
I Built my project and confirmed that there was madExcept.dcu in the location I have the dcus go (\bin).
I have been assuming that I can trace the madExceptWizard (settings) and maybe that is the problem, because I still cannot trace into madExcept.
Are you suggesting that I trigger an error in my program and then I can trace madExcept? It would certainly be simpler to trace while I am trying to resolve the connection settings in the dialog.
If necessary, I could make a small test program using your routines.

Chuck
CBelanger
Posts: 18
Joined: Wed Sep 12, 2018 11:39 pm

Re: Upload to web server: MantisBT configuration?

Post by CBelanger »

Hello,
I'll start by answering my own question: yes, I had to initiate an error within my program/project to initiate debugging/trace.

Here is what I found so far:
my website URL is HTTP://##.#.###.###/mantisbt

in constructor TWinHttp.Create(), FUrl becomes first, '##.#.###.###/mantisbt' then finally just '/mantisbt'.
Not quite sure why, but most of the url is stripped away. No wonder nothing happens.
I have noticed that at least within a browser in order to actually get to the web site, the url must have the "HTTP://" with the IP address. There is no name for the IP address of our web server.

...more testing:
I see that there is FServer and FUrl, but as I stated above the FServer becomes '##.#.###.###' and the FUrl becomes '/mantisbt'; the FServer needs to retain the 'http://'.
Is there a reason for this stripping of 'http://'? Or, can you add logic that allows the 'http://' to stay with the IP address? e.g. look for a server which has IP address format rather than name.

I am not clear at all what I should be entering into the web server setup in the madExcept wizard:
as per above, what is the format of "web server:"
what is expected for the following entries:
encrypt: can it be None? does --- = "None"?
port (just auto?)
account (bug tracker): is this the admin account? or a new account I create. I noted that when setting up a new account in Mantis, no password is created or entered by the admin. An email is supposed to be sent to the new user for confirmation, but I never got it when sent to the new user email that I used in my test.
password: Is this the admin password or something else?

the rest of the edit fields I am kind of guessing based on other posts are filled after querying the mantis database, right? (i.e. project, area, assigned to)

I think it would be a great addition to add to the Tools a madTestWebServer program to help with this process of establishing connection. I kind of get the feeling that I am not the only one using madExcept, who is very intrigued by using Bugzilla or MantisBT for storing bug reports, but has little or no experience with setting this up. I have no trouble going through the learning curve, but such a tool to help integrate madExcept with MantisBT would be a big help for all.

BTW, I started with Bugzilla and abandoned it--I just could not get it to work in our environment: Windows server 2008, R2, Webserver IIS, MySql, and the Perl setup. I found Mantis much easier to set up and then it actually worked when I was done.

Right now, I will wait for your clarification of the above points. I could just try to change the URL with hard code, but I am not clear about the other setup entries.

Anyway that I can change code in madExceptWizard and have it work that way in the IDE?

Thank you!
Chuck
CBelanger
Posts: 18
Joined: Wed Sep 12, 2018 11:39 pm

Re: Upload to web server: MantisBT configuration?

Post by CBelanger »

Here is an article on REST which will be replacing SOAP for connecting with Mantis:

https://support.mantishub.com/hc/en-us/ ... -REST-APIs
CBelanger
Posts: 18
Joined: Wed Sep 12, 2018 11:39 pm

Re: Upload to web server: MantisBT configuration?

Post by CBelanger »

Finally got everything to work properly.

Here is what I learned and tried that might help others:

1. Not sure why, but my initial attempts to connect to my MantisBT web site via an IP address, HAD to have "HTTP://" preceding the IP address even in the browser (chrome). Otherwise, the site could not be reached. Later as I was accessing the site multiple times, I found that was no longer necessary.

In reviewing the madExcept source code, that "HTTP://" or "HTTPS://" was being stripped from the url. This led me to try to add code to madExcept to treat IP numerical addressses somewhat differently than domain names. This did not solve the connection issue, i.e. in tracing the code, TWinHttp.Create I added the routine, then in InitMantis the line: if MantisCall('mc_version', s1, false) then begin... was consistently false. In other words the program was not even recognizing the MantisBT address, since this line does not log in.

2.WireShark did little to add clarity to why the program was not connecting. I did find a rather amazing open source program SoapUI, which seemed to be able to allow all kinds of testing of API calls and web services. The problem with that is the open source version you need to directly edit the XML from the WSDL file for the various "MC_---" php calls. I had no idea how to do that beyond changing the user name and password. Apparently, one needs to change one (which one I could not determine) HTTP address in the WSDL file to properly connect and then test. The tests themselves create very extensive log files with all kinds of valuable information. BTW, Mathias, if you ever decide to convert the SOAP to REST, this program allows you to test REST APIs, too. Overall I found the SoapUI documentation to pretty difficult to follow, since it is geared toward people creating APIs and then testing those, rather than me simply testing a site's response. But for those who can, it looks like an amazing tool to test a site.

3. Then I remembered that ManthisBT has a demo site. I thought it would be good to see how a "good" site works in madExcept setup dialog and it would help me determine which fields to fill out and what to put in them, since there are two sets of user/password editors in the dialog.
The Demo site:
https://www.mantisbt.org/bugs
On entering and setting encryption: SSL and Auto for port I got the green check mark.
Then I tried the various combinations of User and PW (opensourcecms for both) in the setup fields.
What I found is that you leave the User Name (http auth) and respective password editor BLANK, but you enter the Account (bug tracker) with the User Name and then enter the password. That works.
And by entering my own web site information in that order worked for my MantisBT site.

4. When setting up Mantis an admin account is created, but you do want to make at least one account for uploading the madexcept bug reports to. I found doing this very frustrating at first, because even as the admin, you cannot create a password on these new accounts. Mantis sends an email to the new account's specified email and that provides a unique link to enter the new password. It just wasn't working. Later I discovered that for some reason it was not reaching the gmail accounts I was using, but when I changed the C:\Mantis\mantisbt\config\config_inc.php file to include: $g_email_ensure_unique = OFF: Then I could use my non-gmail email account for both admin and user accounts. I did set Manthis up to use SMTP with my ISP. In my IIS web service I added SMTP, too. Not sure that was necessary.

There were code changes the various PHP files and even a older plugin to allow the admin to directly enter a password for a new account. I tried the plugin and one of the series of code changes and neither worked. That is when I decided that it would be best to just make the email work. MantisBT recommends for security to use the email to the new user method to set up new account passwords.

You do need to configure the config_inc.php file for your email preferences. I decided to use the SMTP method.

Hope this helps.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Upload to web server: MantisBT configuration?

Post by madshi »

Good to hear you got it working!

So the key problem was that you entered the Mantis user name and password in the fields in the madExcept settings dialog? I did intentionally add "http auth" and "bug tracker" in the description, to signal which field is which. Generally, there are 2 ways to authenticate access, "http auth" is sometimes used, but if it's not used, you just leave it empty. The "bug tracker" fields are those that you need to login into Mantis.
Post Reply