From a7878cd1fdfd5386bca888d2c689c2a39c91c0a4 Mon Sep 17 00:00:00 2001 From: Nicholas Kwon Date: Sat, 4 Jun 2022 15:28:14 -0700 Subject: [PATCH 1/6] update hot reloading instructions --- server/dash/dashboards/README.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/server/dash/dashboards/README.md b/server/dash/dashboards/README.md index ecefb3cea..a40b02d08 100644 --- a/server/dash/dashboards/README.md +++ b/server/dash/dashboards/README.md @@ -10,6 +10,7 @@ Feel free to use your own preferred environment or follow this process: - Download and install [Visual Studio Code](https://code.visualstudio.com/download) - Download and install [Docker Desktop](https://docs.docker.com/desktop/) - Download and install [GitHub Desktop](https://desktop.github.com/) +- Make sure that you are running Python 3.7 (run `python --version` in your terminal to check) - Fork the [311-data repository](https://github.com/hackforla/311-data.git) - Clone the [311-data repository](https://github.com/hackforla/311-data.git) using GitHub Desktop - Open the repo in VS Code @@ -17,25 +18,21 @@ Feel free to use your own preferred environment or follow this process: ### Editing a dashboard locally -The best way to develop new dashboards is by using the development Dash image and mounting a local directory on it. This method requires the least amount of configuration so you can spend your time working on dashboards. - -These instructions assume you already have Docker installed and are on a Mac but should be easily transferrable to PC or Linux. - ```zsh -# first make sure you're in the dash directory +# First make sure you're in the dash directory. cd server/dash -# get the latest development version of the dash image -docker pull la311data/dash-poc:dev +# Install the requirements. +pip install -r requirements.txt -# run the dash container with a local volume -docker run -p 5500:5500 -v "$(pwd)":/app -e PRELOAD=False la311data/dash-poc +# Run the server. +gunicorn --bind 0.0.0.0:5500 --timeout 300 --workers 2 index:server --reload -# view a dashboard in your browser +# View a dashboard in your browser. open http://localhost:5500/dashboards/overview -# to test the mount is working change the title property in this dashboard and reload (JUST REMEMBER TO REVERT YOUR CHANGE!) -# when you are done just enter Ctl+C in your terminal to stop the server +# To view your changes, edit a file and save it. The server will log something like "Worker reloading: modified." +# Wait until it says "Report Server ready" again, and then you can refresh the dash webpage and see your changes. ``` When you have the dashboard completed, you should follow the standard Git workflow of committing, pushing, and issuing a pull request. Note that there are several pre-commit hooks that will run before you can merge. Once your PR is accepted, your changes will automatically be merged to dev and a new Dash Docker image will be published. From 8a761e59042bad4d5eaa2367309a0ab95cc770d1 Mon Sep 17 00:00:00 2001 From: Nicholas Kwon Date: Sat, 4 Jun 2022 15:30:38 -0700 Subject: [PATCH 2/6] fix spacing --- server/dash/dashboards/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/dash/dashboards/README.md b/server/dash/dashboards/README.md index a40b02d08..5bdbaec00 100644 --- a/server/dash/dashboards/README.md +++ b/server/dash/dashboards/README.md @@ -31,8 +31,10 @@ gunicorn --bind 0.0.0.0:5500 --timeout 300 --workers 2 index:server --reload # View a dashboard in your browser. open http://localhost:5500/dashboards/overview -# To view your changes, edit a file and save it. The server will log something like "Worker reloading: modified." -# Wait until it says "Report Server ready" again, and then you can refresh the dash webpage and see your changes. +# To view your changes, edit a file and save it. +# The server will log something like "Worker reloading: modified." +# Wait until it says "Report Server ready" again, and +# then you can refresh the dash webpage and see your changes. ``` When you have the dashboard completed, you should follow the standard Git workflow of committing, pushing, and issuing a pull request. Note that there are several pre-commit hooks that will run before you can merge. Once your PR is accepted, your changes will automatically be merged to dev and a new Dash Docker image will be published. From 160ab142e4f52af0b8672b01dd129c1a535c2bc9 Mon Sep 17 00:00:00 2001 From: Nicholas Kwon Date: Mon, 6 Jun 2022 12:19:00 -0700 Subject: [PATCH 3/6] Revert "fix spacing" This reverts commit 8a761e59042bad4d5eaa2367309a0ab95cc770d1. --- server/dash/dashboards/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/dash/dashboards/README.md b/server/dash/dashboards/README.md index 5bdbaec00..a40b02d08 100644 --- a/server/dash/dashboards/README.md +++ b/server/dash/dashboards/README.md @@ -31,10 +31,8 @@ gunicorn --bind 0.0.0.0:5500 --timeout 300 --workers 2 index:server --reload # View a dashboard in your browser. open http://localhost:5500/dashboards/overview -# To view your changes, edit a file and save it. -# The server will log something like "Worker reloading: modified." -# Wait until it says "Report Server ready" again, and -# then you can refresh the dash webpage and see your changes. +# To view your changes, edit a file and save it. The server will log something like "Worker reloading: modified." +# Wait until it says "Report Server ready" again, and then you can refresh the dash webpage and see your changes. ``` When you have the dashboard completed, you should follow the standard Git workflow of committing, pushing, and issuing a pull request. Note that there are several pre-commit hooks that will run before you can merge. Once your PR is accepted, your changes will automatically be merged to dev and a new Dash Docker image will be published. From 1cb6a4dabdf63d59a88dd74f747c40a429a04639 Mon Sep 17 00:00:00 2001 From: Nicholas Kwon Date: Mon, 6 Jun 2022 12:19:29 -0700 Subject: [PATCH 4/6] Revert "update hot reloading instructions" This reverts commit a7878cd1fdfd5386bca888d2c689c2a39c91c0a4. --- server/dash/dashboards/README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/server/dash/dashboards/README.md b/server/dash/dashboards/README.md index a40b02d08..ecefb3cea 100644 --- a/server/dash/dashboards/README.md +++ b/server/dash/dashboards/README.md @@ -10,7 +10,6 @@ Feel free to use your own preferred environment or follow this process: - Download and install [Visual Studio Code](https://code.visualstudio.com/download) - Download and install [Docker Desktop](https://docs.docker.com/desktop/) - Download and install [GitHub Desktop](https://desktop.github.com/) -- Make sure that you are running Python 3.7 (run `python --version` in your terminal to check) - Fork the [311-data repository](https://github.com/hackforla/311-data.git) - Clone the [311-data repository](https://github.com/hackforla/311-data.git) using GitHub Desktop - Open the repo in VS Code @@ -18,21 +17,25 @@ Feel free to use your own preferred environment or follow this process: ### Editing a dashboard locally +The best way to develop new dashboards is by using the development Dash image and mounting a local directory on it. This method requires the least amount of configuration so you can spend your time working on dashboards. + +These instructions assume you already have Docker installed and are on a Mac but should be easily transferrable to PC or Linux. + ```zsh -# First make sure you're in the dash directory. +# first make sure you're in the dash directory cd server/dash -# Install the requirements. -pip install -r requirements.txt +# get the latest development version of the dash image +docker pull la311data/dash-poc:dev -# Run the server. -gunicorn --bind 0.0.0.0:5500 --timeout 300 --workers 2 index:server --reload +# run the dash container with a local volume +docker run -p 5500:5500 -v "$(pwd)":/app -e PRELOAD=False la311data/dash-poc -# View a dashboard in your browser. +# view a dashboard in your browser open http://localhost:5500/dashboards/overview -# To view your changes, edit a file and save it. The server will log something like "Worker reloading: modified." -# Wait until it says "Report Server ready" again, and then you can refresh the dash webpage and see your changes. +# to test the mount is working change the title property in this dashboard and reload (JUST REMEMBER TO REVERT YOUR CHANGE!) +# when you are done just enter Ctl+C in your terminal to stop the server ``` When you have the dashboard completed, you should follow the standard Git workflow of committing, pushing, and issuing a pull request. Note that there are several pre-commit hooks that will run before you can merge. Once your PR is accepted, your changes will automatically be merged to dev and a new Dash Docker image will be published. From 4faa228b40542d5352f143bd4df8ae2aff191232 Mon Sep 17 00:00:00 2001 From: Nicholas Kwon Date: Mon, 6 Jun 2022 12:21:26 -0700 Subject: [PATCH 5/6] use docker with gunicorn reloading --- server/dash/dashboards/README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/dash/dashboards/README.md b/server/dash/dashboards/README.md index ecefb3cea..e183be3ac 100644 --- a/server/dash/dashboards/README.md +++ b/server/dash/dashboards/README.md @@ -22,20 +22,22 @@ The best way to develop new dashboards is by using the development Dash image an These instructions assume you already have Docker installed and are on a Mac but should be easily transferrable to PC or Linux. ```zsh -# first make sure you're in the dash directory +# First make sure you're in the dash directory. cd server/dash -# get the latest development version of the dash image +# Get the latest development version of the dash image. docker pull la311data/dash-poc:dev -# run the dash container with a local volume -docker run -p 5500:5500 -v "$(pwd)":/app -e PRELOAD=False la311data/dash-poc +# Run the dash container with a local volume and a custom command that enables reloading in gunicorn. +docker run -p 5500:5500 -v "$(pwd)":/app -e PRELOAD=False la311data/dash-poc gunicorn --bind 0.0.0.0:5500 --timeout 300 --workers 2 index:server --reload -# view a dashboard in your browser +# View a dashboard in your browser. open http://localhost:5500/dashboards/overview -# to test the mount is working change the title property in this dashboard and reload (JUST REMEMBER TO REVERT YOUR CHANGE!) -# when you are done just enter Ctl+C in your terminal to stop the server +# To view your changes, edit a file and save it. +# The server will log something like "Worker reloading: modified." +# Wait until it says "Report Server ready" again, and +# then you can refresh the dash webpage and see your changes. ``` When you have the dashboard completed, you should follow the standard Git workflow of committing, pushing, and issuing a pull request. Note that there are several pre-commit hooks that will run before you can merge. Once your PR is accepted, your changes will automatically be merged to dev and a new Dash Docker image will be published. From 8da91d7440d1c96c8027b554b7bdfebdfbb6f318 Mon Sep 17 00:00:00 2001 From: Nicholas Kwon Date: Tue, 7 Jun 2022 18:49:09 -0700 Subject: [PATCH 6/6] update quotes --- server/dash/dashboards/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/dash/dashboards/README.md b/server/dash/dashboards/README.md index e183be3ac..cabe04280 100644 --- a/server/dash/dashboards/README.md +++ b/server/dash/dashboards/README.md @@ -29,7 +29,7 @@ cd server/dash docker pull la311data/dash-poc:dev # Run the dash container with a local volume and a custom command that enables reloading in gunicorn. -docker run -p 5500:5500 -v "$(pwd)":/app -e PRELOAD=False la311data/dash-poc gunicorn --bind 0.0.0.0:5500 --timeout 300 --workers 2 index:server --reload +docker run -p 5500:5500 -v "$(pwd):/app" -e PRELOAD=False la311data/dash-poc gunicorn --bind 0.0.0.0:5500 --timeout 300 --workers 2 index:server --reload # View a dashboard in your browser. open http://localhost:5500/dashboards/overview