Author Topic: Running drServer as windows service  (Read 26433 times)

2015-04-20, 22:16:44

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
Edit:

Official solution for running Distributed Render and Licensing servers as Windows services using this method is here:
https://coronarenderer.freshdesk.com/support/solutions/articles/12000007896

-----

Original post:

A short guide how to run drServer as windows service, I can´t live without it. Use it at your own risk, it´s not officially supported and I´m not part of the developer team. Here we go:


INSTALLATION

  • No max or drServer instance should be running on the node before proceeding
  • Install drServer as usual with the help of the standard installer if not yet done
  • Get the "Non-Sucking Service Manager" here: http://www.nssm.cc/
  • Extract and copy the appropriate executable (win32/win64) of nssm.exe to your windows directory
  • Run a shell as administrator: Navigate to windows\system32, find "cmd.exe", right-click and select "Run as administrator"
  • Type "nssm install CoronaDrServer" into the shell and press return
  • The "NSSM serivce installer" window pops up.
  • In the "Application" tab click the button following the "Path" input field
  • Navigate to "Program Files\Corona\Corona Renderer for 3ds Max\DR Server" and select "DrServer.exe"
  • Press "Install service"
  • A window saying "Service 'CoronaDrServer' installed successfully!" should pop up, press "Ok"

drServer is now installed as a service on the node, using the local system account as the "user". This was the easy part. Now the license has to be activated - even if you have already done that on the node because it´s a per user license and the service is running as another user (system).

RUNNING

As every other service: right click on the "Computer" icon on the desktop -> "Manage" -> "Services and Applications" -> "Services". There should be the entry "CoronaDrServer" now. It is configured to start automatically by default (at boot time). Doubleclick on the entry and press "Start". The service is now running.

ACTIVATION

Option A (recommended):
Use the Corona license server on a node somewhere in your network. As a result the node will activate its license automatically when a render job starts. The LicensingServer.exe can also be run as a service by the way, similar to drServer.

Option B:
Activate as described here: https://coronarenderer.freshdesk.com/support/solutions/articles/5000564325-activating-license with the important exception that you have to navigate to "\windows\system32\config\systemprofile\AppData\Local\CoronaRenderer" instead. This is the %LOCALAPPDATA%/CoronaRenderer/" directory of the local system account. Remember that you have to start a rendering via dr on the node with the service running before following those instructions, there has to be a "request.txt" or "request-3dsmax.txt" file in that directory which is generated at the first use.


DEINSTALLATION
  • Run a shell as administrator: Navigate to windows\system32, find "cmd.exe", right-click and select "Run as administrator"
  • Type "nssm remove CoronaDrServer"
  • Confirm removal


If you have any issues concerning distributed rendering using this setup: please remove or stop the service, run drServer.exe conventionally and try again before reporting anything that goes wrong to assure this setup is not the cause (I do that every time but until now there were no problems related to this).


Maybe there will be a supported way to run drServer as service in the future, but this setup works fine for me in the meantime.

Good Luck!


P.S.: Remember to always use UNC paths for your assets and that network shares used for assets have at least read access for "everyone".


Edit: Removed note about errors of older license server - obsolete now
Edit: Adjusted paths for newer versions at 9.)
Edit: Adjusted paths for v5 build 19-09-30 and later at 9.)
« Last Edit: 2019-10-11, 08:31:32 by Frood »
Never underestimate the power of a well placed level one spell.

2016-01-01, 15:22:58
Reply #1

FrostKiwi

  • Active Users
  • **
  • Posts: 686
    • View Profile
    • YouTube
Ohh lovely!
Let's bump it and sticky it till corona 1.5 with Dr improvements rolls around.
I'm 🐥 not 🥝, pls don't eat me ( ;  ;   )

2016-01-05, 17:41:53
Reply #2

FrostKiwi

  • Active Users
  • **
  • Posts: 686
    • View Profile
    • YouTube
No registration is needed, if you already registered it.
Run services.msc, find CoronaDr server,right click, properties, user, change from system to user, type username and password.

It will run DrServer as your user and not system and will thus use the licence of that machine from user/appData/local/corona

DrServer and 3dsMax when started as a node, will not have any GUI, when windows starts no corona GUI. All hidden, all awesome.
I'm 🐥 not 🥝, pls don't eat me ( ;  ;   )

2016-01-11, 10:30:40
Reply #3

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
No registration is needed, if you already registered it.
Run services.msc, find CoronaDr server,right click, properties, user, change from system to user, type username and password.

I´m aware of that, my initial post was aiming for a simple slave setup where not even a user account has to be configured/worried about - and I didn´t wanted to write even more confusing stuff. Using the license server is peachy anyway (is there any reason to NOT use it?)

