one_click_kag_server is a program which tries to fully automate the creation of a King Arthur's Gold server.

Related tags

General Utilitieskag
Overview

one_click_kag_server

one_click_kag_server is a program which tries to fully automate the creation of a King Arthur's Gold server.

It will:

  • Create a virtual machine for you on DigitalOcean
  • Configure the machine to run KAG
  • Create SSH keys
  • Upload and setup mods
  • Setup security configuration such as list of admins
  • Deploy the KAG server with automatic restarts enabled

It can also help with common maintenance tasks such as:

  • Restarting the server with different configuration, such as new mods
  • Viewing the server logs
  • Opening a TCPR console
  • Opening an SSH connection to the server

Everything can be configured from a single config file (see config.yaml).

This is a viable alternative to running a server on your local machine, without the hassle of setting up port forwarding etc. It's also an alternative to dedicated KAG hosting sites such as https://gshost.us/, with the advantage of costing less and not charging based on configuration such as max players. For example, a minimum spec server on DigitalOcean costs $0.007/hour or $5/month (see here). Since this project makes it easy to create and delete servers, you may want to run a more expensive, powerful machine for just a couple of hours and then delete it when you're done.

kagtcprlib example

An admin interface for RCON access can be deployed with the rcon command, using kagtcprlib.

Contact Eluded#1367 on Discord if you have any feedback or need help getting set up.

Instructions

Setup

Before using one_click_kag_server, there are a few things to setup.

  1. Install Python (3.7+) on your system. https://www.python.org/downloads/
  2. Clone this repository. If you don't have Git installed you can also click Code -> Download ZIP from GitHub.
  3. Install one_click_kag_server requirements. Open a terminal in this directory and run pip install -r requirements.txt
  4. Make an account on DigitalOcean. See https://cloud.digitalocean.com/registrations/new
  5. Setup a payment method on DigitalOcean
  6. Create an API token on DigitalOcean.
    • Go to API
    • Click Generate New Token
    • Choose a name for the token and give it both read and write scope

Estimated time: ~10 minutes.

Creating a server

This section describes how to create a server, assuming you have followed the setup instructions above.

  1. Edit config.yaml with a text editor to configure your server.
    • secrets
      • digitalocean_key the DigitalOcean API token you created earlier. Do not share this with anyone, since it gives full access to your account.
    • droplet configures the virtual machine
      • name is the name of the virtual machine (make sure it only contains characters URL-safe characters, so no spaces)
      • region is the short name (a.k.a. slug) for the DigitalOcean region to deploy the server in. If you want a US based server you can leave it as nyc1. For an EU server you could try ams3. For a full list of possible regions see https://slugs.do-api.dev/ (open the Regions tab).
      • image is the type of virtual machine to deploy. Don't change this unless you know what you're doing.
      • size_slug is the size of the machine to deploy. Think about this carefully because there are many options, though more powerful machines are more expensive. For a full list of possible sizes see https://slugs.do-api.dev/ (open the Droplet Sizes tab).
      • backups is whether or not to configure backups. You shouldn't need them, since it's so easy just to delete and re-create your server later.
    • kag configures the KAG server
      • autoconfig can contain any regular option from KAG's autoconfig.cfg
        • sv_name the name of the server
        • sv_info the server description
        • sv_maxplayers the max number of players
        • sv_gamemode the gamemode (e.g. TDM or CTF)
        • sv_register whether to list the server publicly
        • sv_password the password to connect to the server (can be empty for a public server)
        • sv_rconpassword the RCON password for the server
        • security_seclevs path to seclevs file. Don't change this.
      • mods is a list of mods to use. If you add a mod here, also copy it into the Mods directory in this project.
      • security
        • superadmins list of usernames of superadmins
        • admins list of usernames of admins
  2. Open a terminal in this directory and run python -m one_click_kag_server.main up to deploy the server.
    • You should see a bunch of log messages whilst the server is being configured.
    • After around 2 minutes the server should be ready, and you should see a message saying DONE. Server running at {ip_address}. Your server should be ready to play on.

If you wish to have multiple config files with different names then you can pass the --config-file option to switch between them.

Remember to destroy the droplet with one_click_kag_server down once you've finished with the server, since it will be costing you money as long as it's running.

