From c14c3962a07ab89b70415ed4e949459cd18c47da Mon Sep 17 00:00:00 2001 From: Arnaud Ligny Date: Wed, 1 Jan 2020 23:41:06 +0100 Subject: [PATCH] Heroku button (#6) --- README.md | 26 ++++++++++++++++++-------- app.json | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 app.json diff --git a/README.md b/README.md index 6a08b2e..d7d0911 100644 --- a/README.md +++ b/README.md @@ -7,35 +7,44 @@ ## Installation ```bash -git clone https://github.com/Narno/leo-bot.git +git clone https://github.com/Narno/leo-bot.git && cd leo-bot npm install ``` -### Slack token +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/Narno/leo-bot) -You need to set an environment variable: +### Slack +#### Token +You need to set an environment variable: ```bash export SLACK_BOT_TOKEN="xoxb-XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX" ``` - > You'll find `SLACK_BOT_TOKEN` at https://my.slack.com/apps/A0F7YS25R-bots. -### Slack channels +#### Channel The bot daily message is sent to: - `#test-bot` channel on **debug** mode - `#leo` channel on **production** mode +See `config.json`. + +### Reminder + +The bot daily message is scheduled at: +- `*/15 * * * * *` on **debug** mode: every 15 seconds +- `0 45 17 * * 1-5` on **production** mode: every opendays at 5:45pm + +See `config.json`. + ## Usage ```bash # Served with hot reload (+ ESLint verification). npm run dev - # Run ESLint to check if code respects it's syntax. npm run lint - # Start server in production environment. npm run start ``` @@ -46,10 +55,11 @@ Just ask `help` to `@leo-bot`. ## Deploy -### Heroku +### Heroku (CLI) ```bash heroku create --buildpack https://github.com/heroku/heroku-buildpack-nodejs.git +heroku addons:create heroku-redis:hobby-dev heroku config:set SLACK_BOT_TOKEN=xoxb-XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX heroku config:set TZ=Europe/Paris heroku ps:scale web=0 worker=1 diff --git a/app.json b/app.json new file mode 100644 index 0000000..e2d5ca7 --- /dev/null +++ b/app.json @@ -0,0 +1,40 @@ +{ + "name": "leo-bot", + "description": "A very simple bot based on Botkit to notice you when it's time to pick up your child at school!", + "repository": "https://github.com/Narno/leo-bot", + "logo": "https://a.slack-edge.com/80588/img/services/bots_128.png", + "keywords": ["bot", "slack", "botkit"], + "website": "https://narno.org/leo-bot/", + "buildpacks": [ + { + "url": "heroku/nodejs" + } + ], + "addons": [ + { + "plan": "heroku-redis:hobby-dev", + "as": "REDIS" + } + ], + "env": { + "SLACK_BOT_TOKEN": { + "description": "You'll find it at https://my.slack.com/apps/A0F7YS25R-bots.", + "value": "", + "required": true + }, + "TZ": { + "description": "Time Zone.", + "value": "Europe/Paris", + "required": false + } + }, + "formation": { + "worker": { + "quantity": 1, + "size": "free" + }, + "web": { + "quantity": 0 + } + } +}