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.rst: Add docs to setup corobo #665

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions docs/setup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Setting Up Corobo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Setting Up Corobo
Setting Up corobo

=================

The following documentation illustrates the process to install Corobo and interface it with the gitter API.

Installation
------------

* To install corobo, first you need to setup a virtual environment(it is not mandatory but highly recommended). This can be done as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* To install corobo, first you need to setup a virtual environment(it is not mandatory but highly recommended). This can be done as follows:
* To install corobo, first you need to setup a virtual environment. This can be done as follows:

Let's not involve non-venv setups, which most probably won't even work.

::
pip3 install virtualenv
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use venv since it ships with python. Let's also add a point of recommending them python 3.6.

virtualenv venv -p python
cd venv
source bin/activate ----> For Linux
\Scripts\activate ----> For Windows
* Next, you can clone the corobo package via git and install the requirements(dependent packages).
::
git clone https://github.com/coala/corobo.git
pip install -r requirements.txt

Configuration of Environment variables(In text mode)
--------------------------------------------------

* The following environment variables are required to setup corobo in text mode:
::
export BOT_PREFIX="any_name"
export BACKEND="Text"
export BOT_USERNAME="@any_other_name"
(**Note:** The BOT_USERNAME always starts with a @ for a person and # for a room)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incomplete. And what is BOT_USERNAME?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was mentioned in the docs. Seems like it is not used now. Will get it removed.
Also, can u pls suggest the points that you mean to get added??


Testing Corobo
---------------------------

* To run the bot use:
::
errbot
* You can test the bot using the following commands:
::
bot_prefix help ----> Lists the set of commands available with the bot
bot_prefix history ----> Lists the command history


Setting up Corobo with gitter backend
=====================================

#. Clone the err-backend-gitter repository in your "corobo" folder.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use #. See examples from coala repo on how we write rst files.

::
git clone https://github.com/errbotio/err-backend-gitter.git
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. We use a submodule pinned to a specific commit, so you should be using that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. will get this done.


#. Configure the environment variables(for gitter-backend).
::
export BACKEND="Gitter"
export BOT_EXTRA_BACKEND_DIR="/path_to/err-backend-gitter"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required since the path is fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will get this fixed.

#. To make the bot interact with the gitter API you will need a github account(this account can be used to login to gitter) to generate the gitter access token.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#. To make the bot interact with the gitter API you will need a github account(this account can be used to login to gitter) to generate the gitter access token.
#. To make the bot interact with the Gitter API you will need a GitHub account (this account can be used to login to Gitter) to generate the gitter access token.

Do this wherever required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You actually don't need a github account to login to gitter. One can use gitlab, twitter, or whatever else there is available.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also take care of the line length.

**Remember it is recommended to use a separate account(other than the admin account) for the bot.**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Remember it is recommended to use a separate account(other than the admin account) for the bot.**
**Remember it is recommended to use a separate account (other than the admin account) for the bot.**

Also bold not required here.

Once the account is setup, run the following script.
::
./oauth.py
This will guide you with the gitter token generation process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On running this file it guides us with the process generating the gitter bit token.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the file.. https://github.com/errbotio/err-backend-gitter/blob/14a428bdd0597b473605264c822855da979bd916/oauth.py
This point is also mentioned in the gitter backend documentation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very redundant, and you didn't tell them that this file belongs to the gitter backend directory. I don't think we need this as it is not even a part of corobo.

#. Now you can assign the above generated token to the BOT_TOKEN environment variable.
::
export BOT_TOKEN="your_gitter_token"
#. Also to configure the bot with access to your github and gitlab repositories, you will need personal access tokens.
The following links may guide you through this:
https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not properly indented? Also, raw text links like these don't look good.

#. You can also create github organisations and gitlab groups to manage your repositories.
Under a organisation you can make teams to organize the workforce.
#. After completing the above steps, it is time to setup the remaining environment variables with the above gathered information.
::
export GH_TOKEN="your_github_token"
export GL_TOKEN="your_gitlab_token"
export GH_ORG_NAME="your_github_organisation_name"
export GL_ORG_NAME="your_gitlab_organisation_name"
export ROOMS="rooms_to_join"
export BOT_ADMINS="your_gitter_username"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These exports statements are coming too many times, instead have them bunched up in a single step.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, since I have divided the configuration in steps, the export statements have also been divided accordingly. I will get this done into two parts. One is for simple corobo configuration (with text backend) and other would be with the gitter backend. Dividing in minimum two parts seemed to be essential because it future if we add support for more backends then we can have separate files for each backend. Is this fine??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use text backend, it's merely there for testing reasons. errbot doesn't need special handling for backends, and hence the instructions should be more or less same. For example, we use the same instance for connecting over zulip as well, but we still don't have any special instructions for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.. will get this fixed..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please suggest using .env file, which don't need the export.

Copy link
Contributor Author

@codehobbyist06 codehobbyist06 Apr 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Can I insert link to some external blog regarding working with .env files??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not required.

(**Note:** The admin user account should be different than the bot account.)
#. Hurrah!!! the bot is now ready to be deployed. To run the corobo instance use:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deployed seems to be the wrong word here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will get this changed.

::
errbot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this is running, the bot account should join all rooms required manually to then listen to those iirc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, forgot this step.. will get it added..


Your corobo instance should now be running. You can chat with the bot by logging in through the admin gitter account and
searching its username in the contacts section. You can send it commands via chat.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
searching its username in the contacts section. You can send it commands via chat.
searching it's username in the contacts section. You can send it commands via chat.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also contact section? This could use a better word

::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.

bot_prefix help
bot_prefix history

**Note:** Every time you run a new instance of the bot, it is required to set the environment variables(steps 2 and 7).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really required, on a single session the env vars are preserved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant running a new shell instance. Will get this explicitly mentioned..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to advise them to use .env instead.


To know more about the list of available commands and other features of corobo checkout the other `docs <https://github.com/coala/corobo/tree/master/docs>`_.