From 9c7d8bb60dda5e77337d36cddd10dd9e501156bd Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Mon, 23 Dec 2019 11:56:25 +0530 Subject: [PATCH] [Docs] Update docker documentation (#377) --- README.md | 2 +- docs/development/environment-setup/docker.md | 23 ++++++++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9c0184c02..0faaeb341 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ docker pull chatwoot/chatwoot Follow our [environment variables](https://www.chatwoot.com/docs/environment-variables/) guide to setup environment for Docker. -Follow our [docker development guide](docker/README.md) to develop and debug the application using docker composer. +Follow our [docker development guide](docs/development/environment-setup/docker.md) to develop and debug the application using docker composer. ## Contributors ✨ diff --git a/docs/development/environment-setup/docker.md b/docs/development/environment-setup/docker.md index c31a5db81..20e4cf3e6 100644 --- a/docs/development/environment-setup/docker.md +++ b/docs/development/environment-setup/docker.md @@ -7,35 +7,33 @@ title: "Docker Setup and Debugging Guide" ## development environment +After cloning the repo and installing docker on your machine, run the following command from the root directory of the project. + ``` docker-compose build ``` -After building the image or each time after destroying the stack you would have to create and migrate the database before you can start the rails server or run rspec tests. +After building the image or after destroying the stack you would have to reset the database using following command ``` -docker-compose run rails bundle exec rails db:create db:migrate db:seed +docker-compose run rails bundle exec rails db:reset ``` -### Running the rails app in debug mode (pry and byebug works) +### Running the app ``` docker-compose run --service-port rails ``` -* Access the rails app frontend by visiting `http://0.0.0.0:3000/` (You can access the website over http for debugging using pry and Byebug here) - +* 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) -### Running the complete stack in non-debug mode +you can also use the below command instead to run the app and see the full logs. ``` docker-compose up ``` -* Access the rails app frontend by visiting `http://0.0.0.0:3000/` (This is web only, you cannot debug using docker-compose up) -* Access Mailhog inbox by visiting `http://0.0.0.0:8025/` (You will receive all emails going out of the application here) - ### Destroying the complete composer stack ``` @@ -58,12 +56,9 @@ docker-compose run rails bundle exec rspec spec/: ## production environment +Sometimes you might want to debug the production build locally. You would first need to set `SECRET_KEY_BASE` environment variable in your .env.example file and then run the below commands: + ``` docker-compose -f docker-compose.production.yaml build -``` - -If you want to test the production build locally you would first need to set `SECRET_KEY_BASE` environment variable in your .env.example file and then run the below command: - -``` docker-compose -f docker-compose.production.yaml up ``` \ No newline at end of file