Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Local Development with localtunnel and Slack #42

Merged
merged 3 commits into from Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
@@ -0,0 +1,4 @@
SLACK_TOKEN=
SLACK_VERIFICATION_TOKEN=
PORT=3000
DEV_SUBDOMAIN=janefoster
25 changes: 22 additions & 3 deletions README.md
@@ -1,5 +1,5 @@
# Greetbot
Greetbot is a Slackbot app built with [ExpressJS](https://expressjs.com/) to be used with the [Codebuddies](https://www.codebuddies.org) open Slack community. Greetbot helps us welcome and onboard new members and provide valuable coding resources.
# greetbot
greetbot is a Slack app built with [ExpressJS](https://expressjs.com/) to be used with the [Codebuddies](https://www.codebuddies.org) open Slack community. greetbot helps us welcome and onboard new members and provide valuable coding resources.

## Contributing
### Code of Conduct
Expand All @@ -8,7 +8,26 @@ This is an open source project and we welcome all developers of all skill levels
**TL;DR:** Be nice, we are all here to learn together.

### Development
Please refer to our [wiki](https://github.com/codebuddies/greetbot/wiki) for guides on getting set up, development workflows and testing.
Development contribution requires that you have your own Slack workspace as your sandbox for local development purposes. For instructions on how to make your own, see Slack's [tutorial](https://get.slack.help/hc/en-us/articles/206845317-Create-a-Slack-workspace).

#### Getting Started
1. Install dependencies with NPM
```bash
npm install
```

2. Create an `.env` file by following the same structure as `.env.example`. Change the `DEV_SUBDOMAIN` variable to your name without spaces. For example, if your name is Jane Fonda, then the `DEV_SUBDOMAIN` value should be `janefonda`.

3. Run Development mode
```bash
npm run start:dev
```

#### Installing greetbot in your sandbox workspace
We have created a guide on how to set up your local version of greetbot in your Slack workspace. Read it [here](https://github.com/codebuddies/greetbot/wiki/Setup-Greetbot-in-your-Slack-Workspace).

#### Putting it all together :tada:
Now that you have followed the tutorials and guides linked above to a T (right??), greetbot should work in your slack workspace. Try sending a slash command by typing `/welcome test`. greetbot should send you private message with a welcome message.

### Feature Requests / Ideas / Issues
For bugs or other issues, feel free to file an [Issue](https://github.com/codebuddies/greetbot/issues).
Expand Down
6 changes: 5 additions & 1 deletion package.json
Expand Up @@ -9,7 +9,9 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node src/index.js",
"start-dev": "nodemon src/index.js"
"start:dev-server": "nodemon src/index.js",
"start:dev-tunnel": "node src/config/localtunnel.js",
"start:dev": "npm run start:dev-server & npm run start:dev-tunnel"
},
"author": "CodeBuddies <codebuddiesdotorg@gmail.com>",
"dependencies": {
Expand All @@ -18,11 +20,13 @@
"body-parser": "^1.17.1",
"dotenv": "^4.0.0",
"express": "^4.15.2",
"node": "^8.10.0",
"node-json-db": "^0.7.3",
"querystring": "^0.2.0",
"yamljs": "^0.3.0"
},
"devDependencies": {
"localtunnel": "^1.8.3",
"nodemon": "^1.17.1"
}
}
14 changes: 14 additions & 0 deletions src/config/localtunnel.js
@@ -0,0 +1,14 @@
// Module for creating a public tunnel to local server.
// This is ran separately from the app itself and along side with
// Node in `development` mode.
require('dotenv').config();

const localtunnel = require('localtunnel');
const config = {
port: process.env.PORT,
subdomain: { "subdomain": process.env.DEV_SUBDOMAIN }
}

localtunnel(config.port, config.subdomain, function (err, tunnel) {
console.log(`App can be publicly accessed at ${tunnel.url}`);
});