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

fix: Fixes 283 #285

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ yarn build

This command generates static content into the `build` directory and can be served using any static contents hosting service.

Please feel free to suggest any changes. See our [contributing guide](https://www.chatwoot.com/docs/contributing-guide) to get started.
Please feel free to suggest any changes. See our [Contributor Guide](https://www.chatwoot.com/docs/contributing-guide) to get started.
Copy link
Author

@naveenchkrvrthy naveenchkrvrthy Jun 11, 2022

Choose a reason for hiding this comment

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

Changing the file name for consistency could align it better.

Suggested change
Please feel free to suggest any changes. See our [Contributor Guide](https://www.chatwoot.com/docs/contributing-guide) to get started.
Please feel free to suggest any changes. See our [Contributor Guide](https://www.chatwoot.com/docs/contributor-guide) to get started.

38 changes: 13 additions & 25 deletions docs/contributing-guide.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,28 @@
---
title: "Contributing Guide"
sidebar_label: "Introduction"
title: "Introduction"
Copy link
Author

Choose a reason for hiding this comment

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

Tried to align the title as in this page https://www.chatwoot.com/docs/product

help_discord: "https://discord.gg/fBMuQ7FcG6"
help_github_discussion: "https://github.com/chatwoot/chatwoot/discussions/categories/contributors"
---

This guide will help you get started with Chatwoot! Thank you for taking an interest in contributing to Chatwoot. Before submitting your contribution, please make sure to take a moment and read through the following guidelines:
Thank you for your interest in contributing to Chatwoot. Please take a moment to read through our guidelines before you contribute.

### Getting Started
1. If you've noticed something that needs to be updated, go through our existing [issues](https://github.com/chatwoot/chatwoot/issues) before you create an issue to help avoid duplicate issues.
Also, look for [good first issues](https://github.com/chatwoot/chatwoot/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+first+issue%22) that can help you get started on easier issues.

- Before starting your work, ensure an [issue](https://github.com/chatwoot/chatwoot/issues) exist for it. If not feel free to create one. You can also take a look into the issues tagged [Good first issues](https://github.com/chatwoot/chatwoot/issues?q=is%3Aopen+is%3Aissue+label%3A%22Good+first+issue%22).
- Add a comment on the issue and wait for the issue to be assigned before you start working on it.
- This helps to avoid multiple people working on similar issues.
- If the solution is complex, propose the solution on the issue and wait for one of the core contributors to approve before going into the implementation.
- This helps in shorter turn around times in merging PRs
- For new feature requests, Provide a convincing reason to add this feature. Real-life business use-cases will be super helpful.
- Feel free to join our [discord community](https://discord.gg/cJXdrwS), if you need further discussions with the core team.
2. Add a comment to the issue and wait for the issue to be assigned before you can start working on it. This helps avoid multiple people working on similar issues.

### Pull Request Guidelines
Copy link
Author

Choose a reason for hiding this comment

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

Removed this heading as it can be confused with https://www.chatwoot.com/docs/handbook/engineering/pr-guidelines. Instead I have tried to club together with the section above that tries to list the workflow from creating an issue to ending with a PR.

3. For complex solutions, propose the solution on the issue and wait for one of the core contributors to approve it before it can be implemented. This helps in shorter turnaround time in merging pull requests (PRs).

- Please make sure that you have read the [issue triage guidelines](/docs/handbook/engineering/issue-triage) before you make a contribution.
- We use [git-flow](https://nvie.com/posts/a-successful-git-branching-model/) branching model. The base branch is `develop`
- Please raise your PRs against `develop` branch
- It's okay and encouraged to have multiple small commits as you work on the PR - we will squash the commits before merging.
- For other guidelines, please refer to [PR Guidelines](/docs/handbook/engineering/pr-guidelines)
- Ensure that all the text copies that you add into the product are i18n translatable. You are only required to add the `English` version of the strings. We pull in the other language translations from our contributors on crowdin. Ref [Translation guidelines](https://www.chatwoot.com/docs/contributing-guide/translation-guidelines) to learn more.
4. Raise your PRs against the base branch `develop`. We use the [git-flow](https://nvie.com/posts/a-successful-git-branching-model/) branching model.
Multiple smaller commits are encouraged as you work on a PR as they will be squashed before merging.
- If you're resolving an issue, name the PR title as `fix: Fixes <issue-id>` and provide a detailed description of the bug in the PR. If applicable, also add appropriate test coverage.
- For new feature requests, provide a convincing reason to add them; real-life business use cases will be super helpful. Create a branch in this format: `feature/<issue-id>-<issue-name>` (for example, `feature/235-contact-panel`) and add accompanying test cases.

### Developing a new feature:
If you need to discuss further with the core team, join our [Discord community](https://discord.gg/cJXdrwS).

- Please create the branch in the format `feature/<issue-id>-<issue-name>` (eg: `feature/235-contact-panel`)
- Add accompanying test cases.
For guidelines, read [Issue triage](/docs/handbook/engineering/issue-triage) and [Pull Request Guidelines](/docs/handbook/engineering/pr-guidelines).

### Bug fixes or chores:
- If you are resolving a particular issue, add `fix: Fixes xxxx` (#xxxx is the issue) in your PR title.
- Provide a detailed description of the bug in the PR.
- Add appropriate test coverage if applicable.
Microcopy added to the product must be i18n-translatable. Only add the `English` version of the strings. We pull in the other language translations from our contributors on Crowdin. To learn more, see [Translation guidelines](https://www.chatwoot.com/docs/contributing-guide/translation-guidelines).

### Environment Setup for local development
Copy link
Author

@naveenchkrvrthy naveenchkrvrthy Jun 11, 2022

Choose a reason for hiding this comment

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

From the structure, I understand that the left pane provides navigation to topics under top menu item (ie. Contributing Guide, User Guide, etc.), and the right navigation provides navigation to in-page topics.

Based on this, I feel that we could remove the topics after this as they seem redundant here since they can be accessed from the left pane, which IMO is the logical order users will look into.


Expand Down
12 changes: 6 additions & 6 deletions docs/contributing-guide/api-documentation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: "API Documentation"
title: "API documentation"
---

Chatwoot uses [Swagger 2.0](https://swagger.io/specification/v2/) for documenting the API.
Chatwoot uses [Swagger 2.0](https://swagger.io/specification/v2/) for documenting its APIs.

### File/Directory structure
### Directory

```bash
- swagger/ ### folder in which all the API documentation is available
Expand All @@ -15,14 +15,14 @@ Chatwoot uses [Swagger 2.0](https://swagger.io/specification/v2/) for documentin
- swagger.json
```

### Build Swagger files
### Building Swagger files

A rake task is available to build `swagger.json` file after you have made changes to the swagger directory.
After you've made changes to the directory, a rake task builds the `swagger.json` file.

```bash
rake swagger:build
```

### Testing

In development mode, `http://localhost:3000/swagger` is available to test whether the API changes has been updated.
Testing can be done via `http://localhost:3000/swagger` in the development mode to check if changes have been updated.
48 changes: 22 additions & 26 deletions docs/contributing-guide/common-errors.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
---
title: "Common Errors"
title: "Common errors"
---

The following are some of the errors you might encounter while setting up the project.
You may encounter the following errors while setting up the project.

- **Redis connection error**: The following error is thrown from the Redis connector if the Redis environment variables are not set up properly.

### Redis connection error
```bash
ArgumentError: invalid uri scheme
```

```bash
ArgumentError: invalid uri scheme
```
To fix, install the Redis-server for your respective environment and [configure Redis URL](/self-hosted/configuration/environment-variables#configure-redis).

This is an error thrown from redis connector. You might not have setup the redis environment variables properly. Please refer to dependencies section to install redis-server and [Configure Redis URL](https://www.chatwoot.com/docs/environment-variables) in the environment-variables section.
- **pg gem installation error**: This error is thrown during bundle installation.

```
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

### pg gem Installation error
An error occurred while installing pg (x.x.x), and Bundler cannot
continue.
Make sure that `gem install pg -v 'x.x.x' --source 'https://rubygems.org/'`
succeeds before bundling.

If you see the following error while bundle installation, provide the Postgres path as pg_config.
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
```

```
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
To fix, provide the Postgres path as pg_config.

An error occurred while installing pg (x.x.x), and Bundler cannot
continue.
Make sure that `gem install pg -v 'x.x.x' --source 'https://rubygems.org/'`
succeeds before bundling.

checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
```

To fix this, try executing

```
gem install pg -v 'x.x.x' --source 'https://rubygems.org/' -- --with-pg-config=path-to-postgres-installation/12/bin/pg_config
```
```
gem install pg -v 'x.x.x' --source 'https://rubygems.org/' -- --with-pg-config=path-to-postgres-installation/12/bin/pg_config
```
100 changes: 48 additions & 52 deletions docs/contributing-guide/environment-setup/docker.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
sidebar_label: "Docker"
title: "Docker Setup"
title: "Docker setup"
---

### Pre-requisites
:::note

Before proceeding, make sure you have the latest version of `docker` and `docker-compose` installed.

As of now[at the time of writing this doc], we recommend a version equal to or higher than the following.
You must have the latest version of `docker` and `docker-compose` installed. We recommend a version equal to or higher than the following:

```bash
$ docker --version
Expand All @@ -16,75 +14,79 @@ $ docker-compose --version
docker-compose version 1.29.2, build 5becea4c
```

:::

## Development environment

1. Clone the repository.

```bash
git clone https://github.com/chatwoot/chatwoot.git
```
```bash
git clone https://github.com/chatwoot/chatwoot.git
```

2. Make a copy of the example environment file and modify it as [required](/docs/self-hosted/configuration/environment-variables).
2. Copy the example environment file and modify it as [required](/docs/self-hosted/configuration/environment-variables).

```bash
cp .env.example .env
# update redis and postgres passwords
nano .env
# update docker-compose.yml with the same postgres password
nano docker-compose.yml
```bash
cp .env.example .env
# update redis and postgres passwords
nano .env
# update docker-compose.yml with the same postgres password
nano docker-compose.yml
```

3. Build the images.

```bash
docker-compose build
```
```bash
docker-compose build
```

4. After building the image or destroying the stack, you would have to reset the database using the following command.
4. After building the image or destroying the stack, reset the database.

```bash
docker-compose run --rm rails bundle exec rails db:chatwoot_prepare
```
```bash
docker-compose run --rm rails bundle exec rails db:chatwoot_prepare
```

5. To run the app,
5. Run the app.

```bash
docker-compose up
```
```bash
docker-compose up
```

* Access the rails app frontend by visiting `http://0.0.0.0:3000/`
* Access Mailhog inbox by visiting `http://0.0.0.0:8025/` (You will receive all emails going out of the application here)
- Access Rails app frontend by visiting `http://0.0.0.0:3000/`.
- Access Mailhog inbox by visiting `http://0.0.0.0:8025/`.
_(All emails going out of the application will be received here.)_

#### Login with credentials
```
url: http://localhost:3000
user_name: [email protected]
password: Password1!
````
6. Log in with your credentials.

```
url: http://localhost:3000
user_name: [email protected]
password: Password1!
```

6. To stop the app,
To stop the app, run the following command:

```bash
docker-compose down
```

### Running RSpec tests

For running the complete RSpec tests,
- To run the complete RSpec tests, run:

```bash
docker-compose run --rm rails bundle exec rspec
```
```bash
docker-compose run --rm rails bundle exec rspec
```

For running specific test,
- To run a specific test, run:

```bash
docker-compose run --rm rails bundle exec rspec spec/<path-to-file>:<line-number>
```
```bash
docker-compose run --rm rails bundle exec rspec spec/<path-to-file>:<line-number>
```

## Production environment

To debug the production build locally, set `SECRET_KEY_BASE` environment variable in your `.env` file and then run the below commands:
To debug the production build locally, set the `SECRET_KEY_BASE` environment variable in your `.env` file and then run:

```bash
docker-compose -f docker-compose.production.yaml build
Expand All @@ -93,21 +95,15 @@ docker-compose -f docker-compose.production.yaml up

## Debugging mode

To use debuggers like `byebug` or `binding.pry`, use the following command to bring up the app instead of `docker-compose up`.
To use debuggers like `byebug` or `binding.pry`, run the following command to bring up the app instead of `docker-compose up`:

```bash
docker-compose run --rm --service-port rails
```


## Troubleshooting
If there is an update to any of the following
- `dockerfile`
- `gemfile`
- `package.json`
- schema change

Make sure to rebuild the containers and run `db:reset`.
If there is an update to `dockerfile`, `gemfile`, `package.json`, or a schema, rebuild the containers and run `db:reset`.

```bash
docker-compose down
Expand Down
Loading