Maybe I will add some "advanced users" part :)

Good Luck!


« Last Edit: 2016-01-11, 10:35:07 by Frood »
Never underestimate the power of a well placed level one spell.

2016-01-15, 12:25:17
Reply #4

Dippndots

  • Active Users
  • **
  • Posts: 296
  • Alex Fagan Co-Founder at The Faction
    • View Profile
    • The Faction
This didn't work for us unfortunately, the slave couldn't fine any of the xref files
Code: [Select]
===== Error(38) =====
Slave '10.0.7.51' reported error:
There are missing XRef files:
\\SERVER\Work\1593-Bourneville()\Phase I - Nov 15\Models\02 X-ref\building exterior\Buildingexterior.max
\\SERVER\Work\1593-Bourneville()\Phase I - Nov 15\Models\02 X-ref\building interior\Floor_0.max
\\SERVER\Work\1593-Bourneville()\Phase I - Nov 15\Models\02 X-ref\building interior\Floor_Extras.max
\\SERVER\Work\1593-Bourneville()\Phase I - Nov 15\Models\02 X-ref\landscape\Hardlandscape.max
\\SERVER\Work\1593-Bourneville()\Phase I - Nov 15\Models\02 X-ref\landscape\Softlandscape.max
The image may come out wrong (e.g. darker or missing objects) because of this.

===== Error(38) =====
Slave '10.0.7.51' reported error:
Required asset file(s) could not be located:
\\SERVER\Shed\Models\Lights\Lighting_IES\evermotion IES\ies\23.ies
\\SERVER\Shed\Post\HDRI\Peter Guthrie hdri\1123_sun_clouds\1123_sunclouds.hdr

The image may come out wrong (e.g. darker or missing objects) because of this.


2016-01-15, 13:01:21
Reply #5

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
Interesting.
  • Did you used user "local system" to run the service? And if so, could you test changing the user of the service to some account you used to date?
  • You aren´t on win7, are you?
  • Does the share "Work" has read acces for "everyone" configured?
  • Is "SERVER" actually a windows server or a workstations named as such?
  • If it´s a server, are the nodes part of a (network-) domain?

Never underestimate the power of a well placed level one spell.

2016-01-15, 13:11:09
Reply #6

Dippndots

  • Active Users
  • **
  • Posts: 296
  • Alex Fagan Co-Founder at The Faction
    • View Profile
    • The Faction
1. Yes, we tried changing the user account, but it won't recognize it. This is probably the problem... I'll try to dedicate some more time to it this afternoon.
2. Server 2012 R2
3. It is
4. Yeah I just changed the name to SERVER
5. They are all part of a domain, trying user@domain.com in step 1 didn't work either.

2016-01-15, 14:38:11
Reply #7

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
1. Just use the same what you would type at the login screen (the domain name is implied at a interactive login when the computer is part of a domain). If you want to authenticate locally just type the username. If it is not recognized then the user doesn´t exist on the workstation and logins are authenticated against your domain controller (=server). If you want to use credentials of the the domain server (presuming all accounts are managed by your Domain Controller=server) then use "domain\username" (domain and user separated by a backslash, yes!) when changing the user in the service properties.

2. Ok the server is a server then :) But on what OS is the CoronaDrServer service running? Are you testing on the server itself? Or are you using a server OS on a workstation (some do)?

3. Ok, needed

4. Ok, this is your Server 2012 R2 with all the shares. And it has a ugly name so that you don´t want to expose it 8-)

5. What´s the output of "echo %usserdomain%" when used in a shell started by the user you would like to run the service with? That would be the first part you would have to enter at 1.


Good Luck!

« Last Edit: 2016-01-15, 14:42:59 by Frood »
Never underestimate the power of a well placed level one spell.

2016-01-15, 16:14:43
Reply #8

Dippndots

  • Active Users
  • **
  • Posts: 296
  • Alex Fagan Co-Founder at The Faction
    • View Profile
    • The Faction
Cool, domain\username on #1 solved it. Thanks a bunch!

2016-01-15, 16:59:02
Reply #9

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
Welcome, glad to see that it´s working for you now,

Good Luck!

Never underestimate the power of a well placed level one spell.

2016-05-25, 14:22:00
Reply #10

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12711
  • Marcin
    • View Profile
Official solution for running Distributed Render and Licensing servers as Windows services is here:
https://coronarenderer.freshdesk.com/support/solutions/articles/12000007896
All who need it, check it out!
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2016-05-25, 15:38:42
Reply #11

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
May I suggest some improvements?


