|
| 1 | +# Dockerized-NorLab project application (DNA) |
| 2 | +Reference: https://github.com/norlab-ulaval/dockerized-norlab-project.git |
| 3 | + |
| 4 | +## Usage |
| 5 | + |
| 6 | +1. Setup/validate `.dockerized_norlab/configuration/` files: |
| 7 | + - Setup dotenv files: `.env`, `.env.dna` and `.env.local`; |
| 8 | + - Customize files in `project_requirements/`; |
| 9 | + - Customize files in `project_entrypoints/`. Add |
| 10 | + project-specific container runtime logic; |
| 11 | + - Customize `Dockerfile` to fit your need. It should work out of the box for most use cases; |
| 12 | + - Check `.dockerized_norlab/configuration/README.md` for more details. |
| 13 | +2. From your project `root`, execute the following |
| 14 | + ```shell |
| 15 | + dna help |
| 16 | + |
| 17 | + # Build your DN-project containers |
| 18 | + dna build |
| 19 | + |
| 20 | + # Start your DN-project containers |
| 21 | + dna up |
| 22 | + |
| 23 | + # Have fun |
| 24 | + # When your done, execute |
| 25 | + dna down |
| 26 | + ``` |
| 27 | + |
| 28 | +## Requirements: |
| 29 | + |
| 30 | +- dependencies: |
| 31 | + - [Docker](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository) with |
| 32 | + `docker-buildx-plugin` and `docker-compose-plugin` |
| 33 | + - [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) for GPU usage |
| 34 | +- The directory `.dockerized_norlab` need to be at the super-project repository root |
| 35 | + |
| 36 | +# Setup PyCharm IDE |
| 37 | + |
| 38 | +### Remote development |
| 39 | +- To work in a docker container on a remote machine, setup a remote developement configuration pointing to `<remote-machine-user>@<target-host-IP>:<remote-machine-ssh-port>` e.g.: `redleader@192.168.0.103:22`. |
| 40 | +- Set `rsync` ON and sudo OFF |
| 41 | +- Make sure `rsync` DO copy the `.git` directory to the remote host i.e. check if it is in the rsync excluded item list |
| 42 | +- **Remote display**: |
| 43 | + - Start your DN container project using command `dna up` or `dna run` |
| 44 | + - In the remote docker container terminal, execute command alias `dn_expose_container_env_variables` and download `.dockerized_norlab/dn_container_env_variable/.env.dn_expose_PLACEHOLDER_DN_CONTAINER_NAME` to your source machine |
| 45 | + and set `Paths to ".env" files` in run configuration window |
| 46 | +  |
| 47 | + |
| 48 | +#### Rsync to remote machine |
| 49 | +- If you encounter rsync error such as the infamous `exit code 23`, check file/dir permission and group by executing `tree -aug <path/to/remote/project/dir>` and update them if needed by executing `sudo chown -R $(id -un):$(id -gn) <path/to/remote/project/dir>`. |
| 50 | + |
| 51 | +### Python interpreter |
| 52 | +- Set up a ssh remote python interpreter pointing to `<dockerized-norlab-ssh-user>@<target-host-IP>:<dockerized-norlab-container-ssh-port>` e.g.: `pycharm-debugger@192.168.0.103:2222`. Note: use `localhost` explicitly if the container is running on your local machine i.e.: `pycharm-debugger@localhost:2222` |
| 53 | +- Remote python interpreter, i.e. `<user-name>@<remote-ip-adress>:2222`: |
| 54 | + - ⚠️ Uncheck `Execute code with root privileges` otherwise experimental data writen to disk will be owned by `root` instead of `PLACEHOLDER_SUPER_PROJECT_USER` |
| 55 | + - ⚠️ Uncheck `Automatically upload project files`. The project is mounted as a docker volume for develop images and is copied at build stage for deploy images. |
| 56 | + - Set path mapping to `/ros2_ws/src/PLACEHOLDER_SUPER_PROJECT_NAME` or delete the `Sync folders` entry. |
| 57 | +  |
| 58 | +- Don't forget to add `/opt/ros/<distro>/lib/python<version>/site-packages` to the _Interpreter |
| 59 | + path_ once the docker based ssh interpreter is configured, |
| 60 | + e.g.: `/opt/ros/foxy/lib/python3.8/site-packages` |
| 61 | + |
| 62 | +  |
| 63 | +  |
| 64 | + |
| 65 | +### Run/debug configuration |
| 66 | + |
| 67 | +- Don't forget to set run/debug configuration `path mapping` to: `~/PycharmProjects/PLACEHOLDER_SUPER_PROJECT_NAME` -> `/ros2_ws/src/PLACEHOLDER_SUPER_PROJECT_NAME`. It's critical for debug breakpoint remote/local resolution to work in regular/pytest run, regular/pytest debug and for IDE debug stacktrace remote/local code resolution for jumping to source code from stacktrace link. |
| 68 | +  |
0 commit comments