Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Release Version 0.1.0

See merge request !4
  • Loading branch information
HJFinch committed Apr 9, 2017
2 parents 6ff2128 + a2cf5af commit c08f5e1
Show file tree
Hide file tree
Showing 31 changed files with 1,332 additions and 207 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ _testmain.go
*.exe
*.test
*.prof
logs
62 changes: 62 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
image: golang:1.8

stages:
- test
- build
- push

variables:
VERSION: $CI_BUILD_TAG

before_script:
- echo $PWD
- source script/prepare
- make prepare
- make validate
- make test || true
build:
stage: build
script:
- make binary
- make crossbinary
- cp config.json dist/
- cp schedule.json dist/
- cp README.md dist/
- tar cfz gorcon-arma-${VERSION}.src.tar.gz --exclude-vcs dist
artifacts:
paths:
- dist/

package:
stage: build
script:
- make install
- VERSION=$VERSION make package
- cp /go/gorcon-arma_${VERSION}.deb .
only:
- tags
environment:
name: storage
url: https://storage.play-net.org/minio/gorcon-arma
artifacts:
paths:
- gorcon-arma_${VERSION}.deb

push:
stage: push
image: python:latest
before_script:
- pip install awscli
- cp gorcon-arma_${VERSION}.deb dist/
script:
- aws --endpoint-url https://storage.play-net.org s3 cp ./dist/ s3://gorcon-arma/artifacts/${VERSION} --recursive --include "*"
- curl -T gorcon-arma_${VERSION}.deb -ufinch:$BINTRAY_API https://api.bintray.com/content/playnet/debian/GoRcon-ArmA/$VERSION/gorcon-arma-${VERSION}.deb
only:
- tags
when: on_success
environment:
name: storage
url: https://storage.play-net.org/minio/gorcon-arma
artifacts:
paths:
- dist/
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
language: go
go:
- 1.8
go_import_path: play-net.org/gorcon-arma
go_import_path: github.com/playnet-public/gorcon-arma
env:
global:
- REPO: $TRAVIS_REPO_SLUG
- VERSION: $TRAVIS_TAG
install:
- source script/prepare
- make prepare
before_script:
- make validate
Expand All @@ -29,5 +30,5 @@ deploy:
file_glob: true
overwrite: true
on:
repo: PlayNet-Public/GoRcon-ArmA
repo: playnet-public/gorcon-arma
tags: true
16 changes: 2 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,11 @@ binary:
crossbinary: ## cross build the non-linux binaries
./script/make.sh generate crossbinary

test: ## run the unit and integration tests
./script/make.sh generate test-unit binary test-integration

test-unit: ## run the unit tests
./script/make.sh generate test-unit

test-integration: ## run the integration tests
./script/make.sh generate binary test-integration

validate: ## validate gofmt, golint and go vet
./script/make.sh validate-glide validate-gofmt validate-govet validate-golint validate-misspell
./script/make.sh validate-gofmt validate-govet validate-golint

dist:
mkdir dist

