commandBox as a service...

Hey all,
followed the screen cast on how to set up my commandbox site as a service…
i created the server like i normally would via commandbox. then i stopped it.
used the NSSM to give me a gui so i could set up my path to the commandbox.ext, and set up — server start serverConfigFile=c:\path to my file\server.json --console
that builds my service for me…i see it in the services console.

i now start my service, and it says it has started…when i do a server info, i get nothing

any thoughts on how to set up commandbox as a service…is it still the same as when the blog post/video was pusted…

thanks
Dan

when i do a server info, i get nothing

Can you clarify what you mean by “do server info” and what you mean by “get nothing”?

The instructions in the screencast should work fine still. I’m guessing you ran “server info” from the wrong directory but I really am just guessing

I had that problem at first until it occurred to me that the service was running under a different account and therefore had it’s own CommandBox info an server info seperate from the account I was logged in with. For example, if you’re running the service with the LocalSystem account you’ll see a .CommandBox folder at C:\Windows\System32\config\systemprofile.

I will attest that the directions in the video are correct. I have a few CommandBox services running.

Dan

Ahh yes, good call Dan. I always forget about that since I have a hardcoded CommandBox home on my PC for testing. Your server is likely under the system account home. The easy fix is to set up CommandBox to use a shared home for all users:

https://commandbox.ortusbooks.com/setup/installation

hey guys,
thanks for that information…
so i followed this line in the installation instructions:
To avoid specifying the commandbox_home variable every time you can create a file called commandbox.properties (case sensitive) in the same directory as the binary (box.exe)

i downloaded commandbox 4.2 to my downloads folder on windows 10. then i added the commandbox.properties file and put in it the path to my commandbox c:\commandbox.
then in installed commandbox, cfconfig and bullet train.
then i created a server in commandbox which spun up just fine. then shut it down.

in cmd window did a nssm install serviceName

in the gui i put the path to my box.exe c:\users\userName\commandbox4.2\box.exe
startup direcotry: c:\users\username\commandbox4.2
arguments: Server start serverConfigFile=C:\inetpub\wwwroot\codeFolder\wwwroot\server.json --console

when i did install server, the service was created. I then just stated the service, which i thought would spin up my commandbox instance that nssm associated to the service. And it did. WOOT!!!

Thought to help others out that might have this same issue, i’d put in this reply what steps I followed to solve my problem and get my site running as a service.

thanks guys for your help and hope this helps others…
dan

Thanks for the full steps Dan. To confirm though, your server should have worked initially (as in, started up and ran) but you just couldn’t see any information about it from your user’s CommandBox installation, right?

My original understanding was that your server was up and running but you just couldn’t get the information on it from your logic, but your instructions above make it sound like it wouldn’t run at all until you combined the user homes.

Hey all you commandbox users,
here is a follow up to the service question above which i got working.

So we have to connect to a sql server database that we want to connect to via windows creds. So, we put the database into windows credential manager with its username and password, so the database can be referenced as a service.

so in my commandbox server i have set up as a service, i logged into cf admin, and added a dsn, with just the database name (no username or password). This should then see the db name and go to credential manager to find the login info. i am doing this on a vm with a standalone acf 11.

when i do this in my commandbox server set as a service, the dsn fails because there is not a username, so it is not going out to windows and seeing the database name…

wondering if anyone has done this with commandbox as a service and got it working…questions just ask…

thanks all
dan

I’m not familiar with windows credentials manager, but does this same set up work on a “standard” CF install/service? I would think they would both work the same. What user is the service running as? And to confirm, are you wanting CF to use the user that the service is running as or another user entirely?

if you go into control panel and users, you will see manage windows credentials. we add in there our database connection. it will then act like a windows account…or the request execution path will check in here when the site is trying to connect to a datasource, it sees the database info and uses that to connect to it…we then don’t have to add in a username and password in the datasource.
I might not be describing this well at all, and it might not be something anyone else has worked with, and if you have not, don’t worry about trying to figure it out…
i know eventually we’ll get some local postgres db to connect to…

If anyone has set up anything in credential manager, let me know if any of this sounds familiar.

Hey all,
maybe this is a better question…when we install commandBox onto a local windows 10 machine, does ACF then run like it is install locally, or is there something in commandbox that separates ACF from my local windows?
trying to figure out the request execution path of ACF in commandbox and how it might interact with my local windows 10.
dan

I really don’t think there’s much of a difference from a process perspective. It’s a java.exe process that’s started by a service. From the operating system’s perspective I don’t really think it knows or cares what that java.exe is doing. I don’t have any clue how you’re using this credentials manager to get datasource passwords or how that works on a “normal” CF install so I’m afraid I can’t help much. I’d have to understand how it works in the first place on a regular install.

From what I see online, the Java code itself would actually have to actively to retrieve usernames/passwords from this credentials manager and I don’t see any mention of this being an inbuilt feature of ColdFusion. Are you positive this works like you’re describing on a normal CF install? How would CF even know what user/pass to go get from the Windows credential manager? This just makes zero sense to me. Can you provide us with a documentation link that details this functionality in ColdFusion that goes and gets passwords from a Windows credentials manager when it connects to your database if you leave username/pass blank. I’m a little familiar with running your CF service under a domain account and authentication with that, but that’s not at all what you’ve been describing here so I’m just a little lost.

I’m wondering if the Credential Manager is a “red herring”. Is your SQL Server running under Windows Authentication mode or SQL authentication mode? If it’s the first, is it using the credentials of the account under which the CF server is running? Would that allow the CF server’s connection to the SQL server to work even if the passwords weren’t in the CF server itself? If I totally don’t understand the situation, ignore this.

Dan

I’m on the same page as you, Dan. That’s what I assumed the question was about, but the credentials manager bit has thrown me for a loop.

Hey,
I totally got behind on this and was working on other parts of the setup.
our mssql server is on a remote server, so we have to set up the vpn creds to get to it. To do this we use the windows credential manager to set those db creds up as windows creds…if you go in control panel, and user accounts and manager windows credentials, this is the credential manager. We create our database name here, and add in our connection username and password in here.
So, when i go into sql studio manager to connect to a database, i can use window auth to get in.
For a standalone CF server, i can add a datasource, but where you’d put in a username and password, i don’t have to, and CF knows to go out and look at any windows creds to see if the database name is set up there. This works just fine on a stand alone Cf server.
if I try to do this with a commandbox running server, it will not connect.
NOTE: if i set up a vagrant configured VM, running windows, i have to set up the credential manager for the databases in that vm to get the vm CF server to work.
I wonder if the way commandBox is running in a small VM (if i remember correctly) could be why i can’t get the connections…I bet it is a linix vm, this could be why it not working…

hope this gives more info for you guys…maybe have figured it out the problem as i wrote this out, just not sure the solution…

Dan