summaryrefslogtreecommitdiffstats
path: root/docs/part-1/1-1_install-xds-server-docker.md
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-10-04 11:57:13 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-11-30 08:30:39 +0000
commit94bcf90898e8b17811075eb693e0d96d753b8d8b (patch)
treede1d7b1e0db7f5ad8a4c9ea9a01e20fbde3c7658 /docs/part-1/1-1_install-xds-server-docker.md
parentcf4c58201681023c1722b1a2870a3ea28bab0f2a (diff)
Invert order of installation chapters
To make install process more understandable, document first installation of xds-server part and then installation of xds tools. Bug: SPEC-1993 Change-Id: I5733c5d6885f45ff98cc9fee0d04362f76a86a4c Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'docs/part-1/1-1_install-xds-server-docker.md')
-rw-r--r--docs/part-1/1-1_install-xds-server-docker.md152
1 files changed, 152 insertions, 0 deletions
diff --git a/docs/part-1/1-1_install-xds-server-docker.md b/docs/part-1/1-1_install-xds-server-docker.md
new file mode 100644
index 0000000..37e1fba
--- /dev/null
+++ b/docs/part-1/1-1_install-xds-server-docker.md
@@ -0,0 +1,152 @@
+# Installation based on Docker container
+
+## Docker container prerequisites
+
+Docker is installed on the host machine, please refer to [Docker documentation](https://docs.docker.com/engine/installation/) for more details.
+
+## Get the container
+
+Load the pre-build AGL SDK docker image including `xds-server`:
+
+```bash
+wget -O - http://iot.bzh/download/public/XDS/docker/docker_agl_worker-xds-latest.tar.xz | docker load
+```
+
+You should get `docker.automotivelinux.org/agl/worker-xds:X.Y` image
+
+```bash
+# List image that we just load
+docker images "docker.automotivelinux.org/agl/worker-xds*"
+
+REPOSITORY TAG IMAGE ID CREATED SIZE
+docker.automotivelinux.org/agl/worker-xds 5.0 877979e534ff 3 hours ago 106MB
+```
+
+## Create and start a new container
+
+Use provided script to create a new docker image and start a new container:
+
+```bash
+# Get script
+wget -O xds-docker-create-container.sh 'https://gerrit.automotivelinux.org/gerrit/gitweb?p=src/xds/xds-server.git;a=blob_plain;f=scripts/xds-docker-create-container.sh;hb=master'
+
+# Create new XDS worker container
+bash ./xds-docker-create-container.sh
+
+# Check that new container is running
+docker ps | grep worker-xds
+f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 0.0.0.0:8000->8000/tcp, 0.0.0.0:69->69/udp, 0.0.0.0:10809->10809/tcp, 0.0.0.0:2222->22/tcp agl-xds-HOSTNAME-0-USERNAME
+```
+
+This container exposes following ports:
+
+| Port number | Description |
+|-------------|---------------------------------------------|
+| 8000 | `xds-server`: serve XDS webapp and REST API |
+| 69 | TFTP |
+| 2222 | ssh |
+
+This container also creates the following volumes (shared folders between
+inside and outside docker):
+
+| Directory on host | Directory inside docker | Comment |
+|-------------------|-------------------------|---------|
+| $HOME/xds-workspace | /home/devel/xds-workspace | XDS projects workspace location|
+| $HOME/xds-workspace/.xdt_0 | /xdt | location to store SDKs |
+| $USER_VOLUME | $USER_VOLUME | user path, see `--volume` option of `xds-docker-create-container.sh` script |
+
+<!-- section-note -->
+**Note:**
+
+You can add a new shared directory using `--volume` option in order
+to use for example with Path-Mapping folder type.
+
+```bash
+# Create new XDS worker container and share extra '$HOME/my-workspace' directory
+bash ./xds-docker-create-container.sh --volume /my-workspace:$HOME/my-workspace
+```
+
+You can change docker used port with `-id` option
+
+```bash
+# Create new XDS worker container with a different port number
+bash ./xds-docker-create-container.sh -id ${ID}
+
+# Check that new container is running
+docker ps | grep worker-xds
+f67079db4339 docker.automotivelinux.org/agl/worker-xds:5.0 "/usr/bin/wait_for..." About a minute ago Up 34 seconds 0.0.0.0:(2222+ID)->22/tcp, 0.0.0.0:(69+ID)->69/udp, 0.0.0.0:(8000+ID)->8000/tcp, 0.0.0.0:(10809+ID)->10809/tcp agl-xds-HOSTNAME-ID-USERNAME
+```
+
+<!-- end-section-note -->
+
+### Manually setup docker user id
+
+<!-- section-note -->
+**Note:**
+
+If you used `xds-docker-create-container.sh` script to create XDS
+docker container, user uid/gid inside docker has already been changed by this script.
+<!-- end-section-note -->
+
+If you plan to use **path-mapping sharing type for your projects**, you need to
+have the same user id and group id inside and outside docker.
+
+By default user and group name inside docker is set `devel` (id `1664`).
+
+Use following commands to replace id `1664` with your user/group id:
+
+```bash
+# Set docker container name to use (usually agl-xds-xxx where xxx is USERNAME@MACHINENAME-IDX-NAME)
+export CONTAINER_NAME=agl-xds-seb@laptop-0-seb
+docker ps | grep -q ${CONTAINER_NAME} || echo "ERROR: No container name \"${CONTAINER_NAME}\" please set a valid CONTAINER_NAME before you continue"
+
+# First kill all processes of devel user (including running xds-server)
+docker exec ${CONTAINER_NAME} bash -c "/bin/loginctl kill-user devel"
+
+# Change user and group id inside docker to match your ids
+docker exec ${CONTAINER_NAME} bash -c "usermod -u $(id -u) devel"
+docker exec ${CONTAINER_NAME} bash -c "groupmod -g $(id -g) devel"
+
+# Update some files ownership
+docker exec ${CONTAINER_NAME} bash -c "chown -R devel:devel /home/devel /tmp/xds*"
+
+# Restart devel autologin service
+docker exec ${CONTAINER_NAME} bash -c "systemctl restart autologin"
+
+# Restart xds-server as a service (ssh port 2222 may depend on your container ID)
+ssh -p 2222 devel@localhost -- "systemctl --user restart xds-server"
+```
+
+## Check if xds-server is running (open XDS webapp)
+
+**`xds-server` is automatically started** as a user service on container startup.
+
+If the container is running on your localhost, you can access to a basic web
+application:
+
+```bash
+xdg-open http://localhost:8000
+```
+
+If needed you can status / stop / start it manually using following commands:
+
+```bash
+# Status XDS server:
+ssh -p 2222 devel@localhost systemctl --user status xds-server.service
+
+# Stop XDS server
+ssh -p 2222 devel@localhost systemctl --user stop xds-server.service
+
+# Start XDS server
+ssh -p 2222 devel@localhost systemctl --user start xds-server.service
+
+# Get XDS server logs
+ssh -p 2222 devel@localhost journalctl --user --unit=xds-server.service --output=cat
+```
+
+`xds-server` is now up and running, you can now install AGL SDKs, please refer
+to next chapter named [Installing AGL SDKs](./3_install-sdks.html)
+
+<!-- section-note -->
+Please refer to [xds-server configuration](../part-2/1_xds-server/1_config.html) chapter for additional info about xds-server settings.
+<!-- end-section-note -->