Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Server Setup

pekempy edited this page Jul 31, 2023 · 4 revisions

IMPORTANT NOTE This section is only required if you're running on Windows Server, Windows N edition, or another Cloud Service.

Since Windows Server and Windows N are both missing key components used to automate the bot and is likely remote to your personal computer, we’ll need to do a few extra steps. Follow Wiki:Getting Started until you get to Step 3 (don’t do step 3 just yet), then return here.

If you’re using Windows Server, start with Step 1 regardless if you’re local or remote. If you’re using Windows N, just grab and install Media Feature Pack for N versions of Windows 10 from Microsoft directly, then continue on from Step 3 onwards from Wiki:Getting Started. Both are necessary for their respective Windows versions, as they contain window capture features required by OpenCV that are not installed by default.

Step 1: Installing “Windows Desktop Experience” for Windows Server

Windows Desktop Experience

From the Control Panel, select “Programs and Features”

Select “Turn windows features on or off” on the left-hand side

Click “Server Selection” this will enable “Features”. Click “Features”

Open the “User Interfaces and Infrastructure” subfolder and tick the box next to “Desktop Experience”

Wait until complete, Windows will ask to reboot. After rebooting, continue to Step 2.

Step 2: Setting up remote dashboard

If you’re going to keep your server hooked up to a monitor, logged in locally, and are running an up to date installation of “Windows Server 2019” or newer, you can skip to Step 3 onwards from Wiki:Getting Started and the bot should be ready for action! Otherwise, due to issues with page formatting, and MSHTML (Internet Explorer’s in-application page render engine), I recommend following on from here.

Open config.yml in a text editor and scroll down until you see the following

    # User Interface config
    ui:
      enable: true
      width: 1280
      height: 720
    
    # Web Server config (server must be enabled for the UI to work)
    server:
      enable: true
      ip: 127.0.0.1
      port: 8888 # The server port must be unique for each instance of the bot you run

You’ll want to disable the User Interface, set the listening IP to 0.0.0.0 so the dashboard will be available remotely, and if port 8888 is in use for something else, increase the port number. The end result will look something like this.

    # User Interface config
    ui:
      enable: false
      width: 1280
      height: 720
    
    # Web Server config (server must be enabled for the UI to work)
    server:
      enable: true
      ip: 0.0.0.0
      port: 8888 # The server port must be unique for each instance of the bot you run

This will enable the bot’s dashboard to be accessible from a regular web browser, but we still have to open up ports to make in accessible remotely on your network.

Step 3: Opening up ports

If you’re going to keep the dashboard open in a browser window on the server, this is your stepping off point, follow steps 3 and 4 from Wiki:Getting Started, run the bot with python bot.py and navigate to http://127.0.0.1:8888/dashboard with any chromium-based browser. If you’re on Windows Server or remotely accessing the bot running on a Windows/Windows N installation, follow onwards. I’ve included some screenshots for this section to ease the difficulty a bit.

Hit start, type Windows Firewall with Advanced Security, you may see Windows Defender Firewall with Advanced Security instead, both are the same tool. Open it.

Click Inbound Rules and New Rule...

Select the Port toggle, and click Next

Make sure the buttons next to TCP and Specific local ports are toggled.

Type “8888” into the field next to Specific local ports: and click Next PortTut01

Make sure Allow the Connection is ticked, then click Next PortTut02

Untick Public to prevent potential unexpected connections in the future, but make sure Private and Domain are ticked. PortTut03

Finaly, name the connection something descriptive like PokeBot (Incoming) and click Finish. PortTut04

Now the bot should be accessible at http://SERVER_IP_HERE:8888/dashboard when running, replacing “SERVER_IP_HERE” with your servers IP.

You’re done with the server-specific setup! Follow Step 3 onwards from Wiki:Getting Started