Problem with acessing admin panel when running 2 smartfox instances on the same server

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

Moderators: Lapo, Bax

ssokol
Posts: 6
Joined: 13 Jan 2022, 12:16

Problem with acessing admin panel when running 2 smartfox instances on the same server

Postby ssokol » 11 Apr 2022, 10:46

Hi.
I'm trying to run 2 smartfox instances on single EC2 instance

I've fallowed instructions from fallowing article:

https://smartfoxserver.com/blog/running ... e-machine/

I've set the first instance to ports 9934 and 8081 and all works fine. I can login to admin panel using port 8081

I've installed a second instance, but can't login to admin panel using port 8080. The error I get is
Unable to connect to <proper server ip>:8080
The server is up and running since the unity game can connect to server using the default port 9933.

The server.xml for the 8080 instance looks like this:

Code: Select all

<serverSettings>
  <socketAddresses>
    <socket address="0.0.0.0" port="9933" type="TCP"/>
    <socket address="0.0.0.0" port="9933" type="UDP"/>
  </socketAddresses>
  <ipFilter>
    <addressBlackList>
      <string>1.2.3.4</string>
    </addressBlackList>
    <addressWhiteList>
      <string>127.0.0.1</string>
    </addressWhiteList>
    <maxConnectionsPerAddress>9999999</maxConnectionsPerAddress>
  </ipFilter>
  <flashCrossdomainPolicy>
    <useMasterSocketPolicy>true</useMasterSocketPolicy>
    <policyXmlFile>crossdomain.xml</policyXmlFile>
  </flashCrossdomainPolicy>
  <systemControllerRequestQueueSize>20000</systemControllerRequestQueueSize>
  <extensionControllerRequestQueueSize>20000</extensionControllerRequestQueueSize>
  <schedulerThreadPoolSize>4</schedulerThreadPoolSize>
  <protocolCompressionThreshold>1024</protocolCompressionThreshold>
  <protocolMode>BINARY</protocolMode>
  <useBinaryProtocol>true</useBinaryProtocol>
  <remoteAdmin>
    <administrators>
      <adminUser>
        <login>sfsadmin</login>
        <password>sfsadmin</password>
        <allowHalt>true</allowHalt>
        <disabledModules/>
      </adminUser>
    </administrators>
    <allowedRemoteAddresses/>
    <adminTcpPort>8080</adminTcpPort>
    <useEncryption>false</useEncryption>
  </remoteAdmin>
  <bannedUserManager>
    <isAutoRemove>true</isAutoRemove>
    <isPersistent>true</isPersistent>
    <customPersistenceClass></customPersistenceClass>
  </bannedUserManager>
  <mailer>
    <isActive>false</isActive>
    <mailHost>your.smtp.here</mailHost>
    <mailUser>username</mailUser>
    <mailPass>password</mailPass>
    <smtpPort>25</smtpPort>
    <useSSL>true</useSSL>
    <workerThreads>1</workerThreads>
  </mailer>
  <webServer>
    <isActive>true</isActive>
    <blueBoxPollingTimeout>26</blueBoxPollingTimeout>
    <blueBoxMsgQueueSize>40</blueBoxMsgQueueSize>
    <isXForwardedForActive>false</isXForwardedForActive>
    <allowedWebsocketOrigins/>
    <isWSActive>true</isWSActive>
    <gHttpPort>8080</gHttpPort>
    <gHttpsPort>8440</gHttpsPort>
  </webServer>
  <startExtensionFileMonitor>true</startExtensionFileMonitor>
  <useDebugMode>true</useDebugMode>
  <extensionRemoteDebug>true</extensionRemoteDebug>
  <useFriendlyExceptions>true</useFriendlyExceptions>
  <sessionMaxIdleTime>30</sessionMaxIdleTime>
  <userMaxIdleTime>300</userMaxIdleTime>
  <licenseCode></licenseCode>
  <licenseEmails></licenseEmails>
  <maxCcuAlert>false</maxCcuAlert>
  <ghostHunterEnabled>true</ghostHunterEnabled>
  <statsExtraLoggingEnabled>true</statsExtraLoggingEnabled>
  <enableSmasherController>true</enableSmasherController>
  <analytics>
    <isActive>false</isActive>
    <runOnDay>[everyday]</runOnDay>
    <runAtHour>2</runAtHour>
    <runOnStartup>false</runOnStartup>
    <rebuildDB>false</rebuildDB>
    <skipGeolocation>false</skipGeolocation>
    <sourceFolder></sourceFolder>
    <locale></locale>
  </analytics>
  <systemThreadPoolSettings>
    <name>Sys</name>
    <coreThreads>4</coreThreads>
    <backupThreads>16</backupThreads>
    <maxBackups>64</maxBackups>
    <queueSizeTriggeringBackup>100</queueSizeTriggeringBackup>
    <secondsTriggeringBackup>50</secondsTriggeringBackup>
    <backupThreadsExpiry>3600</backupThreadsExpiry>
    <queueSizeTriggeringBackupExpiry>60</queueSizeTriggeringBackupExpiry>
    <logActivity>true</logActivity>
    <queueFullWarningInterval>300</queueFullWarningInterval>
    <prestartAllCoreThreads>false</prestartAllCoreThreads>
  </systemThreadPoolSettings>
  <extensionThreadPoolSettings>
    <name>Ext</name>
    <coreThreads>4</coreThreads>
    <backupThreads>16</backupThreads>
    <maxBackups>64</maxBackups>
    <queueSizeTriggeringBackup>100</queueSizeTriggeringBackup>
    <secondsTriggeringBackup>50</secondsTriggeringBackup>
    <backupThreadsExpiry>3600</backupThreadsExpiry>
    <queueSizeTriggeringBackupExpiry>60</queueSizeTriggeringBackupExpiry>
    <logActivity>true</logActivity>
    <queueFullWarningInterval>300</queueFullWarningInterval>
    <prestartAllCoreThreads>false</prestartAllCoreThreads>
  </extensionThreadPoolSettings>
  <serverName></serverName>
  <allowClientUdpPortChanges>false</allowClientUdpPortChanges>
  <clientBlueBoxSettings>
    <useBlueBox>true</useBlueBox>
    <blueBoxPollingRate>700</blueBoxPollingRate>
  </clientBlueBoxSettings>
