Deployment questions

I do my dev work inside of a VM on a Mac. I'd like to move the app and XData server to a Windows machine for testing. What's required to do that?

Can I copy the testing server? Or can I use any local server for the app?

What about the XData part? (I'm using Holger's framework, if that matters.)

They all just seem to work on the Dev side and I haven't had to give much thought to making them work in an environment without Delphi present.

Is this "deployment" stuff documented anywhere?

Also, is there any info on how to plan for deployment for a release? Any recommended practices?

How these kinds of projects are deployed can be vary quite a bit between whatever environments the developer is faced with. And there's nothing stipulating that a TMS WEB Core application has to be served up from the same system as a TMS XData application. Near the very end of this post, I gave a rundown of what I have been using for all my projects, which works particularly well for me but may be entirely unacceptable for someone else.

If you provide a bit more information about what you're trying to do, more specific advise is readily available. For example, what webserver(s) are you thinking about using, and on what kinds of servers (Linux or Windows most often) are you trying to deploy your project? Do you have unfettered access to them or are you using a shared VPS model where you might only have access to a "dashboard" like cPanel or something like that? What have you tried so far? That kind of thing.

It's really nothing special.

The audio coming through the VM to the host is choppy.

I need to run the XData server and the app on the same machine since I haven't got the server working remotely yet.

So I just want to run them both on the same Windows machine, not inside of a VM.

(I tried to set up my VM so I could run the app outside of it (in MacOS) to access the XData server inside, but that seems to be a bit convoluted with VirtualBox. I wasn't able to get it working and I'm not sure why.)

Option 1 - Use your VM.

Been a long time since I've used VirtualBox, but I'm sure it is possible to open a browser on the Mac host side and access both the TMS WEB Core project using the built-in development server and the XData project on whatever port it is on.

The trick though is that your Windows guest has to likely turn off or otherwise allow the Windows Firewall to pass those ports, and the TMS WEB Core application needs to access XData using whatever IP is used to access the application itself.

For example, maybe the internal IP address of your Windows Guest is When you launch your application from within Delphi in this environment, it will launch a browser that points at http://localhost:8000 or something like that. When it accesses XData, it will refer to it as something like http://localhost:2001 or something similar.

When you run a browser outside of this, in your Mac Host, you'll end up using a different IP address, possibly or something. So you'll have to replace "localhost" with whatever that is, both on the URL that you use to access the TMS WEB Core application running on the dev webserver, but also in the internal URL that you have in the TMS WEB Core app that refers to the XData server.

And both ports (8000 and 2001 in the example above) will have to be permitted to access your machine as well. I don't recall if there's anything in VirtualMin that you need to configure for this (NAT or something?) but you'll probably have to look there to get the external IP address for your virtual machine guest.

I do something similar, but with a Fedora host and Windows guest, using QEMU/KVM instead of VirtualBox, and it all works just lovely.

1 Like

Option 2 - Separate Windows Machine.

Roughly, these are the steps I think might be needed.

  1. Install a web server on the Windows machine, IIS or Apache is probably fine for testing. Figure out where the "document root" is for the web server of your choice.
  2. Copy the contents of the "release" or "debug" folders of your TMS WEB Core project into this document root folder on the Windows machine. Whichever one you want to use is fine.
  3. The Windows Firewall needs to be configured to allow access to the web server in this case, typically port 80. Might be there already, hard to say.

With that configured, you should be able to point a browser from your Mac at the IP of the Windows machine, and try something like or whatever the main HTML file for your project is. Don't proceed until you see your project. It won't "work" because XData is missing, but it should still load your project.

For XData, it has its own webserver built into it. So initially it is a little easier to setup.

  1. Create a folder for the project somewhere on the Windows machine.
  2. Use the TMS HTTP Config Tool to enable access to the port that you want to use. You'll probably have to copy this over from your development machine. You'll want to reserve port 2001 or whatever you're using for the XData server.
  3. You'll also have to configure the Windows Firewall to allow access to this port explicitly.
  4. The XData app should launch without any errors. If you get an error about the port or the IP, then check the above, or maybe pick a different port if the port you want to use is already in use.
  5. If you want to change the port, you'll also have to change it in your XData application as well, and then run the same TMS HTTP Config Tool for the new port.

Once the XData app starts without errors, you should be able to tell if its running by pointing your Mac browser at the same IP, but with the XData address. For example, and you should see something like value:{} or something similar. If you've changed tms/xdata to something else, this will also need to be updated to the new value in the TMS HTTP Config Tool.

Once that is working, the final bit is to put whatever address you used to test XData into the TMS WEB Core project so that it can find XData as well.

Things are more complicated once this is a public machine, as you'll want to enable SSL, change the ports, enable or disable Swagger if you're using/not using that in a production environment, and of course doing a little bit more testing.

1 Like

I loaded the client and server files up to my external Win server and have been able to get them to communicate, and the app starts up, using all of the same ports as the dev work does. When I click the Login button, part of the process is to load some stuff from another site which is done transparently through the XData service via a series of remoste requests. But, oddly enough, the first request gets back an empty JSON response. I'm looking at the headers between my app and XData server, and everything I can see in the browser's debug dashboard (BriskBard in this case) looks fine, and they even look 100% identical. My home internet connection's IP changes from day to day, so I can't lock anything to it. Nothing comes to mind as to why there's an issue. I guess I need some additional logging on the Server. :o

My XData service says the request is getting a 200 response code, but the time shows it's not getting any data (4.46 ms vs. 316.04 ms) and my service just stops running at that point -- I guess it got an exception or some error that caused it to bail out.

I'm going to try loading everything onto my Windows computer now and see if that makes a difference.

This is the strangest thing ... the code in my VM works properly, but after copying the same code to two other platforms and running it, it blows up in the same place on both attempting to access the same remote service. This is code that has been working for months, and still does inside of the VM.

How much do you know about the remote service? Sometimes there are rules... Like only one IP address can access it using the same API Key in a set period of time, or maybe an IP address has to be registered to access it, that sort of thing. Is there a way to access the remote service outside of your app from the same machines? Always a good place to start.

1 Like

I can't be IP-based because my ISP rotates my IP every day or so.

I was thinking I should make a little test app and see how it runs in each environment.

Is it not something you can just test with a browser on each system?

It's a particular API request that's failing. I just can't tell why. The site returns a 200 status code but an empty result. { "value" : ""; }

I this case, it's like asking for a list of provinces in Canada, and it replies with none. It's a very clear, quantifiable result set that's certainly not empty.

If my API Bearer token was wrong, or if the query was wrong, or if anything about it was wrong, the site would not return a 200 status code..