Skip to content

Commit cc71240

Browse files
authored
Merge pull request #59 from thin-edge/docs-add-runtime-bootstrap-instructions
docs: add notes about runtime bootstrapping of option 2
2 parents 0dc0955 + 9106d3a commit cc71240

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

docs/CONTAINER_OPTION2.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,65 @@ mosquitto_sub -h 127.0.0.1 -p 1883 -t '#'
102102
# or if you used another port
103103
mosquitto_sub -h 127.0.0.1 -p 1884 -t '#'
104104
```
105+
106+
## Alternative setups
107+
108+
### Starting tedge-container-bundle and bootstrap at runtime
109+
110+
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.
111+
112+
1. Create the required docker network and volumes
113+
114+
```sh
115+
docker network create tedge
116+
docker volume create device-certs
117+
docker volume create tedge
118+
```
119+
120+
If you have previously created the volumes, then it is recommended to delete them (to ensure a fresh installation) using the following commands:
121+
122+
```sh
123+
docker volume rm device-certs
124+
docker volume rm tedge
125+
```
126+
127+
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)
128+
129+
```sh
130+
docker run -d \
131+
--name tedge \
132+
--restart always \
133+
--add-host host.docker.internal:host-gateway \
134+
--network tedge \
135+
-p "127.0.0.1:1883:1883" \
136+
-p "127.0.0.1:8000:8000" \
137+
-p "127.0.0.1:8001:8001" \
138+
-v "device-certs:/etc/tedge/device-certs" \
139+
-v "tedge:/data/tedge" \
140+
-v /var/run/docker.sock:/var/run/docker.sock:rw \
141+
-e TEDGE_C8Y_OPERATIONS_AUTO_LOG_UPLOAD=always \
142+
ghcr.io/thin-edge/tedge-container-bundle:latest
143+
```
144+
145+
3. Start interactive shell in the container (using the default user), and run the following commands
146+
147+
```sh
148+
docker exec -u tedge -it tedge sh
149+
```
150+
151+
Run the following commands to bootstrap your container:
152+
153+
```sh
154+
tedge cert create --device-id "mydevice0001"
155+
tedge config set c8y.url thin-edge-io.eu-latest.cumulocity.com
156+
tedge cert upload c8y
157+
158+
# reboot the container, or alternatively you can use docker cli for this
159+
reboot
160+
```
161+
162+
4. The device should now have been registered with Cumulocity and you can also check the container logs (from outside of the container):
163+
164+
```sh
165+
docker logs -f tedge
166+
```

0 commit comments

Comments
 (0)