From b150d78e4d0f4a78cb19c2e1abe6c8e66b3708a5 Mon Sep 17 00:00:00 2001 From: Pranav Raj Sreepuram Date: Sun, 22 Sep 2019 11:29:26 +0530 Subject: [PATCH] Add development docs --- docs/development/environment-setup/ubuntu.md | 107 ++++++++++++++++++ .../development/project-setup/dependencies.md | 17 +++ .../project-setup/environment-variables.md | 76 +++++++++++++ 3 files changed, 200 insertions(+) create mode 100644 docs/development/environment-setup/ubuntu.md create mode 100644 docs/development/project-setup/dependencies.md create mode 100644 docs/development/project-setup/environment-variables.md diff --git a/docs/development/environment-setup/ubuntu.md b/docs/development/environment-setup/ubuntu.md new file mode 100644 index 000000000..4b0eaf102 --- /dev/null +++ b/docs/development/environment-setup/ubuntu.md @@ -0,0 +1,107 @@ +## Setting up development environment in Ubuntu + +Open a terminal and run the following commands + +```bash +sudo apt-get update +``` + +### Install Git + +```bash +sudo apt-get install git +``` + +### Install RVM + +You need software-properties-common installed in order to add PPA repositories. + +```bash +sudo apt-get install software-properties-common +``` + +```bash +sudo apt-add-repository -y ppa:rael-gc/rvm +sudo apt-get update +sudo apt-get install rvm +``` + +Enable `Run command as a login shell` in terminal `Preferences`. Restart your computer + +### Install Ruby + +Chatwoot APIs are built on Ruby on Rails, you need install ruby 2.6.3 + +```bash +rvm install ruby-2.6.3 +``` + +Use ruby 2.6.3 as default + +```bash +rvm use 2.6.3 --default +``` + +### Install Node.js + +Install Node.js from NodeSoure using the following commands + +```bash +curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - +sudo apt-get install -y nodejs +``` + +### Install yarn + +We use `yarn` as package manager + +```bash +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +``` + +```bash +sudo apt-get update && sudo apt-get install yarn +``` + +### Install postgres + +The database used in Chatwoot is PostgreSQL. Use the following commands to install postgres. + +```bash +sudo apt install postgresql postgresql-contrib +``` + +The installation procedure created a user account called postgres that is associated with the default Postgres role. In order to use Postgres, you can log into that account. + +```bash +sudo -u postgres psql +``` + +Install `libpg-dev` dependencies for ubuntu + +```bash +sudo apt-get install libpq-dev +``` + +### Install redis-server + +Chatwoot uses Redis server in agent assignments and reporting. To install `redis-server` + +```bash +sudo apt-get install redis-server +``` + +Enable Redis to start on system boot. + +```bash +sudo systemctl enable redis-server.service +``` + +### Install imagemagick + +```bash +sudo apt-get install imagemagick +``` + +Next: Read project setup to install project dependencies diff --git a/docs/development/project-setup/dependencies.md b/docs/development/project-setup/dependencies.md new file mode 100644 index 000000000..f751c7514 --- /dev/null +++ b/docs/development/project-setup/dependencies.md @@ -0,0 +1,17 @@ +## Project dependencies + +### Install Chatwoot Ruby dependencies + +Use the following command to install ruby dependencies. + +```bash +bundle +``` + +### Install Chatwoot JavaScript dependencies + +```bash +yarn +``` + +This would install all required dependencies for Chatwoot application. diff --git a/docs/development/project-setup/environment-variables.md b/docs/development/project-setup/environment-variables.md new file mode 100644 index 000000000..196faf49e --- /dev/null +++ b/docs/development/project-setup/environment-variables.md @@ -0,0 +1,76 @@ +## Environment variables + +### Setup environment variables + +Copy `database` and `application` variables to the correct location. + +```bash +cp shared/config/database.yml config/database.yml +cp shared/config/application.yml config/application.yml +``` + +### Configure database + +Use the following values in database.yml + +```bash +development: + <<: *default + username: postgres + password: + database: chatwoot_dev +``` + +Following changes has to be in `config/application.yml` + +### Configure Pusher + +Chatwoot uses [Pusher](https://pusher.com/) to handle realtime messages. Create a free account on Pusher and fill the following environment values. + +```yml +pusher_app_id: '' +pusher_key: '' +pusher_secret: '' +pusher_cluster: '' +``` + +### Configure FB Channel + +To use FB Channel, you have to create an Facebook app in developer portal. You can find more details about creating FB channels [here](https://developers.facebook.com/docs/apps/#register) + +```yml +fb_verify_token: '' +fb_app_secret: '' +fb_app_id: '' +``` + +### Configure emails + +For development, you don't need an email provider. Chatwoot uses [letter-opener](https://github.com/ryanb/letter_opener) gem to test emails locally + +### Configure frontend URL + +Provide the following value as frontend url + +```yml +frontend_url: 'http://localhost:3000' +``` + +### Configure storage + +Chatwoot currently supports only S3 bucket as storage. You can read [Creating an S3 bucket](https://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html) and [Create an IAM user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html) to configure the following details. + +```yml +S3_BUCKET_NAME: '' +AWS_ACCESS_KEY_ID: '' +AWS_SECRET_ACCESS_KEY: '' +AWS_REGION: '' +``` + +### Configure Redis URL + +For development, you can use the following url to connect to redis. + +```yml +REDIS_URL: 'redis:://127.0.0.1:6379' +```