</serverSettings>


The startup logs are as fallows:

Code: Select all

11 Apr 2022 | 10:24:47,130 | INFO  | main | smartfoxserver.v2.SmartFoxServer |     | Boot sequence starts...
11 Apr 2022 | 10:24:47,835 | INFO  | main | v2.core.SFSEventManager |     | SFSEventManager initialized
11 Apr 2022 | 10:24:47,894 | INFO  | main | vfs.impl.DefaultFileReplicator |     | Using "/tmp/vfs_cache" as temporary files store.
11 Apr 2022 | 10:24:47,997 | INFO  | main | smartfoxserver.v2.SmartFoxServer |     | License loaded:

==========================================
LICENSE DETAILS
------------------------------------------
Type            : Community Edition
Max users       : 100
==========================================

11 Apr 2022 | 10:24:47,998 | INFO  | main | entities.managers.SFSBannedUserStorage |     | BanUserStorage initialized
11 Apr 2022 | 10:24:48,027 | INFO  | main | entities.managers.SFSBannedUserManager |     | BanUser data loaded: 0 records.
11 Apr 2022 | 10:24:48,033 | INFO  | main | smartfoxserver.v2.SmartFoxServer |     | Protocol Type is: BINARY
11 Apr 2022 | 10:24:48,047 | INFO  | main | v2.config.DefaultConfigLoader |     | Loading: zones/BasicExamples.zone.xml
11 Apr 2022 | 10:24:48,139 | INFO  | main | entities.managers.SFSZoneManager |     |

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 >> Zone: BasicExamples
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

11 Apr 2022 | 10:24:48,173 | INFO  | main | entities.managers.SFSRoomManager |     | Room created: { Zone: BasicExamples }, [ Room: The Lobby, Id: 0, Group: default, isGame: false ], type = SFSRoom
11 Apr 2022 | 10:24:48,182 | INFO  | main | entities.managers.SFSRoomManager |     | Room created: { Zone: --=={{{ AdminZone }}}==-- }, [ Room: AdminRoom, Id: 1, Group: default, isGame: false ], type = SFSRoom
11 Apr 2022 | 10:24:48,285 | INFO  | main | v2.core.AdminToolService |     | AdminTool Service started
11 Apr 2022 | 10:24:48,452 | INFO  | SFSWorker:Sys:1 | smartfoxserver.v2.SmartFoxServer |     | Listening Sockets: { 0.0.0.0:9933, (Tcp) } { 0.0.0.0:9933, (Udp) }
11 Apr 2022 | 10:24:48,455 | INFO  | SFSWorker:Sys:1 | smartfoxserver.v2.SmartFoxServer |     | 
 _____ _____ _____    ___ __ __