1. Installation/scripts

Why don´t you copy nssm.exe over to the %CORONA_PATH% and use it there? Less confusion, more error proof, no extra directory.

Here is the quickly modified DrServer install script. Added elevation check and path check, nssm is copied to corona directory and used from there. This way the complete batch directory can be even deleted after installation/setup:

Code: [Select]
@echo off
set CORONA_PATH="%ProgramFiles(x86)%\Corona"

rem #check for prompt elevation
net session >NUL 2>&1
if not %errorLevel% == 0 (
echo !: Console not elevated, please run as Administrator.
goto quit
)

rem #check for path existence
if not exist %CORONA_PATH% (
echo !: Path '%CORONA_PATH%' does not exist.
goto quit
)

rem #copy nssm to target directory:
copy nssm.exe %CORONA_PATH%

echo Installing Corona DR Server service
%CORONA_PATH%\nssm install "Corona DR Server" %CORONA_PATH%\DrServer\DrServer.exe --noGui
echo Starting Corona DR Server service
nssm start "Corona DR Server"

:quit
echo.


Same for Licensing server service installation.


2. Support article

Quote
network drive mapping is not supported in service mode! The recommended solution is to use UNC paths instead.

You could add a paragraph how to change the service user after installation, this way there should be no problem using mapped drives (drive mappings are part of the user registry, so even the service has them when running as a user who had drives mapped and logged off previously)


Good Luck!


« Last Edit: 2016-06-03, 10:09:28 by Frood »
Never underestimate the power of a well placed level one spell.

2016-06-03, 09:27:01
Reply #12

Ryuu

  • Former Corona Team Member
  • Active Users
  • **
  • Posts: 654
  • Michal
    • View Profile
Thanks for the tips. I definitely agree with the elevation detection & copying of the nssm executable.

I'm not entirely sure about the network drive mapping. I've read somewhere that this mapping does not work for services at all, but I have zero experience with this, so we'll try to make it work when we have time.

2016-06-03, 10:07:32
Reply #13

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
Nevermind, don´t waste your time with this. I did some research and it requires some additional measures, not feasible enough all in all.

Good Luck!

« Last Edit: 2016-06-03, 10:12:10 by Frood »
Never underestimate the power of a well placed level one spell.

2018-01-26, 17:09:13
Reply #14

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
Adding a script to restart DrServers on farm nodes for people running them as service and face those current issues where they have to be restarted to be functional again.

Basically this can be easily done by invoking sc.exe with stop and start commands against all nodes. That's what the script does, but in a convenient way for mass-restarting. It uses the "framework" of my farm update script.

  • You need admin rights on the target node (same credentials as on the workstation where you invoke the script). A "sc \\slave-01 query" has to work.
  • Put the names of all your slaves into "nodes_to_restart.txt"
  • Check if the service name in the script is correct for your rig (I have set it to "Corona DR Server" which is the "official" service name, see "Customize this" section)
  • Run "Restart_DR_Servers.cmd" in an elevated console
  • Alternatively you can call it like "Restart_DR_Servers slave-01 slave-02 slave-99" in the console, providing node names in the command line (the text file with node names is ignored in this case)

Good Luck

Edit: Fixed "The syntax of the command is incorrect." due to unset variable.

« Last Edit: 2018-02-12, 19:37:54 by Frood »
Never underestimate the power of a well placed level one spell.

2018-12-12, 14:43:11
Reply #15

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 12711
  • Marcin
    • View Profile
Our guide is updated for Corona Renderer 3:
https://coronarenderer.freshdesk.com/support/solutions/articles/12000007896

Please report any remaining issues to us.
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us

2019-10-11, 08:50:39
Reply #16

Frood

  • Active Users
  • **
  • Posts: 1903
    • View Profile
    • Rakete GmbH
As of Corona v5 DB 19-09-30 paths have changed again. You do not need to reinstall the service(s), the path adjustment can be done (also remotely) with the registry editor at location

Code: [Select]
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Corona Dr Server\Parameters
New Values:

Code: [Select]
"AppDirectory": "C:\Program Files\Corona\Corona Renderer for 3ds Max\Dr Server"
"Application": "C:\Program Files\Corona\Corona Renderer for 3ds Max\Dr Server\DrServer.exe"

(Same applies to the Corona Licensing Server service)

Imho this should be done by the installer btw. (detect the installed service, official name "Corona Dr Server" and adjust the paths in the registry).

Edit: And don't forget to adjust firewall settings as I just did :)


Good Luck



« Last Edit: 2019-10-11, 09:57:25 by Frood »
Never underestimate the power of a well placed level one spell.