all: test install
install:
GOBIN=$(GOPATH)/bin GO15VENDOREXPERIMENT=1 go install gorcon-arma/*.go
test:
Expand All @@ -63,7 +52,6 @@ prepare:
go get -u github.com/golang/lint/golint
go get -u github.com/kisielk/errcheck
go get -u github.com/bborbe/debian_utils/bin/create_debian_package
glide install
update:
glide up
clean:
Expand All @@ -73,6 +61,6 @@ package:
-logtostderr \
-v=2 \
-version=$(VERSION) \
-config=src/play-net.org/gorcon-arma/deb/create_deb_config.json
-config=src/github.com/playnet-public/gorcon-arma/deb/create_deb_config.json


163 changes: 143 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,182 @@
# GoRcon-ArmA
The Go based Rcon solution for ArmA servers with server management features

[![build status](https://git.play-net.org/playnet-public/gorcon-arma/badges/master/build.svg)](https://git.play-net.org/playnet-public/gorcon-arma/commits/master)
[![Go Report Card](https://goreportcard.com/badge/github.com/playnet-public/gorcon-arma)](https://goreportcard.com/report/github.com/playnet-public/gorcon-arma)
[![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg)](https://raw.githubusercontent.com/playnet-public/gorcon-arma/master/LICENSE)
[![Join Discord at https://discord.gg/dWZkR6R](https://img.shields.io/badge/style-join-green.svg?style=flat&label=Discord)](https://discord.gg/dWZkR6R)
[![Join the chat at https://playnet-ihtjamcsba.now.sh/](https://img.shields.io/badge/style-register-green.svg?style=social&label=Slack)](https://playnet-ihtjamcsba.now.sh/)


## Features

Implemented:
* Stable and Secure Rcon Connection
* Allow Management of Rcon Servers
* Automated Server Restarts
* Sending timed Messages/Commands to Servers
* Server WatchDog
* Streaming in-game Chats and Events to Console
* Sending Server Log to Files (on Linux)

Planned:
* Stable and Secure Rcon Connection with easy to use Interfaces
* Various Interfaces (API, CLI)
* Allow Management of Rcon Servers
* Executing Rcon Commands
* Automated Server Restarts
* Sending timed Messages to Players
* Offline Whitelisting
* Providing in-game Chats to Interfaces
* Server WatchDog
* Provide in-game Chats to Interfaces
* Provide Server Performance and Host Information to Interfaces
* Offering ease of use with exisiting Tools
* In addition to that, it is planned to make this Project extendible with Plugins
* In addition to that, it is planned to make this Project extensible with Plugins

## Usage

The Tool consists of several parts.
Main Part is the rcon library which connects to a given Server and sends commands/handles responses.
The other part yet integrated is the scheduler. It allows to define time sets when commands should be executed.
Main Part is the RCon library which connects to a given server and sends commands/handles responses.
The other parts yet integrated are the Watcher and Scheduler.

### The Watcher
The Watcher is responsible for starting and watching your game process. When using the Watcher you always have to let the Tool start your ArmA server otherwise the process won't be detected.
When using the watcher as process manager, ending or killing gorcon-arma will also terminate your server process. This is a wanted feature as an automated restart of gorcon-arma would start a new server anyways which would then concur with the old one. On Windows the server is not being killed when gorcon-arma ends unexpected so take care of this when restarting it.

### The Scheduler
The Scheduler is able to either send a string over RCon (like: say -1 hello all) or send a restart command. If the Watcher is enabled, the restart will be done by sending a SIGTERM/SIGKILL to the process. If there is only RCon the restart will send a '#restartserver' command. Please note that without any kind of watcher your server might not come back up. When declaring a command in your config as restart event, the command string will be ignored.

Note that the Scheduler has it's own schedule.json file containing the timetable (see below).


### Getting Started

#### Binary
If you get the latest binary version from our [storage server](https://storage.play-net.org/minio/gorcon-arma/) you also get this README, the example config.json and an example schedule.json (HINT: You can select all the files you need and download them as a zip file).

#### Debian Package (WIP)
If you want to use the pre-built debian package which also contains a systemd script for managing gorcon-arma (still being tested), you can get it by adding our bintray repository to your sources:
```
echo "deb https://dl.bintray.com/playnet/debian /" | sudo tee -a /etc/apt/sources.list
```
Then install via it's package name:
```
apt install gorcon-arma
```

#### Configuration
Once you got all required files installed you are ready to change the config.json according to your needs.
When entering the ArmA path make sure to use the right formating, even on Windows the path has to use forward slashes(/)! Do not escape spaces on Windows as Golang is handling all that for you.
Also note that logToFile and logToConsole are not supported on Windows, so we recommend keeping them disabled.
All further configuration options are described below. For both ```keepAliveTimer``` and ```keepAliveTolerance``` we recommend leaving them to the standards unless issues arise.

#### Starting
As gorcon-arma is a single binary starting it is fairly easy.
If you used the binary files simply start the gorcon-arma binary of your choice ```./gorcon-arma_linux-amd64```
If you used the Debian Package it is as simple as ```systemctl start gorcon-arma```

#### Debugging
If you encounter any issues with GoRcon-ArmA and need help, we recommend to first start with more output logging:
``` ./gorcon-arma_linux-amd64 --logtostderr=true -v=2```

The Verbosity Level is categorized in the following order:
```
1: Usual Output (can be always on)
2: More Info
3: Debug Communication
4: Debug Internals
5: Intense Debug
10: Loop Debugging
```

The Scheduler is able to either send a String over RCon (like: say -1 hello all) or send a restart command.
For now both happens over rcon and therefor a working connection is required, but in the near future it is planned to also send the exit command to the process itself.
To give us feedback on your problems or to tell us about requests/ideas feel free to post them in our Issues Section on [Gitlab](https://git.play-net.org/playnet-public/gorcon-arma/issues) or [Github](https://github.com/playnet-public/gorcon-arma/issues)
We also happily invite you to join us on [Slack](https://playnet-ihtjamcsba.now.sh/) or [Discord](https://discord.gg/dWZkR6R)!

### Config Manual
```json
{
"arma": {
// Whether or not RCon is enabled
"enabled": true,
// IP of the RCon Server
"ip": "127.0.0.1",
// RCon Port as set in beserver.cfg
"port": "2301",
// RCon Password as set in beserver.cfg
"password": "qwerty",
// Path to the ArmA executable (linux or windows)
"path": "D:/Program Files (x86)/Steam/SteamApps/common/Arma 3/arma3server.exe",
// single string of parameters for ArmA (watch formating for linux)
"param": "-name=goTest",
// The amount of seconds to wait until a keepAlivePacket is send to RCon (BattlEye Specification is min. 45sec)
"keepAliveTimer": 10,
// The maximum tolerance between the sent keepAlives and the Servers response (higher means slower detection of disconnect, lower might cause unrequired reconnects)
"keepAliveTolerance": 4
// The maximum tolerance between the sent keepAlives and the server response (higher means slower detection of disconnect, lower might cause unrequired reconnects)
"keepAliveTolerance": 4,
// Whether or not the Server Chat should be streamed to the console/stdout
"showChat": true,
// Whether or not the Server Events should be streamed to the console/stdout
"showEvents": true
},

"scheduler": {
// Wheteher or not the scheduler is enabled
"enabled": true,
// Path to schedule.json (keep local if not required otherwise)
"path": "schedule.json",
// The Timezone Offset from GMT (Berlin: 1)
"timezone": 1
"path": "schedule.json"
},

"watcher": {
// Wheteher or not the watcher is enabled
"enabled": true,
// Path to the ArmA executable (linux or windows)
"path": "D:/Program Files (x86)/Steam/SteamApps/common/Arma 3/arma3server.exe",
// single string of parameters for ArmA (watch formating for linux)
"params": "-name=goTest",
// Enable or Disable stderr/stdout logging of game server (linux systems only)
"logToFile": true,
// Set the folder path in which logfiles are being created
"logFolder": "logs",
// Enables streaming of the server output(logs) to the console (linux systems only)
"logToConsole": false
}
}
```

### Schedule Manual
The Scheduler implements a system like cronjobs. To learn more about it check out this [link](https://crontab.guru)
```json
{
"schedule": [
//One Schedule Event
{
// Command to be executed (if not restart)
"command": "say -1 Restart in 30 minutes",
// If the Server should be restarted (overrides command)
"restart": false,
// Day of the Week to run the Event (0-6, 0 = Sunnday, * = Every Day)
"day": "*",
// Hour of the Day to run the Event (0-23, * = Every Hour)
"hour": "*",
// Minute of the Hour to run the Event (0-60, * = Every Minute)
"minute": "11"
},

// Example Event to restart the Server every day at 12:08am
{
"command": "",
"restart": true,
"day": "*",
"hour": "12",
"minute": "8"
},

// Example Event to restart the Server every hour at xx:30am/pm
{
"command": "",
"restart": true,
"day": "*",
"hour": "*",
"minute": "30"
}
]
}
```

## License
This project is licensed under the included License (GNU GPLv3).
Powered by https://play-net.org
We also ask you to keep the projects name and links as they are, to direct possible contributors and users to the original sources.
Do not host releases yourself. Always redirect users back to the official releases for downloads.

Powered by https://play-net.org.
Loading

0 comments on commit c08f5e1

Please sign in to comment.