Skip to content

Commit

Permalink
Cleanup deploying first app tutorial
Browse files Browse the repository at this point in the history
General cleanup and style applied. Added updated screenshot,
provided both formats, but defaulting to using webp for the time being.

QA Steps: ran linter, checked html output in browser

This commit addresses Jira FFTK-2513
This commit applies to Jira FFTK-2510
This commit applies to Jira FFTK-988

Signed-off-by: Katrina Prosise <katrina.prosise@foundries.io>
  • Loading branch information
kprosise committed Jul 11, 2023
1 parent 807c621 commit a952c91
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 93 deletions.
Binary file modified source/_static/tutorials/deploying-first-app/tutorial-device.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
29 changes: 12 additions & 17 deletions source/tutorials/deploying-first-app/configure-your-device.rst
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
Configure your device
Configure Your Device
^^^^^^^^^^^^^^^^^^^^^

At this point, your device should be registered to your Factory according to
the :ref:`Getting Started guide <gs-register>`. Once registered, two services start to
communicate with your Factory: ``aktualizr-lite`` and ``fioconfig``.
Your device should be registered to your Factory according to the :ref:`Getting Started guide <gs-register>`.
Once registered, two services start to communicate with a Factory: ``aktualizr-lite`` and ``fioconfig``.

**aktualizr-lite**:

This is the daemon responsible for updating the device. It checks for new updates and
implements `The Update Protocol (TUF) <TUF_>`_ to guarantee the integrity of platform
and container updates.
This is the daemon responsible for updating the device.
It checks for new updates and implements `The Update Protocol (TUF) <TUF_>`_ .
TUF helps guarantee the integrity of platform and container updates.

**fioconfig**:

This is the daemon responsible for managing configuration data for your device.
The content is encrypted in a way that only the device will be able to decrypt
and use.
The content is encrypted where only the device will be able to decrypt and use it.

Both applications are configured to communicate with your Factory.
That being said, an update could take up to 10 minutes to be triggered.
This can be configured according to your product needs.

To improve your experience during this tutorial, you will configure both
``aktualizr-lite`` and ``fioconfig`` to check every minute.
During this tutorial, you will configure both ``aktualizr-lite`` and ``fioconfig`` to check every minute.

This configuration will only apply to the device where the commands below are run.
To change the timing for the entire fleet, you will need to customize your Factory image.

On your device, create a settings file in the ``/etc/sota/conf.d/`` folder to
configure ``aktualizr-lite``:
On your device, create a settings file in the ``/etc/sota/conf.d/`` folder to configure ``aktualizr-lite``:

.. prompt:: bash device:~$

Expand All @@ -53,11 +48,11 @@ Restart both services:
In the following instructions, you will disable and enable services.
This will trigger ``aktualizr-lite`` tasks that might be interesting to follow.

To watch the ``aktualizr-lite`` logs and see the updates, leave a device
terminal running the command:
To watch the ``aktualizr-lite`` logs for updates, leave a device
terminal open running the command:

.. prompt:: bash device:~$

sudo journalctl --follow --unit aktualizr-lite

.. _TUF: https://theupdateframework.com/
.. _TUF: https://theupdateframework.com/
36 changes: 15 additions & 21 deletions source/tutorials/deploying-first-app/debugging-your-device.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
Debugging your device
Debugging Your Device
^^^^^^^^^^^^^^^^^^^^^

Your device should be configured to always download the latest **Target** version with a
specific ``tag``.
Your device is configured to always download the latest **Target** version with a specific ``tag``.

By default, devices will run **all** applications that are defined in the ``containers.git``
repository and therefore available in the latest **Target**. This behavior can be changed
by enabling only specific applications. We will cover this in more detail a little later.
By default, devices run **all** applications defined in the ``containers.git`` repo.
This behavior can be changed by enabling only specific applications.
This will be covered this in more detail later.

To check your device configuration, you can click on the tab :guilabel:`devices`
on your Factory and find the column :guilabel:`TAGS`:
To check your device configuration, click on the Factory tab :guilabel:`devices` and find the column :guilabel:`TAGS`:

.. figure:: /_static/tutorials/deploying-first-app/tutorial-device.png
.. figure:: /_static/tutorials/deploying-first-app/tutorial-device.webp
:width: 900
:align: center

Expand All @@ -23,9 +21,7 @@ You can also use ``fioctl`` to read information about your device.

host:~$ fioctl device show <device-name>

**Example Output**:

.. prompt:: text
::

UUID: a06b0bab-38be-409b-b7f8-f1125231a91e
Owner: 6025791fd93b37d33e03b349
Expand All @@ -35,7 +31,7 @@ You can also use ``fioctl`` to read information about your device.
Ostree Hash: 3abd308ea6d4caffcdf250c7170e0dc9c8ff9082c64538bf14ca07c2df1beeff
Created: 2021-04-20T20:54:37+00:00
Last Seen: 2021-04-20T22:42:53+00:00
Tags: devel
Tags: main
Docker Apps: shellhttpd
Network Info:
Hostname: raspberrypi3-64
Expand All @@ -58,20 +54,18 @@ You can also use ``fioctl`` to read information about your device.
yx6kgczb3QNAEe/imtGemFvVsir/qxRPVODVdXSlf2doAJ21cv0VL1M++g==
-----END PUBLIC KEY-----

As expected, the device is configured to follow the ``devel`` tag. Based on that,
it found and updated to the latest **Target** with the ``devel`` tag, which is version 4.
Because you didn't specify what application it should run, it automatically loads
all applications available in the current **Target**. In this case, ``shellhttpd``.
The device is configured to follow the ``main`` tag.
Based on that, it found and updated to the latest Target with the tag.
Because we did not specify what application should run, all apps available in the current Target are automatically loaded.
In this case, ``shellhttpd``.

