Is there a way to make a permanent host using a VPS serivce?



  • Hey,

    So after reading a few of the tutorials I though what I was looking for was the triplea-game-headless release. So I downloaded it, uploaded it to my VPS, opened port 3300, and made these changes to run_bot:

    readonly MAPS_FOLDER="/home/triplea-game-headless-2.2.20868/downloadedMaps"
    readonly BOT_PORT=3300
    readonly BOT_NAME="Bot_${USER}_${BOT_PORT}"
    readonly BOT_PASSWORD=
    readonly LOBBY_URI="localhost"
    readonly LOBBY_SUPPORT_PASSWORD=
    
    java \
        -server \
        -Xmx256M \
        -Djava.awt.headless=true \
        -jar bin/triplea-game-headless-2.2.20868.jar \
        -Ptriplea.lobby.game.supportPassword="$LOBBY_SUPPORT_PASSWORD" \
        -Ptriplea.lobby.uri="$LOBBY_URI" \
        -Ptriplea.map.folder="$MAPS_FOLDER" \
        -Ptriplea.name="$BOT_NAME" \
        -Ptriplea.port="$BOT_PORT" \
        -Ptriplea.server.password="$BOT_PASSWORD"
    

    Then doing ./run_bot yields this:

    Sep 17, 2020 11:14:13 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/tutorial                                                           -master.zip.properties
    Sep 17, 2020 11:14:13 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/1914-cow                                                           -empires-master.zip.properties
    Sep 17, 2020 11:14:13 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/270bc-ma                                                           ster.zip
    Sep 17, 2020 11:14:14 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/tutorial                                                           -master.zip
    Sep 17, 2020 11:14:14 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/270bc-ma                                                           ster.zip.properties
    Sep 17, 2020 11:14:14 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/1914-cow                                                           -empires-master.zip
    Sep 17, 2020 11:14:14 AM org.triplea.game.server.AvailableGames <init>
    INFO: Done loading maps, availableGames count: 3, contents: [Tutorial, 270BC, 19                                                           14-COW-Empires]
    Sep 17, 2020 11:14:14 AM org.triplea.game.server.HeadlessGameServer <init>
    INFO: Game Server initialized
    Sep 17, 2020 11:14:14 AM org.triplea.game.server.HeadlessGameServer lambda$new$1
    INFO: Headless Start
    Exception in thread "Initialize Headless Server Setup Model" java.lang.IllegalAr                                                           gumentException: target values must be absolute.
            at feign.RequestTemplate.target(RequestTemplate.java:458)
            at feign.Target$HardCodedTarget.apply(Target.java:101)
            at feign.SynchronousMethodHandler.targetRequest(SynchronousMethodHandler                                                           .java:173)
            at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHand                                                           ler.java:101)
            at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:8                                                           0)
            at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.j                                                           ava:103)
            at com.sun.proxy.$Proxy4.sendGameHostingRequest(Unknown Source)
            at org.triplea.http.client.lobby.game.hosting.request.GameHostingClient.                                                           sendGameHostingRequest(GameHostingClient.java:25)
            at games.strategy.engine.framework.startup.mc.ServerModel.createServerMe                                                           ssenger(ServerModel.java:421)
            at games.strategy.engine.framework.startup.mc.ServerModel.lambda$new$1(S                                                           erverModel.java:285)
            at java.base/java.util.Optional.ifPresent(Optional.java:183)
            at games.strategy.engine.framework.startup.mc.ServerModel.<init>(ServerM                                                           odel.java:285)
            at org.triplea.game.server.HeadlessServerSetupPanelModel.showSelectType(                                                           HeadlessServerSetupPanelModel.java:27)
            at org.triplea.game.server.HeadlessGameServer.lambda$new$1(HeadlessGameS                                                           erver.java:69)
            at java.base/java.lang.Thread.run(Thread.java:834)
    

    and then by running it again:

    Sep 17, 2020 11:16:56 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/tutorial-master.zip.properties
    Sep 17, 2020 11:16:56 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/1914-cow-empires-master.zip.properties
    Sep 17, 2020 11:16:56 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/270bc-master.zip
    Sep 17, 2020 11:16:57 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/tutorial-master.zip
    Sep 17, 2020 11:16:57 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/270bc-master.zip.properties
    Sep 17, 2020 11:16:57 AM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/1914-cow-empires-master.zip
    Sep 17, 2020 11:16:57 AM org.triplea.game.server.AvailableGames <init>
    INFO: Done loading maps, availableGames count: 3, contents: [Tutorial, 270BC, 1914-COW-Empires]
    Sep 17, 2020 11:16:57 AM org.triplea.game.server.HeadlessGameServer <init>
    INFO: Game Server initialized
    Sep 17, 2020 11:16:57 AM org.triplea.game.server.HeadlessGameServer lambda$new$1
    INFO: Headless Start
    Sep 17, 2020 11:16:57 AM games.strategy.engine.framework.startup.mc.ServerModel createServerMessenger
    WARNING: Could not open network port, please close any other TripleA games you are
    hosting or choose a different network port. If that is not the problem
    then check your firewall rules.
    java.net.BindException: Address already in use
            at java.base/sun.nio.ch.Net.bind0(Native Method)
            at java.base/sun.nio.ch.Net.bind(Net.java:455)
            at java.base/sun.nio.ch.Net.bind(Net.java:447)
            at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
            at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
            at games.strategy.net.ServerMessenger.<init>(ServerMessenger.java:67)
            at games.strategy.engine.framework.startup.mc.ServerModel.createServerMessenger(ServerModel.java:411)
            at games.strategy.engine.framework.startup.mc.ServerModel.lambda$new$1(ServerModel.java:285)
            at java.base/java.util.Optional.ifPresent(Optional.java:183)
            at games.strategy.engine.framework.startup.mc.ServerModel.<init>(ServerModel.java:285)
            at org.triplea.game.server.HeadlessServerSetupPanelModel.showSelectType(HeadlessServerSetupPanelModel.java:27)
            at org.triplea.game.server.HeadlessGameServer.lambda$new$1(HeadlessGameServer.java:69)
            at java.base/java.lang.Thread.run(Thread.java:834)
    
    Sep 17, 2020 11:16:58 AM org.triplea.game.server.HeadlessGameServer lambda$new$1
    INFO: Waiting for users to connect.
    

    However even though it says "Waiting for users to connect." if I try connecting through "Connect to Network Game" and then put in the VPS' IP and port 3300, nothing happens. I don't even get the error that says "Error: null Check: -the host..."

    Am I doing something wrong or did I misunderstand the intended use of the triplea-game-headless release?

    Sorry in advance if the ladder is the case.


  • Admin

    @Mathias-Sven note the port already in use error. The bot should have terminated in this case but kept running in a zombie state. Try killing all have instances and then try again



  • I did that because I noticed if I didn't run it twice I didn't get the "INFO: Waiting for users to connect." prompt.

    root@vultr:/home/triplea-game-headless-2.2.20868# sudo ps -a
      PID TTY          TIME CMD
    18613 pts/0    00:00:00 sudo
    18614 pts/0    00:00:00 ps
    31692 pts/0    00:13:20 dotnet
    root@vultr:/home/triplea-game-headless-2.2.20868# ./run_bot
    Sep 17, 2020 8:38:33 PM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/tutorial                                                          -master.zip.properties
    Sep 17, 2020 8:38:33 PM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/1914-cow                                                          -empires-master.zip.properties
    Sep 17, 2020 8:38:33 PM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/270bc-ma                                                          ster.zip
    Sep 17, 2020 8:38:33 PM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/tutorial                                                          -master.zip
    Sep 17, 2020 8:38:34 PM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/270bc-ma                                                          ster.zip.properties
    Sep 17, 2020 8:38:34 PM org.triplea.game.server.AvailableGames getGames
    INFO: Loading map: /home/triplea-game-headless-2.2.20868/downloadedMaps/1914-cow                                                          -empires-master.zip
    Sep 17, 2020 8:38:34 PM org.triplea.game.server.AvailableGames <init>
    INFO: Done loading maps, availableGames count: 3, contents: [Tutorial, 270BC, 19                                                          14-COW-Empires]
    Sep 17, 2020 8:38:34 PM org.triplea.game.server.HeadlessGameServer <init>
    INFO: Game Server initialized
    Sep 17, 2020 8:38:34 PM org.triplea.game.server.HeadlessGameServer lambda$new$1
    INFO: Headless Start
    Exception in thread "Initialize Headless Server Setup Model" java.lang.IllegalAr                                                          gumentException: target values must be absolute.
            at feign.RequestTemplate.target(RequestTemplate.java:458)
            at feign.Target$HardCodedTarget.apply(Target.java:101)
            at feign.SynchronousMethodHandler.targetRequest(SynchronousMethodHandler                                                          .java:173)
            at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHand                                                          ler.java:101)
            at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:8                                                          0)
            at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.j                                                          ava:103)
            at com.sun.proxy.$Proxy4.sendGameHostingRequest(Unknown Source)
            at org.triplea.http.client.lobby.game.hosting.request.GameHostingClient.                                                          sendGameHostingRequest(GameHostingClient.java:25)
            at games.strategy.engine.framework.startup.mc.ServerModel.createServerMe                                                          ssenger(ServerModel.java:421)
            at games.strategy.engine.framework.startup.mc.ServerModel.lambda$new$1(S                                                          erverModel.java:285)
            at java.base/java.util.Optional.ifPresent(Optional.java:183)
            at games.strategy.engine.framework.startup.mc.ServerModel.<init>(ServerM                                                          odel.java:285)
            at org.triplea.game.server.HeadlessServerSetupPanelModel.showSelectType(                                                          HeadlessServerSetupPanelModel.java:27)
            at org.triplea.game.server.HeadlessGameServer.lambda$new$1(HeadlessGameS                                                          erver.java:69)
            at java.base/java.lang.Thread.run(Thread.java:834)
    

    As you can see no other process are running prior to ./run_bot but I get this prompt when I try to connect via the client:

    alt text

    Only If I run ./run_bot again I get "INFO: Waiting for users to connect." in which case if I try to access the game via the client I get no error bur nothing happens.


  • Admin

    That IllegalArg is likely the bot trying to connect to lobby. Do you know which URI you have configured for the lobby?

    The arg for lobby URI should be something like "triplea.lobby.uri" with value "https://prod2-lobby.triplea-game.org"



  • Yes that was the problem, the URI was wrong I thought I was supposed to put the localhost, my apologies...

    Thanks for the help!


Log in to reply