add heroku 1 click deployment support

* Procfile, app.json, `PORT` env
This commit is contained in:
Smith
2022-06-17 01:28:45 +02:00
parent 2b96ee82c3
commit 283f8c3b33
6 changed files with 37 additions and 3 deletions

1
Procfile Normal file
View File

@@ -0,0 +1 @@
web: node server.js

View File

@@ -117,6 +117,8 @@ _The bot has no cleanup functionality, left over messages must be removed manual
# Deployment
Check the wiki page for detailed instructions on [how to setup a self deploying free cloud instance at cloudno.de](https://github.com/a-sync/game-server-watcher/wiki/Free-hosting-via-cloudno.de).
[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
## Hosting
Make sure all the [requirements](#requirements) are met!
_**Protip:** check the node.js version with `node -v`._

31
app.json Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "Game Server Watcher",
"description": "A simple discord/telegram bot that can be hosted on a free service to monitor your game servers and players in style. 😎",
"website": "https://github.com/a-sync/game-server-watcher",
"repository": "https://github.com/a-sync/game-server-watcher",
"logo": "https://i.imgur.com/2Ok3pxv.png",
"env": {
"SECRET": {
"description": "Admin secret",
"required": true,
"generator": "secret"
},
"REFRESH_TIME_MINUTES": {
"description": "Game server info refresh interval in minutes [DEPRECETED]",
"required": true,
"value": "5"
},
"DISCORD_BOT_TOKEN": {
"description": "Discord bot token",
"required": false
},
"TELEGRAM_BOT_TOKEN": {
"description": "Telegram bot token",
"required": false
},
"STEAM_WEB_API_KEY": {
"description": "Steam web API key",
"required": false
}
}
}

2
dist/server.js vendored
View File

@@ -11,7 +11,7 @@ require("dotenv/config");
const watcher_1 = require("./watcher");
const CACHE_MAX_AGE = parseInt(process.env.CACHE_MAX_AGE || '0', 10);
const APP_HOST = process.env.app_host || process.env.APP_HOST || '0.0.0.0';
const APP_PORT = parseInt(process.env.app_port || process.env.APP_PORT || '8080', 10);
const APP_PORT = parseInt(process.env.PORT || process.env.app_port || process.env.APP_PORT || '8080', 10);
const SECRET = process.env.SECRET || '';
const DATA_PATH = process.env.DATA_PATH || './data/';
const DBG = Boolean(process.env.DBG || false);

View File

@@ -10,7 +10,7 @@
},
"keywords": [],
"author": "a-sync@devs.space",
"license": "ISC",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@commonify/lowdb": "^3.0.0",
"discord.js": "^12.5.3",

View File

@@ -9,7 +9,7 @@ import { GameServerConfig, main, readConfig, updateConfig } from './watcher';
const CACHE_MAX_AGE = parseInt(process.env.CACHE_MAX_AGE || '0', 10);
const APP_HOST = process.env.app_host || process.env.APP_HOST || '0.0.0.0';
const APP_PORT = parseInt(process.env.app_port || process.env.APP_PORT || '8080', 10);
const APP_PORT = parseInt(process.env.PORT || process.env.app_port || process.env.APP_PORT || '8080', 10);
const SECRET = process.env.SECRET || '';
const DATA_PATH = process.env.DATA_PATH || './data/';
const DBG = Boolean(process.env.DBG || false);