Another way to verify applications running on the device is with the ``docker ps`` command:
Another way to verify the apps running on a device is with ``docker ps``:

.. prompt:: bash device:~$, auto

device:~$ docker ps

**Example Output**:

.. prompt:: text
::

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
48f467ea2461 hub.foundries.io/<factory>/shellhttpd "/usr/local/bin/http…" 6 hours ago Up 6 hours 0.0.0.0:8080->8080/tcp shellhttpd_httpd_1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Summary
-------
This tutorial shows you important commands to debug an over-the-air update as well
as how to enable and disable specific applications. The instructions from this
Tutorial together with all the previous guides will help with your development cycle.
You were introduced to important commands for debugging over-the-air updates.
You also learned how to enable and disable apps.
The instructions from this tutorial will aid you well in the development cycle.
12 changes: 6 additions & 6 deletions source/tutorials/deploying-first-app/deploying-first-app.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.. _tutorial-deploying-first-app:

Deploying your first Application
Deploying Your First Application
================================

In the previous tutorial ":ref:`tutorial-creating-first-target`", you created your first
**Target**. This is a very important concept to understand how FoundriesFactory works.
In this tutorial, you will learn how devices consume **Targets** as well as how to configure
your device with desired applications.
In the tutorial ref:`tutorial-creating-first-target`, you learned about **Targets**.
This is core to understanding how FoundriesFactory® works.
Now you will learn how devices *consume* Targets.
You will also learn how to configure a device with the desired applications.

.. note::

Expand Down Expand Up @@ -37,4 +37,4 @@ Instructions
debugging-your-device
testing-container
enabling-specific-applications
deploying-first-app-summary
deploying-first-app-summary
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Enabling Specific Applications
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As you implement more applications in ``containers.git``, you may not
want to run all of them on all of your devices. You can use ``fioctl`` to
specify what applications the device should run.
As you implement more apps in ``containers.git``, you may not want all of them running on every device.
Fioctl® can specify what apps a device should run.

Instead of enabling the ``shellhttpd``, which is already done as mentioned before.
Let's use ``fioctl`` to first disable and then enable the ``shellhttpd`` application.
Instead of enabling ``shellhttpd`` as done before, we will use ``fioctl`` to first disable and then enable ``shellhttpd``.
Make sure to follow the ``aktualizr-lite`` logs on your device with the following command:

.. prompt:: bash device:~$
Expand All @@ -18,30 +16,24 @@ On your host machine, disable ``shellhttpd`` by replacing the list of apps with
.. prompt:: bash host:~$, auto

host:~$ fioctl devices config updates --apps , <device-name>

::

**Example Output**:
Changing apps from: [shellhttpd] -> []
Changing packagemanager to ostree+compose_apps

.. prompt:: text

Changing apps from: [shellhttpd] -> []
Changing packagemanager to ostree+compose_apps

In a maximum of 2 minutes, you should see ``aktualizr-lite`` remove the application.

Once ``aktualizr-lite`` finishes its changes, use ``docker ps`` to see if there
are any containers running on the device:
You should shortly see ``aktualizr-lite`` remove the app.
Once ``aktualizr-lite`` finishes, use ``docker ps`` to see if there are any containers running on the device:

.. prompt:: bash device:~$, auto

device:~$ docker ps

**Example Output**:

.. prompt:: text

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
::
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

On the device, open the ``aktualizr-lite`` log again and watch as you re-enable ``shellhttpd``:
On the device, open the log again and watch as you re-enable ``shellhttpd``:

.. prompt:: bash device:~$

Expand All @@ -53,37 +45,30 @@ Enable the ``shellhttpd`` application on your device:

host:~$ fioctl devices config updates --apps shellhttpd <device-name>

**Example Output**:
::

.. prompt:: text

Changing apps from: [] -> [shellhttpd]
Changing packagemanager to ostree+compose_apps

Again in a maximum of 2 minutes, you should see ``aktualizr-lite`` add the application.
Changing apps from: [] -> [shellhttpd]
Changing packagemanager to ostree+compose_apps

You should soon see ``aktualizr-lite`` add the app.
On your device, test the container again by running the following command:

.. prompt:: bash device:~$, auto

device:~$ wget -qO- 127.0.0.1:8080

**Example Output**:
::

.. prompt:: text

Hello world
Hello world

Check the running containers:

.. prompt:: bash device:~$, auto

device:~$ docker ps

**Example Output**:

.. prompt:: text
::

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
72a3d00dbc1c hub.foundries.io/<factory>/shellhttpd "/usr/local/bin/http…" 2 hours ago Up 2 hours 0.0.0.0:8080->8080/tcp shellhttpd_httpd_1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
72a3d00dbc1c hub.foundries.io/<factory>/shellhttpd "/usr/local/bin/http…" 2 hours ago Up 2 hours 0.0.0.0:8080->8080/tcp shellhttpd_httpd_1

13 changes: 4 additions & 9 deletions source/tutorials/deploying-first-app/testing-container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@ Testing the Container

device:~$ wget -qO- 127.0.0.1:8080

**Example Output**:

.. prompt:: text
::

Hello world

You can also test the container from an external device connected to the same
network (e.g. your host machine: the same computer you use to access your device with ssh).
You can also test the container from an external device connected to the same network, such as your computer.

.. prompt:: bash host:~$, auto

host:~$ #Example curl 192.168.15.11:8080
host:~$ curl <device IP>:8080

**Example Output**:

.. prompt:: text
::

Hello world
Hello world

0 comments on commit a952c91

Please sign in to comment.