Skip to content

Commit

Permalink
Edit readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kosyfrances committed Mar 6, 2016
1 parent 9e583ba commit 6c46090
Showing 1 changed file with 29 additions and 49 deletions.
78 changes: 29 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Food-bot is a Slack bot written in python that connects via the RTM API. It was

Want to contribute? Great!

You need to have postgres installed and set up on your machine. You also need python, and a virtual environment set up.
You need to have postgreSQL installed and set up on your machine. You also need python, and a virtual environment set up.

Clone the repository from [github](https://www.github.com)
Clone the repository from [GitHub](https://www.github.com)
```
git clone https://github.com/andela-kanyanwu/food-bot-review.git
```
Expand All @@ -32,70 +32,49 @@ __.env.yml format:__
```
SECRET_KEY:
'some-random-crazy-value'
DEBUG:
'True'
```


Follow these processes to configure the bot and run locally:

Create a bot on [Slack](https://www.slack.com) that you will use to test whatever you do.

On your terminal,
```
cp doc/example-config/rtmbot.conf .
```
```
vi rtmbot.conf
```
```
DEBUG: True
SLACK_TOKEN: "xoxb-11111111111-222222222222222"
ENVIRONMENT: 'local'
DAEMON: False
```
Be sure to replace the _SLACK_TOKEN_ in the rtmbot.conf file with the one from the bot you created.

**Be sure to have a postgress database setup named food_bot locally:**
## Database

On your terminal,
```
createdb food_bot
```
You can also use the PgAdmin Tool to do that manually.
You can use PgAdmin or its alternative to create the database.

**Run the following command to create the tables **
*Run the following command to create the tables*
```
python django_foodbot/manage.py makemigrations
python django_foodbot/manage.py migrate
```

### Populate your local database with foodbot data.

*Run the following command to populate your local database with data from the fixtures*
```
python django_foodbot/manage.py migrate
python django_foodbot/manage.py loaddata initial_data.json
```

###Get the latest food-bot database from heroku stage.
## Set up your environment to test the bot locally
*Ask any of the collaborators for a slack bot api key. You will also be added to the food-review slack organisation where you can test foodbot while working.*

First we will need to add you as a collaborator on heroku
Follow these processes to configure the bot and run locally:

**To download the database backup from heroku:**
**Note:** You will need to be added as a collaborator on heroku staging
On your terminal,
```
heroku pg:backups capture --app APPNAME
cp doc/example-config/rtmbot.conf .
```
**Be sure to replace APPNAME with the app name(staging-foodbot)**

Next,
```
curl -o latest.dump `heroku pg:backups --app APPNAME public-url`
vi rtmbot.conf
```
**Restore to local database**
```
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U MYUSER -d food_bot latest.dump
DEBUG: True
SLACK_TOKEN: "xoxb-11111111111-222222222222222"
ENVIRONMENT: 'local'
DAEMON: False
```
**Be sure to replace MYUSER with your postgres username.**

You can click [here](https://devcenter.heroku.com/articles/heroku-postgres-import-export) to read more about importing databases from heroku


**We will work on creating a script that would do the setup automatically for you but for now, please follow these steps and let any of the collaborators know if you have any issues.**

Be sure to replace the _SLACK_TOKEN_ in the rtmbot.conf file with the one from the bot you created.

### Start the bot

Expand All @@ -105,7 +84,7 @@ You will need to always restart the bot as the server does not automatically det
./rtmbot.py
```
### Development
- Checkout to a new branch from master when working on any task.
- *Checkout* to a new branch from master when working on any task.
```
$(master) git checkout -b FEATURE_BRANCH
#=> Switched to a new branch 'FEATURE_BRANCH'
Expand All @@ -121,10 +100,11 @@ git push --set-upstream origin FEATURE_BRANCH
$(FEATURE_BRANCH): git fetch
$(FEATURE_BRANCH): git rebase origin/master
```
- If everything is fine and there haven't been any commits yet:
- If everything is fine and there haven't been any commit yet:
```
$(FEATURE_BRANCH): git push
```
- You will need to git push --force if the rebase rewrote any commits, but first confirm with git status that you're on the correct branch.
- You will need to git push --force if the rebase rewrote any commit but first confirm with *git status* that you are on the correct branch.
- Create pull request against the STAGING branch when you are done for code review.
- After review, your code-reviewer will merge your branch to staging branch, and if there are no issues, the pull request will be merged and branch will be deleted.
- After review, your code reviewer will merge your branch to staging branch. *meal-bot* on the food-review slack is tied to the staging branch. If everything works fine on *meal-bot*, your branch will be deleted and the staging branch will be merged to master.
- Please note that the master branch is tied to *food_bot* on Andela slack. Do not push or merge to master until you are sure *meal-bot* on the food-review slack has no issues.

0 comments on commit 6c46090

Please sign in to comment.