Skip to content

Docker Installation

Larry edited this page Sep 25, 2022 · 7 revisions

Get Docker

Version Tags

Tag Description
latest Latest stable releases
dev May be unstable and contain unfinished features

Usage

There are two ways to deploy bots with Docker.

docker-compose (recommended)

  1. Create docker-compose.yml file
  2. Copy into the file
version: "3.7"

services:
  discord-bot:
     image: specker/discordplayercountbot
     environment:
       BOT_NAMES: "Bot1;Bot2"
       BOT_PUBADDRESSES: "127.0.0.1;127.0.0.1"
       BOT_PORTS: "16261;16262"
       BOT_DISCORD_TOKENS: "DiscordToken1;DiscordToken2"
       BOT_UPDATE_TIME: "30"
       BOT_STATUSES: "1;2"
       BOT_USENAMETAGS: "false;false"
       BOT_PROVIDERTYPES: "0;0"
       BOT_APPLICATION_VARIABLES: "SteamAPIKey,Here;BattleMetricsKey,Here"
  1. Edit variables and save the File
  2. Open terminal in a location of docker-compose.yml file and type docker-compose up
  3. Press Enter

Docker Commandline

  1. Open Terminal
  2. Type:
docker run \
  --name=PlayerCounterDiscordBot \
  -e BOT_NAMES='Bot1;Bot2' \
  -e BOT_PUBADDRESSES='127.0.0.1;127.0.0.1' \
  -e BOT_PORTS='16261;16262' \
  -e BOT_DISCORD_TOKENS='DiscordToken1;DiscordToken2' \
  -e BOT_UPDATE_TIME='30' \
  -e BOT_STATUSES='1;2' \
  -e BOT_PROVIDERTYPES='0;0' \
  -e BOT_USENAMETAGS='false;false' \
  -e BOT_APPLICATION_VARIABLES='SteamAPIKey,Here;BattleMetricsKey,Here' \
  specker/discordplayercountbot
  1. Edit values in single quotes and press enter

Enviroment Variables

Container images are configured with help of those variables.

Variable Function
BOT_NAMES Names of bots
BOT_PUBADDRESSES Addresses of gameservers
BOT_PORTS Query ports of gameservers
BOT_DISCORD_TOKENS Discord Bots tokens
BOT_STATUSES Discord Bots statuses
BOT_STATUSFORMATS Discord Bots status formats
BOT_USENAMETAGS "Uses name variable as a prefixed status label"
BOT_PROVIDERTYPES Who provides the data for the bot.
BOT_UPDATE_TIME How often bot should refresh
BOT_APPLICATION_VARIABLES Application Variables for all bots

To declare Multiple bots in docker separate values in BOT_NAMES, BOT_PUBADDRESSES, BOT_PORTS, BOT_DISCORD_TOKENS, BOT_STATUSES, BOT_PROVIDERTYPES, and BOT_USENAMETAGS with ;

Examples

Multi and Single Variables

One bot: BOT_NAMES='Bot1'

Two bots: BOT_NAMES='Bot1;Bot2'

BOT_APPLICATION_VARIABLES is a key value pair. The key and value are seperated by commas, and each pair is seperated by a semi-colon.

Example: BOT_APPLICATION_VARIABLES='SteamAPIKey,34124124123rfwer1424124124;BattleMetricsKey,24124124124rwefwrgery5323423412312'

For a single key-value pair, you do NOT need to use a semi-colon seperator. Example: BOT_APPLICATION_VARIABLES='SteamAPIKey,34124124123rfwer1424124124'

For an instance where you do not require any tokens for the bot, remove the lin that states: BOT_APPLICATION_VARIABLES

Application Variables

Please note: This is an example of format without data not specific data, so provider types, address, and more may not be correct.

Name Value
SteamAPIKey Your API Key from here.
BattleMetricsKey Your API Key from here.
With Steam and Battle Metrics:
version: "3.7"

services:
  discord-bot:
     image: specker/discordplayercountbot
     environment:
       BOT_NAMES: "Bot1;Bot2"
       BOT_PUBADDRESSES: "127.0.0.1;127.0.0.1"
       BOT_PORTS: "16261;16262"
       BOT_DISCORD_TOKENS: "DiscordToken1;DiscordToken2"
       BOT_UPDATE_TIME: "30"
       BOT_STATUSES: "1;2"
       BOT_USENAMETAGS: "false;false"
       BOT_PROVIDERTYPES: "0;0"
       BOT_APPLICATION_VARIABLES: "SteamAPIKey,Here;BattleMetricsKey,Here"
Without Battle Metrics:
version: "3.7"

services:
  discord-bot:
     image: specker/discordplayercountbot
     environment:
       BOT_NAMES: "Bot1;Bot2"
       BOT_PUBADDRESSES: "127.0.0.1;127.0.0.1"
       BOT_PORTS: "16261;16262"
       BOT_DISCORD_TOKENS: "DiscordToken1;DiscordToken2"
       BOT_UPDATE_TIME: "30"
       BOT_STATUSES: "1;2"
       BOT_USENAMETAGS: "false;false"
       BOT_PROVIDERTYPES: "0;0"
       BOT_APPLICATION_VARIABLES: "SteamAPIKey,Here"

Without Steam:

version: "3.7"

services:
  discord-bot:
     image: specker/discordplayercountbot
     environment:
       BOT_NAMES: "Bot1;Bot2"
       BOT_PUBADDRESSES: "127.0.0.1;127.0.0.1"
       BOT_PORTS: "16261;16262"
       BOT_DISCORD_TOKENS: "DiscordToken1;DiscordToken2"
       BOT_UPDATE_TIME: "30"
       BOT_STATUSES: "1;2"
       BOT_USENAMETAGS: "false;false"
       BOT_PROVIDERTYPES: "0;0"
       BOT_APPLICATION_VARIABLES: "BattleMetricsKey,Here"

Without Steam and Battle Metrics

version: "3.7"

services:
  discord-bot:
     image: specker/discordplayercountbot
     environment:
       BOT_NAMES: "Bot1;Bot2"
       BOT_PUBADDRESSES: "127.0.0.1;127.0.0.1"
       BOT_PORTS: "16261;16262"
       BOT_DISCORD_TOKENS: "DiscordToken1;DiscordToken2"
       BOT_UPDATE_TIME: "30"
       BOT_STATUSES: "1;2"
       BOT_USENAMETAGS: "false;false"
       BOT_PROVIDERTYPES: "0;0"