-
Create an environment and install the required dependencies:
conda create -n plotly-web-app python=3.8 -y conda activate plotly-web-app pip install -r requirements.txt pip install -e .
-
Local test of the app:
Dash uses Flask as the web framework. The underlying Flask app is available atapp.server
export FLASK_APP=app:server flask run
-
Speed up the app
You have probably noticed that figures do not update instantly when you change some parameters. Instead of splitting the data, calculating the roc-auc scores, generating and plotting the new figures for every change in the data splitting parameters, we can generate, dump and load all possible figures and roc-auc scores.Generate the content by executing:
python create_content.py
This content is used in
app_2.py
:export FLASK_APP=app_2:server flask run
- In
web-app
->Configuration
->General settings
set the startup command togunicorn -b 0.0.0.0 app_2:server
or togunicorn -b 0.0.0.0 app:server
depending on what you want to run.
- Create a
app.yaml
that contains info about the runtime and about the entrypoint. Then use the gcloud cli:gcloud init # go into the right project gcloud app deploy ./app.yaml -Y
- Build the image:
In case you want to deploy the app somewhere else:Launch a container to test the app:docker build -t plotly_app:1.0 . --build-arg runtime_path="."
If everything is fine, add the image to the dockerhub container registry:docker run --rm --name dash_app -d -p 80:80 plotly_app:1.0
docker login -u "$DOCKER_HUB_USR" \ -p "$DOCKER_HUB_PWD" docker tag plotly_app:1.0 "${DOCKER_HUB_USR}"/plotly_app:1.0 docker push "${DOCKER_HUB_USR}"/plotly_app:1.0
- Setup a ubuntu machine to run the docker container:
chmod +x vm_docker_setup.sh ./vm_docker_setup.sh