From 283f8c3b33e787ccc23645202839eab217b8ab7b Mon Sep 17 00:00:00 2001 From: Smith Date: Fri, 17 Jun 2022 01:28:45 +0200 Subject: [PATCH] add heroku 1 click deployment support * Procfile, app.json, `PORT` env --- Procfile | 1 + README.md | 2 ++ app.json | 31 +++++++++++++++++++++++++++++++ dist/server.js | 2 +- package.json | 2 +- src/server.ts | 2 +- 6 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 Procfile create mode 100644 app.json diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..489b270 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node server.js diff --git a/README.md b/README.md index ab808a0..dd1ae6b 100644 --- a/README.md +++ b/README.md @@ -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`._ diff --git a/app.json b/app.json new file mode 100644 index 0000000..8f0bb2c --- /dev/null +++ b/app.json @@ -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 + } + } +} \ No newline at end of file diff --git a/dist/server.js b/dist/server.js index d508f26..d3f3625 100644 --- a/dist/server.js +++ b/dist/server.js @@ -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); diff --git a/package.json b/package.json index 8b38d4e..37f048e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/server.ts b/src/server.ts index 463feca..c813765 100644 --- a/src/server.ts +++ b/src/server.ts @@ -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);