If you have any issues with the above then please report them to me on Discord (Eluded#1367).

Commands

one_click_kag_server offers a few different commands for maintenance of the server.

up

Run python -m one_click_kag_server.main up to deploy the virtual machine and start KAG.

down

Run python -m one_click_kag_server.main down to destroy the virtual machine.

restart-kag

Run python -m one_click_kag_server.main restart-kag to restart the KAG server. This will also upload any new mods or configuration, for example if you've changed autoconfig in config.yaml.

kag-logs

Run python -m one_click_kag_server.main kag-logs to view the KAG logs in real-time.

ssh

Run python -m one_click_kag_server.main ssh to open an SSH connection to the server. This requires SSH to be installed on your system.

rcon

Run python -m one_click_kag_server.main rcon to open a web based RCON client for remote administration of the KAG server.

Important notes

State

Information about the server is stored in a state file (by default state.pkl in this directory). Every time one_click_kag_server runs, this file is updated. If you delete or move the file then information about the server will be lost, and one_click_kag_server will create a brand new server if you run it again. If you lose your state file, you may need to manually login to DigitalOcean and delete your droplet(s). Also, if you want to deploy multiple servers then you may need multiple state files (use the --state-file argument to change this.)

SSH Keys

one_click_kag_server creates a new SSH key pair for virtual machines access, and uploads this to your DigitalOcean account. These keys can be found under ssh_keys/. If you want to access the server with some other SSH client then you need to use this key pair. For example $ ssh -i ssh_keys/one_click_kag_server_aa0ff419 root@$SERVER_HOST.

Owner
Benjamin Gorman
Benjamin Gorman
PyResToolbox - A collection of Reservoir Engineering Utilities

pyrestoolbox A collection of Reservoir Engineering Utilities This set of functio

Mark W. Burgoyne 39 Oct 17, 2022
✨ Un pierre feuille ciseaux totalement fait en Python par moi, et en français.

Pierre Feuille Ciseaux ❗ Un pierre feuille ciseaux totalement fait en Python par moi. 🔮 Avec l'utilisation du module "random", j'ai pu faire un choix

MrGabin 3 Jun 06, 2021
A python module to validate input.

A python module to validate input.

Matthias 6 Sep 13, 2022
a tool for annotating table

table_annotate_tool a tool for annotating table motivated by wiki2bio,we create a tool to annoate all types of tables,this tool can annotate a table w

wisdom under lemon trees 4 Sep 23, 2021
Python implementation of Gorilla time series compression

Gorilla Time Series Compression This is an implementation (with some adaptations) of the compression algorithm described in section 4.1 (Time series c

Ghiles Meddour 19 Jan 01, 2023
✨ Un code pour voir les disponibilités des vaccins contre le covid totalement fait en Python par moi, et en français.

Vaccine Notifier ❗ Un chois aléatoire d'un article sur Wikipedia totalement fait en Python par moi, et en français. 🔮 Grâce a une requète API, on peu

MrGabin 3 Jun 06, 2021
The Black shade analyser and comparison tool.

diff-shades The Black shade analyser and comparison tool. AKA Richard's personal take at a better black-primer (by stealing ideas from mypy-primer) :p

Richard Si 10 Apr 29, 2022
convert a dict-list object from / to a typed object(class instance with type annotation)

objtyping 带类型定义的对象转换器 由来 Python不是强类型语言,开发人员没有给数据定义类型的习惯。这样虽然灵活,但处理复杂业务逻辑的时候却不够方便——缺乏类型检查可能导致很难发现错误,在IDE里编码时也没

Song Hui 15 Dec 22, 2022
A library for interacting with Path of Exile game and economy data, and a unique loot filter generation framework.

wraeblast A library for interfacing with Path of Exile game and economy data, and a set of item filters geared towards trade league players. Filter Ge

David Gidwani 29 Aug 28, 2022
Collection of code auto-generation utility scripts for the Horizon `Boot` system module

boot-scripts This is a collection of code auto-generation utility scripts for the Horizon Boot system module, intended for use in Atmosphère. Usage Us

4 Oct 11, 2022
A Python library for reading, writing and visualizing the OMEGA Format

A Python library for reading, writing and visualizing the OMEGA Format, targeted towards storing reference and perception data in the automotive context on an object list basis with a focus on an urb

Institut für Kraftfahrzeuge, RWTH Aachen, ika 12 Sep 01, 2022
Backup a folder to an another folder by using mirror update method.

Mirror Update Backup Backup a folder to an another folder by using mirror update method. How to use Install requirement pip install -r requirements.tx

1 Nov 21, 2022
A monitor than send discord webhook when a specific monitored product has stock in your nearby pickup stores.

Welcome to Apple In-store Monitor This is a monitor that are not fully scaled, and might still have some bugs.

5 Jun 16, 2022
Convert any-bit number to decimal number and vise versa.

2deci Convert any-bit number to decimal number and vise versa. --bit n to set bit to n --exp xxx to set expression to xxx --r to run reversely (from d

3 Sep 15, 2021
Kanye West Lyrics Generator

aikanye Kanye West Lyrics Generator Python script for generating Kanye West lyrics Put kanye.txt in the same folder as the python script and run "pyth

4 Jan 21, 2022
A multipurpose python module

pysherlock pysherlock is a Python library for dealing with web scraping using images, it's a Python application of the rendertron headless browser API

Sachit 2 Nov 11, 2021
Auto-generate /etc/hosts for HackTheBox machines

Auto-generate /etc/hosts for HackTheBox machines Save yourself some tedium on getting started on a new machine by having your /etc/hosts ready to go.

3 Feb 16, 2022
A Python package implementing various colour checker detection algorithms and related utilities.

A Python package implementing various colour checker detection algorithms and related utilities.

colour-science 147 Dec 29, 2022
Deep Difference and search of any Python object/data.

DeepDiff v 5.6.0 DeepDiff Overview DeepDiff: Deep Difference of dictionaries, iterables, strings and other objects. It will recursively look for all t

Sep Dehpour 1.6k Jan 08, 2023
A python module to manipulate XCode projects

This module can read, modify, and write a .pbxproj file from an Xcode 4+ projects. The file is usually called project.pbxproj and can be found inside the .xcodeproj bundle. Because some task cannot b

Ignacio Calderon 1.1k Jan 02, 2023