Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change internal container ports 2.0 #181

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,34 @@ So the steps are:
#### Launch dev environment

```
$ docker-compose -f docker-compose.dev.yml up
$ 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
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=<token>
```

becomes
Use the notebook URL from the console:

```
http://127.0.0.1:47962/?token=<token>
Expand Down Expand Up @@ -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 <dump tar>` 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 production containers, you must rebuild the images with:

```bash
docker-compose -f docker-compose.yml build
```

Otherwise, your edits will not have any effect. This is not needed for the dev version.

### `.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.
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- db
ports:
# DASH in numbers
- "3274:6060"
- "3274:3274"
volumes:
- ./frontend:/public
- ./plots:/public/plots
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- db
ports:
# DASH in numbers
- "3274:6060"
- "3274:3274"
volumes:
- ./plots:/public/plots
networks:
Expand Down
7 changes: 5 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
7 changes: 5 additions & 2 deletions frontend/docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 3 additions & 1 deletion viz_scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 2 additions & 2 deletions viz_scripts/docker/start_notebook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down