NetTalk Central

Author Topic: Multiple Hosting question  (Read 7173 times)

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Multiple Hosting question
« on: October 29, 2012, 07:24:03 AM »
I use port 88 to host my app.  How do I host multiple apps?  What other templates do I need besides NetTalk6?

Is example 59 for this?  I'm getting template error when I open this app. I may be missing some template.

Thanks,
Sukhendu

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Multiple Hosting question
« Reply #1 on: October 29, 2012, 10:10:32 PM »
Hi Sukhendu,

I think start by reading this thread, and the included PDF.
http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=1443.0

what template error are you getting?

Cheers
Bruce

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: Multiple Hosting question
« Reply #2 on: October 31, 2012, 06:39:21 AM »
Bruce,

I had not installed the WinEvent and xFiles templates in c8 and hence the template error.  After installing those templates the error went away.  Now the host.exe is compiling fine.

I may be misunderstanding the multi-host logic.  This is what I want to accomplish and is multi-host the answer?

1) I have one multi-dll app (mixed firebird+tps)  named dockmgr.  With port 88, dockmgr runs fine.
2) I want to host dockmgr for two companies in my server that has dyndns ip address.
3) Two companies data are separate and are in two separate folders
4) Host.exe is in c:\dockmgr folder.  There is also a c:\dockmgr\web folder
5) C:\dockmgr\companyA has all dlls that are needed to run dockmgr.  The webserver procedure is in a dll called wtruck.dll.  There is also a c:\dockmgr\companyA\web folder. CompanyA data is in c:\dockmgr\companyA\data folder
6) CompanyB setup is identical to CompanyA, that is, another set of folders for CompanyB.  IOW, dockmgr dlls are in two places: one for companyA and the other for companyB.

Is multi-host example (59) is the answer to what I'm trying to do?   I have just one host name, how can both companies deploy their dockmgr in my server?

Hope I'm able to explain my situation.

Thanks,
Sukhendu

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Multiple Hosting question
« Reply #3 on: October 31, 2012, 07:52:36 AM »
Hi Sukhendu,

You're making things more complicated than they need to be, I think. I don't see a need for a multi-host setup here. Why not simply run one instance of the web app and then - based on the user login - pick the right data folder? That'll also make it easier to add more customers in the future, should the need arise.

Peter

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Multiple Hosting question
« Reply #4 on: October 31, 2012, 08:46:51 AM »
DNS only handles the routing to an IP address same goes for subdomains so Company1.domain.com can be routed to one Ip address and company2.domain.com can be routed to a different IP address. Firewalls and routers handle the port redirects.

So one option is to setup two separate servers each with their own IP address that maps to a subdomain in the DNS.
Another option is like Peter suggested, have a generic webpage where the users login and get shown their data. Option 2 is easiest if you dont know how to setup DNS.

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: Multiple Hosting question
« Reply #5 on: October 31, 2012, 08:57:09 AM »
Hi Peter,

I follow what you are saying, but my situation is different.  Although we developed the dockmgr web app, but this app belongs to companyA as well as companyB with their respective data and users.  Think of this as two separate NTWS web apps and I'm trying to host then in the same box (server) with one dyndsn ip address with one port 88 open.  At this point I would prefer to avoid creating multiple virtual servers on the same box.

Thanks,
Sukhendu


peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Multiple Hosting question
« Reply #6 on: October 31, 2012, 10:33:31 AM »
Then another option would be to get two ip adresses - one for each customer and pointing to the same server - and bind each webserver to its own ip (that's a NT option). Using that scenario you can run both web servers on the same physical server. I haven't tried it but based on the docs it should be possible. Bruce may correct me if I'm wrong.


Peter

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Multiple Hosting question
« Reply #7 on: October 31, 2012, 02:41:54 PM »
Hi Sukhendu,

If the apps are identical and they are owned by Coy A and B do they really need to know or care that you are serving data from the one app running? I started out running a separate app for each company on a different port and quickly realized I was creating myself a nightmare and would quickly run out of memory. I redesigned the app so now all coys log into the same app and I just serve up data and docs from the right DB or folder. I'm running MS SQL. Muti-site was not an option for me as it doesn't/didn't work on https.

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: Multiple Hosting question
« Reply #8 on: October 31, 2012, 04:43:03 PM »
Hi Kevin,

I'm using separate ports to accomplish what I want.  But your finding "I started out running a separate app for each company on a different port and quickly realized I was creating myself a nightmare and would quickly run out of memory" scares me!  Did you check the memory usage using Task Manager?  I may have to redesign my app the way you are suggesting.

So how to host/run completely separate NTWS apps on the same box?

Thanks,
Sukhendu

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Multiple Hosting question
« Reply #9 on: October 31, 2012, 10:04:21 PM »
well I had 12 companies and 3 different web apps so that was going to be 36 apps running! In your case unless you think you are going to scale up significantly I would not worry about the memory. So the options you have is what has been suggested: multi-host, separate ip address's or 1 app that can handle multiple DB's.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Multiple Hosting question
« Reply #10 on: October 31, 2012, 10:20:17 PM »
Hi Sukhendu,

this is a good conversation because there are many solutions to the problem. Ultimately you need to pick the one that suits you best.

you really have 2 questions to answer here -
i) how does the user identify which company data they want
ii) what configuration will you use for hosting.

The two questions are distinct - so let's do the first one first.


a) you may have 1 domain (let's call it sukhendu.com) but that domain can have many subdomains. Adding subdomains is as easy as adding a dns record - which is very easy to do. In this situation company A becomes a.sukendu.com, company b uses b.sukhendu.com and you can still use www.sukhendu.com for your normal web site. Your program sets the data set to use (for that one request) based on which url they are using.

b) when logging in the user selects a company from a list (which you can "remember" in a cookie for them). You set a session value based on this choice, and the server uses this to pick the appropriate data files for each request.

c) Both companies share a common user list. When a user logs in you "know" which company they belong to based on values set in the user table. This is then stored in a session value, and the correct set of data files is set for each request

d) each company connects on a different port. Which in turn means multiple instances of the exe are running, and each exe is set to use a specific data set. This is the only option that requires multiple instances of the exe.

Now to the second question.

Since the program is the same for both companies - only the data varies - you don't need multi-host at all. You can run on server which serves both sets of users. Or you can run multiple instances of the server on different ports - that's your choice.

With regard to "how to set the correct data set" - I usually
i) create a function - call it say "setPathNames".

ii) call this function from the web handler - ProcessLink method, before parent call. Pass enough information to identify the data set required. (typically from a session value)

iii) in the function set the "full path name" for each table (if using TPS) or set the glo:owner variable (for SQL). Which ever variables you set, those variables must be THREADed.

cheers
Bruce



sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: Multiple Hosting question
« Reply #11 on: November 01, 2012, 01:45:27 PM »
Bruce,

Thank you for your clear explanations.  For my present case the best solution is the first option's items (a) plus (d).  I have implemented it and its working good.

Regards,
Sukhendu

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Multiple Hosting question
« Reply #12 on: November 01, 2012, 09:22:40 PM »
Hi Sukendu,

just to be clear - (a) and (d) are redundant.

If you are using (d) then you can use the same url, with a different port number, and it'll go to the correct exe.

If you are using a) then one exe could serve both companies.

Of course there's nothing wrong with doing both - if nothing else it's a bit of flexibility for later on.

cheers
Bruce