Improve docker compose performance (#347)   🤩

* Fix warning Integrity check: System parameters don't match

* Reduce commands required to use docker-compose and update quick-setup doc

Data will still persist when stopping and restarting containers.
To destroy the data can use docker-compose down --volumes

* Moved webpacker-dev-server to its own service

* cache bundle and yarn - improve volume performance - env conditional statements

* Fix inconsistent build results found during testing
This commit is contained in:
petebytes
2019-12-05 04:12:46 -07:00
committed by Sony Mathew
parent 3a1c0aef07
commit 3f403c9e7a
6 changed files with 88 additions and 37 deletions

View File

@@ -42,40 +42,45 @@ password: 123456
### Docker for development
If you are using docker for the development follow the following steps.
We are running postgres and redis services along with chatwoot server using docker-compose.
Create a volume for postgres and redis so that you data will persist even if the containers goes down.
The first time you start your development environment run the following two commands:
```bash
docker volume create --name=postgres
docker volume create --name=redis
# build and start the services
docker-compose up --build
# prepare the database
docker-compose exec server bundle exec rails db:prepare
```
Then browse http://localhost:3000
```bash
# To stop your environment use Control+C (on Mac) CTRL+C (on Win) or
docker-compose down
# start the services
docker-compose up
```
When you change the services Dockerfile or the contents of the build directory, run stop then build. (For example after modifying package.json or Gemfile)
```bash
docker-compose stop
docker-compose build
```
Remove the `node_modules` directory from the root if it exists and run the following command.
```bash
docker-compose run server yarn install
```
The docker-compose environment consists of:
- chatwoot server
- postgres
- redis
- webpacker-dev-server
If in case you encounter a seeding issue or you want reset the database you can do it using the following command :
```bash
docker-compose run server bundle exec rake db:reset
docker-compose run -rm server bundle exec rake db:reset
```
This command essentially runs postgres and redis containers and then run the rake command inside the chatwoot server container.
Now you should be able to run :
```bash
docker-compose up
```
to see the application up and running.
### Docker for production
You can use our official Docker image from [https://hub.docker.com/r/chatwoot/chatwoot](https://hub.docker.com/r/chatwoot/chatwoot)