Skip to content

Commit

Permalink
Heroku button (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny authored Jan 1, 2020
1 parent de746f2 commit c14c396
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 8 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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
Expand Down
40 changes: 40 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}

0 comments on commit c14c396

Please sign in to comment.