From 10169aab0cf9b567799bca36c28ae2d2529068f3 Mon Sep 17 00:00:00 2001 From: jpfleischer Date: Tue, 15 Oct 2024 21:11:40 -0400 Subject: [PATCH 1/5] Change internal container ports and update documentation --- README.md | 27 ++++++++++++++------------- docker-compose.dev.yml | 2 +- docker-compose.yml | 2 +- frontend/Dockerfile | 7 +++++-- frontend/docker/Dockerfile.dev | 7 +++++-- viz_scripts/Dockerfile | 4 +++- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index c2934257..9febe49c 100644 --- a/README.md +++ b/README.md @@ -19,33 +19,26 @@ Creating em-public-dashboard_dashboard_1 ... done ... dashboard_1 | Starting up http-server, serving ./ dashboard_1 | Available on: -dashboard_1 | http://127.0.0.1:8080 -dashboard_1 | http://172.25.0.3:8080 +dashboard_1 | http://127.0.0.1:3274 +dashboard_1 | http://172.25.0.3:3274 dashboard_1 | Hit CTRL-C to stop the server ... notebook-server_1 | notebook-server_1 | To access the notebook, open this file in a browser: notebook-server_1 | file:///root/.local/share/jupyter/runtime/nbserver-22-open.html notebook-server_1 | Or copy and paste one of these URLs: -notebook-server_1 | http://f8317197efaf:8888/?token=5cfd541b7461a47310c9c8aaa4114f921457a6f17b8ca159 -notebook-server_1 | or http://127.0.0.1:8888/?token=5cfd541b7461a47310c9c8aaa4114f921457a6f17b8ca159 +notebook-server_1 | http://f8317197efaf:47962/?token=5cfd541b7461a47310c9c8aaa4114f921457a6f17b8ca159 +notebook-server_1 | or http://127.0.0.1:47962/?token=5cfd541b7461a47310c9c8aaa4114f921457a6f17b8ca159 ... ``` #### Test the frontend install -Go to http://localhost:3274/ to see the front-end. Note that the port is *3274* -instead of the *8080* in the logs, since we remap it as part of the docker-compose. +Go to http://localhost:3274/ to see the front-end. #### Test the notebook install -Use the notebook URL from the console but change `8888` to `47962` - -``` -http://127.0.0.1:8888/?token= -``` - -becomes +Use the notebook URL from the console: ``` http://127.0.0.1:47962/?token= @@ -76,6 +69,14 @@ Note that this expects a standard setup with: When working with `docker compose`, it's generally recommended to avoid committing changes to the `docker-compose.dev.yml` file, especially if you're running the `./load_mongodump ` script. This file is typically configured to work in a specific way for your development environment, and changes might not be applicable or useful for others working on the same project. +If you feel the need to adjust the Dockerfiles or any scripts pertaining to the containers, you must rebuild the images with: + +```bash +docker-compose -f docker-compose.dev.yml build +``` + +Otherwise, your edits will not have any effect. + ### `.gitignore` Configuration To streamline your workflow, we have added the `docker-compose.dev.yml` file to the `.gitignore` file. This means that by default, changes to `docker-compose.dev.yml` will not be tracked by Git. This setup helps to avoid unnecessary commits and ensures that your `docker-compose.dev.yml` remains consistent with the intended configuration for the project. diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 560f6d99..e433d470 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -9,7 +9,7 @@ services: - db ports: # DASH in numbers - - "3274:6060" + - "3274:3274" volumes: - ./frontend:/public - ./plots:/public/plots diff --git a/docker-compose.yml b/docker-compose.yml index c3058476..ba912c5e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: - db ports: # DASH in numbers - - "3274:6060" + - "3274:3274" volumes: - ./plots:/public/plots networks: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 2992bc5a..2aaf4ac5 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -9,5 +9,8 @@ RUN npm i -g http-server COPY client /public/client COPY *.html /public/ -EXPOSE 6060 -CMD ["http-server", "-p", "6060"] +# expose directive does not do anything, but for documentation purposes, +# the port 3274 is mapped in the docker-compose.yml. +EXPOSE 3274 + +CMD ["http-server", "-p", "3274"] diff --git a/frontend/docker/Dockerfile.dev b/frontend/docker/Dockerfile.dev index fce76232..59e73fee 100644 --- a/frontend/docker/Dockerfile.dev +++ b/frontend/docker/Dockerfile.dev @@ -5,5 +5,8 @@ WORKDIR /public RUN npm i -g http-server -EXPOSE 6060 -CMD ["http-server", "-p", "6060"] +# expose directive does not do anything, but for documentation purposes, +# the port 3274 is mapped in the docker-compose.yml. +EXPOSE 3274 + +CMD ["http-server", "-p", "3274"] diff --git a/viz_scripts/Dockerfile b/viz_scripts/Dockerfile index 195a6f22..7606cf3f 100644 --- a/viz_scripts/Dockerfile +++ b/viz_scripts/Dockerfile @@ -35,6 +35,8 @@ RUN chmod u+x /usr/src/app/.docker/start_notebook.sh ADD docker/crontab /usr/src/app/crontab -EXPOSE 8888 +# expose directive does not do anything, but for documentation purposes, +# the port 47962 is mapped in the docker-compose.yml. +EXPOSE 47962 CMD ["/bin/bash", "/usr/src/app/.docker/start_notebook.sh"] From 6d6ab2593fe3ab5c3170b1d7f8b2e24954787e15 Mon Sep 17 00:00:00 2001 From: jpfleischer Date: Fri, 18 Oct 2024 17:06:17 -0400 Subject: [PATCH 2/5] Add build command to README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9febe49c..7e7d57ed 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ So the steps are: #### Launch dev environment ``` -$ docker-compose -f docker-compose.dev.yml up +$ docker-compose -f docker-compose.dev.yml build +$ docker-compose -f docker-compose.dev.yml up Creating network "em-public-dashboard_emission" with the default driver Creating em-public-dashboard_db_1 ... done Creating em-public-dashboard_plot-gen_1 ... done From 4fb71cb7c52e702b5bc7ecdefc0d9ec4bc19c64f Mon Sep 17 00:00:00 2001 From: jpfleischer Date: Fri, 18 Oct 2024 23:51:45 -0400 Subject: [PATCH 3/5] Add rebuild Docker clarification --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7e7d57ed..a8a56753 100644 --- a/README.md +++ b/README.md @@ -70,13 +70,13 @@ Note that this expects a standard setup with: When working with `docker compose`, it's generally recommended to avoid committing changes to the `docker-compose.dev.yml` file, especially if you're running the `./load_mongodump ` script. This file is typically configured to work in a specific way for your development environment, and changes might not be applicable or useful for others working on the same project. -If you feel the need to adjust the Dockerfiles or any scripts pertaining to the containers, you must rebuild the images with: +If you feel the need to adjust the Dockerfiles or any scripts pertaining to the production containers, you must rebuild the images with: ```bash -docker-compose -f docker-compose.dev.yml build +docker-compose -f docker-compose.yml build ``` -Otherwise, your edits will not have any effect. +Otherwise, your edits will not have any effect. This is not needed for the dev version. ### `.gitignore` Configuration From b7d0cbf49fb0170e52c723b66df0cee7df4ee365 Mon Sep 17 00:00:00 2001 From: jpfleischer Date: Fri, 18 Oct 2024 23:53:15 -0400 Subject: [PATCH 4/5] Remove unnecessary dev build comment --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index a8a56753..53606bc8 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ So the steps are: #### Launch dev environment ``` -$ docker-compose -f docker-compose.dev.yml build $ docker-compose -f docker-compose.dev.yml up Creating network "em-public-dashboard_emission" with the default driver Creating em-public-dashboard_db_1 ... done From b04ffc593e700838f4175b95bef999e245145e3f Mon Sep 17 00:00:00 2001 From: "J.P." Date: Sun, 5 Jan 2025 00:02:27 -0500 Subject: [PATCH 5/5] Disable printing of url with inaccessible docker hostname for notebook server --- viz_scripts/docker/start_notebook.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/viz_scripts/docker/start_notebook.sh b/viz_scripts/docker/start_notebook.sh index e0deb7e7..4bbb171c 100755 --- a/viz_scripts/docker/start_notebook.sh +++ b/viz_scripts/docker/start_notebook.sh @@ -29,8 +29,8 @@ cd saved-notebooks # launch the notebook server # tail -f /dev/null if [ -z ${CRON_MODE} ] ; then - echo "Running notebook in docker, change host:port to localhost:47962 in the URL below" - PYTHONPATH=/usr/src/app jupyter notebook --no-browser --ip=0.0.0.0 --port=47962 --allow-root + echo "Running notebook in docker..." + PYTHONPATH=/usr/src/app jupyter notebook --no-browser --ip=0.0.0.0 --port=47962 --NotebookApp.custom_display_url=localhost:47962 --allow-root else echo "Running crontab without user interaction, setting python path" export PYTHONPATH=/usr/src/app