[SOLVED] Admin tool with 2 instances of Smartfox Server 2.16

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Myrilandel
Posts: 4
Joined: 20 May 2020, 10:54

[SOLVED] Admin tool with 2 instances of Smartfox Server 2.16

Postby Myrilandel » 07 Aug 2020, 08:45

Hello everyone,

Yesterday, I updated my SmartFox server from 2.14 to 2.16 and i thought it would be a good time to add a new instance of SmartFox server to separate Dev and alpha-tests.

After adding the second instance, i managed to connect to both of the servers with my game client using TCP and UDP but sadly i cannot deal with the admin tool. :(
If I start the Dev server first, i am able to connect to the Admin tool via the Dev server address' (and i see all the rooms/zones/infos about the dev server only) but i cannot connect to the alpha-tests address.
If I start the alpha-tests server first, i can connect with the Admin tool to the alpha-tests server but not on the Dev server.

After some researches i couldn't find a way to make it work and some help would be very very appreciated :mrgreen:
Here are some infos about my config, I didn't paste all the xml files but feel free to ask if you need more elements :

Host doublechecks :
- Firewall allows all ports listed in the next parts
- I encountered the same problem after disabling the Firewall
- SSL certificate is valid and was used to create a keystore .jks
- The keystore was placed at SFS2X/lib/apache-tomcat/conf of each instance of SmartFoxServer

SmartFox alpha-tests Server - AdminTool Login :
https://myrilandelgames.com:9443/admin/
host : myrilandelgames.com
port : 9443
encrypt : checked

SmartFox alpha-tests Server - server.xml :

Code: Select all

<socketAddresses>
    <socket address="0.0.0.0" port="9933" type="TCP"/>
    <socket address="0.0.0.0" port="9933" type="UDP"/>
</socketAddresses>

<remoteAdmin>
    <administrators>
      <adminUser>
        <login>****</login>
        <password>****</password>
        <allowHalt>true</allowHalt>
        <disabledModules/>
      </adminUser>
    </administrators>
    <allowedRemoteAddresses/>
    <adminTcpPort>-1</adminTcpPort>
    <useEncryption>true</useEncryption>
  </remoteAdmin>

<webServer>
    <isActive>true</isActive>
    <blueBoxPollingTimeout>26</blueBoxPollingTimeout>
    <blueBoxMsgQueueSize>40</blueBoxMsgQueueSize>
    <isXForwardedForActive>false</isXForwardedForActive>
    <allowedWebsocketOrigins/>
    <isWSActive>true</isWSActive>
    <gHttpPort>8083</gHttpPort>
    <gHttpsPort>9443</gHttpsPort>
  </webServer>


SmartFox alpha-tests Server - Tomcat server.xml :

Code: Select all

<Connector connectionTimeout="20000" port="8083" protocol="HTTP/1.1" redirectPort="9443"/>

<Connector SSLEnabled="true" clientAuth="false" keystoreFile="lib/apache-tomcat/conf/myrilandelgames-keystore.jks" keystorePass="****" maxThreads="200" port="9443" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" sslProtocol="TLS"/>


SmartFox alpha-tests Server - crossdomain.xml :

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
   <!-- This is a master-policy file. site-control can be all,none,master-only -->
   <site-control permitted-cross-domain-policies="all"/>

   <!-- Instead of setting to-ports="*", administrators can use ranges and commas -->
   <!-- This will allow access to ports 123, 456, 457, and 458 -->
   <allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>


__________________________

SmartFox Dev - AdminTool Login :
https://myrilandelgames.com:9442/admin/
host : myrilandelgames.com
port : 9442
encrypt : checked

SmartFox Dev Server - server.xml :

Code: Select all

<socketAddresses>
    <socket address="0.0.0.0" port="9932" type="TCP"/>
    <socket address="0.0.0.0" port="9932" type="UDP"/>
  </socketAddresses>

<remoteAdmin>
    <administrators>
      <adminUser>
        <login>****</login>
        <password>****</password>
        <allowHalt>true</allowHalt>
        <disabledModules/>
      </adminUser>
    </administrators>
    <allowedRemoteAddresses/>
    <adminTcpPort>-1</adminTcpPort>
    <useEncryption>true</useEncryption>
  </remoteAdmin>

<webServer>
    <isActive>true</isActive>
    <blueBoxPollingTimeout>26</blueBoxPollingTimeout>
    <blueBoxMsgQueueSize>40</blueBoxMsgQueueSize>
    <isXForwardedForActive>false</isXForwardedForActive>
    <allowedWebsocketOrigins/>
    <isWSActive>true</isWSActive>
    <gHttpPort>8082</gHttpPort>
    <gHttpsPort>9442</gHttpsPort>
  </webServer>


SmartFox Dev Server - Tomcat server.xml :

Code: Select all

<Connector connectionTimeout="20000" port="8082" protocol="HTTP/1.1" redirectPort="9442"/>

<Connector SSLEnabled="true" clientAuth="false" keystoreFile="lib/apache-tomcat/conf/myrilandelgames-keystore.jks" keystorePass="****" maxThreads="200" port="9442" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" sslProtocol="TLS"/>


SmartFox Dev Server - crossdomain.xml :

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
   <!-- This is a master-policy file. site-control can be all,none,master-only -->
   <site-control permitted-cross-domain-policies="all"/>

   <!-- Instead of setting to-ports="*", administrators can use ranges and commas -->
   <!-- This will allow access to ports 123, 456, 457, and 458 -->
   <allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>


Thank you very much in advance for your help,
Cheers :D !

Myrilandel
Last edited by Myrilandel on 07 Aug 2020, 15:10, edited 1 time in total.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin tool with 2 instances of Smartfox Server 2.16

Postby Lapo » 07 Aug 2020, 13:13

Hi,
you didn't specify clearly, but I suppose we're talking about two instances on the same machine? Right?

Have you checked the logs of the 2nd instance? It's likely that you'll find some Tomcat binding error.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Myrilandel
Posts: 4
Joined: 20 May 2020, 10:54

Re: Admin tool with 2 instances of Smartfox Server 2.16

Postby Myrilandel » 07 Aug 2020, 14:15

Hi Lapo,
Thank you very much for your answer,

Yes, I am running two instances on the same machine,

I have checked the logs again but I could not see anything related to Tomcat, so I think I am not looking at the right files.

I checked in the directory SFS2X/logs/ in the smartfox.log file (in both instances) were I can see :

Code: Select all

07 Aug 2020 | 15:55:25,713 | INFO  | main | v2.core.AdminToolService |     | AdminTool Service started
07 Aug 2020 | 15:55:31,306 | INFO  | TomcatRunner | tomcat.bluebox.BBSessionFilter |     | BlueBox Service (4.0.1) READY.


I also check the files in the boot and http directory but could not see anything related to Tomcat.
Finally i checked the directory SFS2X/lib/apache-tomcat/logs but there were no files inside.

Is there any other folders/files where I can take a look ? Or do I have to modify the log4j properties maybe ?
I also ran a netstat command and I effectively see only one port listening.

Thanks in advance for your answers,
Cheers !
Myrilandel
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Admin tool with 2 instances of Smartfox Server 2.16

Postby Lapo » 07 Aug 2020, 14:27

Hi,
If I attempt to run two instances of SFS2X 2.16 on the same machine, after having reconfigured ports 8080 and 8443 so that they don't collide, I still get a port conflict on port 8005.

The error can be seen if you run the second instance in the terminal (via sfs2x.sh) or directly in Tomcat's log files regardless of the modality of launch.
The log file to look for is SFS2X/logs/http/catalina*.log

The error message should loo like this:

Code: Select all

07-Aug-2020 15:13:17.332 GRAVE [TomcatRunner] org.apache.catalina.core.StandardServer.await Failed to create server shutdown socket on address [localhost] and port [8005] (base port [8005] and offset [0])

Why is there a conflict on port 8005 and what is this port used for?
Port 8005 is not publicly exposed by Tomcat, and it only works on the localhost but it is required. So if you're running two instances on the same machine you will need to also set a different number for the 2nd instance.

For more details on port 8005 and its uses, see here:
https://stackoverflow.com/questions/335 ... -in-tomcat

This should solve the problem :)
Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Myrilandel
Posts: 4
Joined: 20 May 2020, 10:54

Re: Admin tool with 2 instances of Smartfox Server 2.16

Postby Myrilandel » 07 Aug 2020, 15:08

Yay ! That worked !

Regarding the Catalina log file under SFS2X/logs/http/ it could not see it because I was launching the server using ./sfs2x-service start and the file does not appear. But if i start the server using ./sfs2x.sh, the Catalina log file is created and you were right : there is a conflict with the port 8005. I changed it in one instance of Smartfox and boom the magic happens !

Thank you very much for your help and all these informations, I guess I'll take some more time to study Tomcat :D

Cheers !
Myrilandel

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 72 guests