Skip to content

Commit

Permalink
extensions: WIP accessing and modifying a running Extension container
Browse files Browse the repository at this point in the history
  • Loading branch information
ES-Alexander committed Apr 11, 2024
1 parent 372f48e commit fcd6f4f
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions development/extensions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Each Extension service with a `register_service` endpoint will have an entry in

Different types of Extensions have different functionality, and there are often a variety of tools available to provide that. When starting to develop extensions, we would generally recommend:
- Python to run stuff
- Frequently using a web framework like Starlite/Flask/FastAPI to provide the backend of an interface
- Frequently using a web framework like Litestar/Flask/FastAPI to provide the backend of an interface
- Static HTML files to contain and display parts of an interface
- Our [Extensions Examples Repository](https://github.com/BlueOS-Community/BlueOS-examples) has some useful examples

Expand Down Expand Up @@ -397,7 +397,7 @@ QuickStart repositories serve as a way to get an example Extension up and runnin
- The name should be something like `blueos-extension-image-name` (e.g. `blueos-quickstart`)
3. Set up [GitHub Secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository):
- `DOCKER_USERNAME`: your Docker Hub username
- `DOCKER_PASSWORD`: a Read & Write [access token](https://docs.docker.com/security/for-developers/access-tokens/), to provide upload permissions from your GitHub repository to your Docker Hub account
- `DOCKER_PASSWORD`: a Docker Hub [access token](https://docs.docker.com/security/for-developers/access-tokens/) (Read & Write), to allow your GitHub repository actions to upload Docker images to your Docker Hub account
4. Set up [GitHub Variables](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository):
- `IMAGE_NAME`: the name you chose for your Docker repository
- `MY_EMAIL`: the developer's email address
Expand Down Expand Up @@ -436,7 +436,7 @@ For reference:

Testing each Extension release before making it available to install from the online store is strongly recommended.

1. Go to the [Extensions Manager](../../advanced-usage#extensions-manager) in BlueOS
1. Go to the [Extensions Manager](../../advanced-usage/#extensions-manager) in BlueOS
1. Click on the "Installed" tab
1. Click the "+" icon in the bottom right corner
1. Enter the relevant information for your Docker Image, so it can be fetched from Docker Hub
Expand All @@ -454,6 +454,33 @@ Testing each Extension release before making it available to install from the on
- `Custom settings`: the contents of your Dockerfile's `permissions` LABEL, but with relevant variable substitutions (e.g. `$IMAGE_NAME``blueos-quickstart`) and without the backslash line continuation characters
- Used for configuration of the Docker container when it's run

##### Accessing an Installed Extension's Docker Container

It is possible to enter running Docker containers via the [Terminal](../../advanced-usage/#terminal), by

1. Running `red-pill` to exit the BlueOS-core container
1. Running `docker container ls` to list the currently running Docker containers
1. Running `docker attach -it container-name` to enter the container and see the outputs of the running process
1. Pressing `CTRL+C` to stop the process (e.g. if you want to modify something)
1. Pressing your keyboard's up arrow to find the command the container was last running (or running some alternative command instead)
1. Pressing ...? (TODO) to exit the docker container

If you made changes that you want to make persistent across future restarts it is necessary to `docker commit` a new Docker image from the container,
and potentially overwrite the old one with it if you want it to operate in place of the original Extension.

TODO: describe how to register an existing image as an Extension, if that's even possible.

{% note() %}
While this can be useful for testing minor changes during development (e.g. fixing a small bug, or adjusting some logging outputs), it is
not recommended to upload commit-modified images as new Extension versions, because there's then no record in the source code repository of the change(s).
{% end %}

{% note() %}
If you want to make changes to files that are mounted to the computer's filesystem (via `binds` in the `permissions` metadata LABEL) then that can instead
be done via the [File Browser](../../advanced-usage/#file-browser), restarting the Extension afterwards if necessary. In that case the changes will be
persistent once the modified file has been saved.
{% end %}

#### Submission to the Bazaar

1. Check [metadata docs](#metadata-dockerfile), and match the requirements with your Dockerfile
Expand Down Expand Up @@ -487,6 +514,9 @@ The expected iteration process is:
1. Confirm the new version is available through the BlueOS Extensions Manager
1. Install and test it

##### Modifying an Existing Docker Image



- [Sneak peek diagram](https://github.com/bluerobotics/ardusub-zola/blob/BlueOS-1.1/development/extensions/development-process.mermaid)

0 comments on commit fcd6f4f

Please sign in to comment.