Skip to content

Commit

Permalink
Merge pull request #59 from thin-edge/docs-add-runtime-bootstrap-inst…
Browse files Browse the repository at this point in the history
…ructions

docs: add notes about runtime bootstrapping of option 2
  • Loading branch information
reubenmiller authored Jan 9, 2025
2 parents 0dc0955 + 9106d3a commit cc71240
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions docs/CONTAINER_OPTION2.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,65 @@ mosquitto_sub -h 127.0.0.1 -p 1883 -t '#'
# or if you used another port
mosquitto_sub -h 127.0.0.1 -p 1884 -t '#'
```

## Alternative setups

### Starting tedge-container-bundle and bootstrap at runtime

For instances where you can't do the bootstrapping of the container before the container starts, you can use the following instructions which will configure and bootstrap the container after it has been started, though it will involve restarting the container after it is configured.
1. Create the required docker network and volumes
```sh
docker network create tedge
docker volume create device-certs
docker volume create tedge
```
If you have previously created the volumes, then it is recommended to delete them (to ensure a fresh installation) using the following commands:
```sh
docker volume rm device-certs
docker volume rm tedge
```
2. Start the container. Note: the container won't really work until you have manually bootstrapped it, so you will see a lot of error when looking at the logs)

```sh
docker run -d \
--name tedge \
--restart always \
--add-host host.docker.internal:host-gateway \
--network tedge \
-p "127.0.0.1:1883:1883" \
-p "127.0.0.1:8000:8000" \
-p "127.0.0.1:8001:8001" \
-v "device-certs:/etc/tedge/device-certs" \
-v "tedge:/data/tedge" \
-v /var/run/docker.sock:/var/run/docker.sock:rw \
-e TEDGE_C8Y_OPERATIONS_AUTO_LOG_UPLOAD=always \
ghcr.io/thin-edge/tedge-container-bundle:latest
```

3. Start interactive shell in the container (using the default user), and run the following commands

```sh
docker exec -u tedge -it tedge sh
```

Run the following commands to bootstrap your container:

```sh
tedge cert create --device-id "mydevice0001"
tedge config set c8y.url thin-edge-io.eu-latest.cumulocity.com
tedge cert upload c8y
# reboot the container, or alternatively you can use docker cli for this
reboot
```

4. The device should now have been registered with Cumulocity and you can also check the container logs (from outside of the container):

```sh
docker logs -f tedge
```

14 comments on commit cc71240

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
18 0 2 18 100 5m49.179274s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 24.777 s Container
Grace period to allow container to startup 5.029 s Operations
Service is up 0.132 s Operations
Get Logfile Request 2.335 s Operations
Get Configuration File 4.671 s Operations
Execute Shell Command 2.342 s Operations
Install application using docker compose 15.249 s Operations
Get Container Logs 2.336 s Operations
Get Container Logs without explicit container name 2.336 s Operations
Get Container Logs For Non-existent container 2.332 s Operations
Trigger self update via local command 23.232 s Self-Update
Self update should only update if there is a new image 20.575 s Self-Update
Self update using software update operation 100.234 s Self-Update
Rollback when trying to install a non-tedge based image 20.952 s Self-Update
Self update using software update operation using Container type 100.638 s Self-Update
Cloud Connection is Online 0.143 s Telemetry
Service status 0.232 s Telemetry
Sends measurements 2.626 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
18 0 2 18 100 5m55.416274s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 25.796 s Container
Grace period to allow container to startup 5.027 s Operations
Service is up 0.135 s Operations
Get Logfile Request 2.352 s Operations
Get Configuration File 4.684 s Operations
Execute Shell Command 2.351 s Operations
Install application using docker compose 17.476 s Operations
Get Container Logs 2.349 s Operations
Get Container Logs without explicit container name 2.354 s Operations
Get Container Logs For Non-existent container 2.351 s Operations
Trigger self update via local command 24.022 s Self-Update
Self update should only update if there is a new image 19.523 s Self-Update
Self update using software update operation 101.328 s Self-Update
Rollback when trying to install a non-tedge based image 19.765 s Self-Update
Self update using software update operation using Container type 103.097 s Self-Update
Cloud Connection is Online 0.150 s Telemetry
Service status 0.452 s Telemetry
Sends measurements 2.476 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 8m6.186127999s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 26.295 s Container
Grace period to allow container to startup 5.028 s Operations
Service is up 0.155 s Operations
Get Logfile Request 4.540 s Operations
Get Configuration File 5.058 s Operations
Execute Shell Command 2.454 s Operations
Install application using docker compose 17.650 s Operations
Get Container Logs 4.523 s Operations
Get Container Logs without explicit container name 2.404 s Operations
Get Container Logs For Non-existent container 2.948 s Operations
Update From Legacy Versions 138.471 s Self-Update-Compat
Trigger self update via local command 24.563 s Self-Update
Self update should only update if there is a new image 20.063 s Self-Update
Self update using software update operation 103.047 s Self-Update
Rollback when trying to install a non-tedge based image 20.618 s Self-Update
Self update using software update operation using Container type 105.427 s Self-Update
Cloud Connection is Online 0.153 s Telemetry
Service status 0.263 s Telemetry
Sends measurements 2.499 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 8m4.209907s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 25.254 s Container
Grace period to allow container to startup 5.028 s Operations
Service is up 0.146 s Operations
Get Logfile Request 2.378 s Operations
Get Configuration File 4.714 s Operations
Execute Shell Command 2.407 s Operations
Install application using docker compose 17.516 s Operations
Get Container Logs 4.483 s Operations
Get Container Logs without explicit container name 2.375 s Operations
Get Container Logs For Non-existent container 2.368 s Operations
Update From Legacy Versions 138.751 s Self-Update-Compat
Trigger self update via local command 24.451 s Self-Update
Self update should only update if there is a new image 20.154 s Self-Update
Self update using software update operation 105.008 s Self-Update
Rollback when trying to install a non-tedge based image 20.769 s Self-Update
Self update using software update operation using Container type 105.421 s Self-Update
Cloud Connection is Online 0.163 s Telemetry
Service status 0.275 s Telemetry
Sends measurements 2.522 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 8m18.865432s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 28.970 s Container
Grace period to allow container to startup 5.025 s Operations
Service is up 0.203 s Operations
Get Logfile Request 2.564 s Operations
Get Configuration File 5.107 s Operations
Execute Shell Command 2.568 s Operations
Install application using docker compose 18.365 s Operations
Get Container Logs 2.566 s Operations
Get Container Logs without explicit container name 2.567 s Operations
Get Container Logs For Non-existent container 2.578 s Operations
Update From Legacy Versions 140.546 s Self-Update-Compat
Trigger self update via local command 25.521 s Self-Update
Self update should only update if there is a new image 21.477 s Self-Update
Self update using software update operation 105.163 s Self-Update
Rollback when trying to install a non-tedge based image 23.783 s Self-Update
Self update using software update operation using Container type 108.488 s Self-Update
Cloud Connection is Online 0.216 s Telemetry
Service status 0.386 s Telemetry
Sends measurements 2.748 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 8m23.823682999s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 28.844 s Container
Grace period to allow container to startup 5.027 s Operations
Service is up 0.199 s Operations
Get Logfile Request 2.529 s Operations
Get Configuration File 5.028 s Operations
Execute Shell Command 2.531 s Operations
Install application using docker compose 16.038 s Operations
Get Container Logs 4.689 s Operations
Get Container Logs without explicit container name 4.698 s Operations
Get Container Logs For Non-existent container 2.526 s Operations
Update From Legacy Versions 140.871 s Self-Update-Compat
Trigger self update via local command 26.656 s Self-Update
Self update should only update if there is a new image 21.483 s Self-Update
Self update using software update operation 107.697 s Self-Update
Rollback when trying to install a non-tedge based image 24.522 s Self-Update
Self update using software update operation using Container type 107.123 s Self-Update
Cloud Connection is Online 0.211 s Telemetry
Service status 0.379 s Telemetry
Sends measurements 2.741 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 8m37.860759999s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 29.435 s Container
Grace period to allow container to startup 5.027 s Operations
Service is up 0.191 s Operations
Get Logfile Request 4.720 s Operations
Get Configuration File 5.018 s Operations
Execute Shell Command 2.529 s Operations
Install application using docker compose 15.992 s Operations
Get Container Logs 4.679 s Operations
Get Container Logs without explicit container name 4.682 s Operations
Get Container Logs For Non-existent container 2.518 s Operations
Update From Legacy Versions 143.763 s Self-Update-Compat
Trigger self update via local command 27.856 s Self-Update
Self update should only update if there is a new image 23.528 s Self-Update
Self update using software update operation 107.426 s Self-Update
Rollback when trying to install a non-tedge based image 24.654 s Self-Update
Self update using software update operation using Container type 112.569 s Self-Update
Cloud Connection is Online 0.205 s Telemetry
Service status 0.360 s Telemetry
Sends measurements 2.681 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
18 0 2 18 100 5m56.343031s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 25.001 s Container
Grace period to allow container to startup 5.028 s Operations
Service is up 0.144 s Operations
Get Logfile Request 2.384 s Operations
Get Configuration File 4.764 s Operations
Execute Shell Command 2.384 s Operations
Install application using docker compose 17.624 s Operations
Get Container Logs 2.387 s Operations
Get Container Logs without explicit container name 2.381 s Operations
Get Container Logs For Non-existent container 2.380 s Operations
Trigger self update via local command 24.112 s Self-Update
Self update should only update if there is a new image 19.484 s Self-Update
Self update using software update operation 101.731 s Self-Update
Rollback when trying to install a non-tedge based image 19.707 s Self-Update
Self update using software update operation using Container type 103.595 s Self-Update
Cloud Connection is Online 0.163 s Telemetry
Service status 0.487 s Telemetry
Sends measurements 2.508 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
18 0 2 18 100 6m2.041574s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 24.930 s Container
Grace period to allow container to startup 5.028 s Operations
Service is up 0.134 s Operations
Get Logfile Request 2.358 s Operations
Get Configuration File 4.673 s Operations
Execute Shell Command 2.352 s Operations
Install application using docker compose 15.314 s Operations
Get Container Logs 2.363 s Operations
Get Container Logs without explicit container name 2.349 s Operations
Get Container Logs For Non-existent container 2.347 s Operations
Trigger self update via local command 23.313 s Self-Update
Self update should only update if there is a new image 21.218 s Self-Update
Self update using software update operation 104.989 s Self-Update
Rollback when trying to install a non-tedge based image 21.411 s Self-Update
Self update using software update operation using Container type 102.735 s Self-Update
Cloud Connection is Online 0.357 s Telemetry
Service status 0.244 s Telemetry
Sends measurements 2.455 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 7m55.836819s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 25.050 s Container
Grace period to allow container to startup 5.029 s Operations
Service is up 0.132 s Operations
Get Logfile Request 2.345 s Operations
Get Configuration File 4.656 s Operations
Execute Shell Command 2.338 s Operations
Install application using docker compose 17.406 s Operations
Get Container Logs 2.356 s Operations
Get Container Logs without explicit container name 2.343 s Operations
Get Container Logs For Non-existent container 2.343 s Operations
Update From Legacy Versions 138.069 s Self-Update-Compat
Trigger self update via local command 24.191 s Self-Update
Self update should only update if there is a new image 19.779 s Self-Update
Self update using software update operation 102.158 s Self-Update
Rollback when trying to install a non-tedge based image 20.379 s Self-Update
Self update using software update operation using Container type 104.393 s Self-Update
Cloud Connection is Online 0.146 s Telemetry
Service status 0.238 s Telemetry
Sends measurements 2.459 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 7m59.725519s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 25.149 s Container
Grace period to allow container to startup 5.030 s Operations
Service is up 0.160 s Operations
Get Logfile Request 2.358 s Operations
Get Configuration File 4.673 s Operations
Execute Shell Command 2.349 s Operations
Install application using docker compose 17.441 s Operations
Get Container Logs 2.365 s Operations
Get Container Logs without explicit container name 2.348 s Operations
Get Container Logs For Non-existent container 2.354 s Operations
Update From Legacy Versions 138.686 s Self-Update-Compat
Trigger self update via local command 24.301 s Self-Update
Self update should only update if there is a new image 19.936 s Self-Update
Self update using software update operation 102.922 s Self-Update
Rollback when trying to install a non-tedge based image 20.261 s Self-Update
Self update using software update operation using Container type 106.504 s Self-Update
Cloud Connection is Online 0.145 s Telemetry
Service status 0.248 s Telemetry
Sends measurements 2.467 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 8m1.274595s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 25.727 s Container
Grace period to allow container to startup 5.027 s Operations
Service is up 0.135 s Operations
Get Logfile Request 2.374 s Operations
Get Configuration File 4.667 s Operations
Execute Shell Command 2.350 s Operations
Install application using docker compose 17.435 s Operations
Get Container Logs 2.346 s Operations
Get Container Logs without explicit container name 2.361 s Operations
Get Container Logs For Non-existent container 2.345 s Operations
Update From Legacy Versions 138.067 s Self-Update-Compat
Trigger self update via local command 24.685 s Self-Update
Self update should only update if there is a new image 20.329 s Self-Update
Self update using software update operation 103.388 s Self-Update
Rollback when trying to install a non-tedge based image 20.802 s Self-Update
Self update using software update operation using Container type 106.310 s Self-Update
Cloud Connection is Online 0.195 s Telemetry
Service status 0.238 s Telemetry
Sends measurements 2.469 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 8m2.692476s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 25.442 s Container
Grace period to allow container to startup 5.029 s Operations
Service is up 0.148 s Operations
Get Logfile Request 2.386 s Operations
Get Configuration File 4.749 s Operations
Execute Shell Command 2.387 s Operations
Install application using docker compose 17.610 s Operations
Get Container Logs 2.400 s Operations
Get Container Logs without explicit container name 2.386 s Operations
Get Container Logs For Non-existent container 2.414 s Operations
Update From Legacy Versions 139.160 s Self-Update-Compat
Trigger self update via local command 24.656 s Self-Update
Self update should only update if there is a new image 20.178 s Self-Update
Self update using software update operation 103.334 s Self-Update
Rollback when trying to install a non-tedge based image 20.920 s Self-Update
Self update using software update operation using Container type 106.506 s Self-Update
Cloud Connection is Online 0.162 s Telemetry
Service status 0.275 s Telemetry
Sends measurements 2.522 s Telemetry

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
19 0 1 19 100 8m32.068632s

Passed Tests

Name ⏱️ Duration Suite
Ignore Containers Marked With A Specific Label 29.683 s Container
Grace period to allow container to startup 5.026 s Operations
Service is up 0.215 s Operations
Get Logfile Request 4.776 s Operations
Get Configuration File 5.157 s Operations
Execute Shell Command 2.593 s Operations
Install application using docker compose 14.077 s Operations
Get Container Logs 4.775 s Operations
Get Container Logs without explicit container name 4.775 s Operations
Get Container Logs For Non-existent container 2.589 s Operations
Update From Legacy Versions 142.931 s Self-Update-Compat
Trigger self update via local command 26.573 s Self-Update
Self update should only update if there is a new image 21.821 s Self-Update
Self update using software update operation 107.436 s Self-Update
Rollback when trying to install a non-tedge based image 25.451 s Self-Update
Self update using software update operation using Container type 110.873 s Self-Update
Cloud Connection is Online 0.207 s Telemetry
Service status 0.370 s Telemetry
Sends measurements 2.711 s Telemetry

Please sign in to comment.