|   __|   __|   __|  |_  |  |  |
|__   |   __|__   |  |  _|-   -|
|_____|__|  |_____|  |___|__|__|                                         
 _____ _____ _____ ____  __ __
| __  |   __|  _  |    \|  |  |
|    -|   __|     |  |  |_   _|
|__|__|_____|__|__|____/  |_| 
[ 2.18.0 ]

11 Apr 2022 | 10:24:48,455 | INFO  | SFSWorker:Sys:1 | smartfoxserver.v2.SmartFoxServer |     | SmartFoxServer 2X (2.18.0) READY!
11 Apr 2022 | 10:24:54,509 | INFO  | TomcatRunner | tomcat.bluebox.BBSessionFilter |     | BlueBox Service (4.0.2) READY.

User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Problem with acessing admin panel when running 2 smartfox instances on the same server

Postby Lapo » 11 Apr 2022, 14:29

Hi,
you're using a recent version of SFS2X but you're referring to and old article that was written when the embedded web server was Jetty.
Since version 2.14 it is no longer the case and we embed Tomcat, instead. There's also a "Tomcat edition" of the same article, here:
https://smartfoxserver.com/blog/running ... t-edition/

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
ssokol
Posts: 6
Joined: 13 Jan 2022, 12:16

Re: Problem with acessing admin panel when running 2 smartfox instances on the same server

Postby ssokol » 12 Apr 2022, 08:11

Hmm this is interesting. According to the document you've sent there shoulld be a server.xml file in SFS2X/lib/apache-tomcat/lib. There is none.

Additionaly I acctualy managed to redirect the first server to ports 9934 and 8081 using the old article for one of the servers. The problem is with the second instalation which should work by default after installing. For some reason the administration panel does not work.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Problem with acessing admin panel when running 2 smartfox instances on the same server

Postby Lapo » 12 Apr 2022, 14:34

ssokol wrote:Hmm this is interesting. According to the document you've sent there shoulld be a server.xml file in SFS2X/lib/apache-tomcat/lib. There is none.

It looks like an error unfortunately. The correct location is SFS2X/lib/apache-tomcat/lib. We have corrected the article.

Additionaly I acctualy managed to redirect the first server to ports 9934 and 8081 using the old article for one of the servers. The problem is with the second instalation which should work by default after installing. For some reason the administration panel does not work.

If the first instance is correctly running on ports 9934/8081 and the second is using the defaults there should be no problem, provided you don't run a firewall. If you do please double check that the bidirectional traffic is allowed for all those ports.

If you still have problems with the second server, check which ports are actually listening using netstat. See here: https://docs.rackspace.com/support/how- ... h-netstat/

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
ssokol
Posts: 6
Joined: 13 Jan 2022, 12:16

Re: Problem with acessing admin panel when running 2 smartfox instances on the same server

Postby ssokol » 15 Apr 2022, 13:20

It looks like I can connect to any admin panel that was started first:
If I start the 8081 server first I can access admin panel for that server but can't access admin panel on port 8080.
If I start the 8080 server first I can access admin panel for that server but can't access admin panel for port 8081.

netstat command shows that depending on which server was started first only port 8080 or 8081 is listening.

Both servers listen on UDP ports (9933 and 9934) coresponding
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Problem with acessing admin panel when running 2 smartfox instances on the same server

Postby Lapo » 16 Apr 2022, 09:49

That's because the Tomcat instance is failing to start.
Did you follow the article I've linked? There's also port 8005 to take care of.

If you test-run both servers via the sfs2x.sh command you can see the errors in the console. You'll likely find a Tomcat exception in the console of the instance you launched last.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
ssokol
Posts: 6
Joined: 13 Jan 2022, 12:16

Re: Problem with acessing admin panel when running 2 smartfox instances on the same server

Postby ssokol » 01 Jun 2022, 09:43

Thanks. Editing entries in the apache-tomcat/conf/server.xml fixed the problem. Much obliged

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 62 guests