From 03b91e60693db352a14eaf0376edafafc45f7353 Mon Sep 17 00:00:00 2001 From: andretoyama-msft <106272532+andretoyama-msft@users.noreply.github.com> Date: Tue, 21 Mar 2023 11:34:05 -0300 Subject: [PATCH 1/3] Update ubuntu-snap.md --- snapcraft-options/ubuntu-snap.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/snapcraft-options/ubuntu-snap.md b/snapcraft-options/ubuntu-snap.md index a256bb48..dd46f4a1 100644 --- a/snapcraft-options/ubuntu-snap.md +++ b/snapcraft-options/ubuntu-snap.md @@ -10,11 +10,17 @@ Run the commands in the root of the repo. - `$ ./build/build-snaps.sh agent` - `$ ./build/build-snaps.sh sdk-tests` +- By default snapcraft doesn't allow multiple snaps definition in the same code base, so this build-snaps.sh file was created so that we can copy the different snap files into the main snapcraft.yaml file and then build it. + - Subsequent builds of the same component without modifying the corresponding yaml file: - `$ snapcraft` - The build will generate *.snap files in the current working directory. Example: **deliveryoptimization-sdk-tests_0.1_amd64.snap**. +- In the snapcraft.yaml the regular script to build for both the delivery optimization agent and sdk is called (`build.py`), but since there are some different behaviors the code should have when inside a snap, for that we use a flag `--build-for-snap` on the build. Below you can see the usage of this flag, but **is not** necessary to execute them, those lines will be executed inside the snapcraft.yaml file when you call the `build-snaps.sh` file. + - `$ python3 ./build/build.py --project agent --build-for-snap` + - `$ python3 ./build/build.py --project sdk --build-for-snap` + ## Installing - `$ sudo snap install --devmode ./deliveryoptimization-sdk-tests_0.1_amd64.snap` - `$ sudo snap install --devmode ./deliveryoptimization-client_0.1_amd64.snap` @@ -24,11 +30,24 @@ It is a fruitful exercise to look around in the host file system and see how sna - /snap/ - /var/snap/ -## Connecting plugs and slots +## Connecting to Other Snaps + +- Snapcraft allows communication between different snaps by using a content interface to handle connections with the purpose share code and data between them. These connections are composed by plugs and slots, where a slot is the producer snap and the plug is the consumer snap. + - For the SDK test snap to work, the plugs and slots must be connected. Run the **connect-snaps.sh** script after both snaps are installed. - The connections can be listed using this command: - `$ snap connections | grep delivery` +```shell +Interface Plug Slot Notes +content - deliveryoptimization-client:do-configs - +content - deliveryoptimization-client:do-port-numbers - +content deliveryoptimization-client:deviceupdate-agent-downloads - - +network deliveryoptimization-client:network :network - +network-bind deliveryoptimization-client:network-bind :network-bind - + +``` + ## Running or executing - Agent - The agent is declared as a daemon/service, so it starts running immediately after successful installation. From 2888243cca11812d45ef722561b25fdd59305931 Mon Sep 17 00:00:00 2001 From: andretoyama-msft <106272532+andretoyama-msft@users.noreply.github.com> Date: Tue, 21 Mar 2023 13:57:50 -0300 Subject: [PATCH 2/3] Update ubuntu-snap.md --- snapcraft-options/ubuntu-snap.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/snapcraft-options/ubuntu-snap.md b/snapcraft-options/ubuntu-snap.md index dd46f4a1..85518589 100644 --- a/snapcraft-options/ubuntu-snap.md +++ b/snapcraft-options/ubuntu-snap.md @@ -17,7 +17,10 @@ Run the commands in the root of the repo. - The build will generate *.snap files in the current working directory. Example: **deliveryoptimization-sdk-tests_0.1_amd64.snap**. -- In the snapcraft.yaml the regular script to build for both the delivery optimization agent and sdk is called (`build.py`), but since there are some different behaviors the code should have when inside a snap, for that we use a flag `--build-for-snap` on the build. Below you can see the usage of this flag, but **is not** necessary to execute them, those lines will be executed inside the snapcraft.yaml file when you call the `build-snaps.sh` file. +- In the snapcraft.yaml the regular script to build for both the delivery optimization agent and sdk is called (`build.py`), but since +there are some different behaviors the code should have when inside a snap, for that we use a flag `--build-for-snap` on the build. +Below you can see the usage of this flag, but **is not** necessary to execute them, those lines will be executed inside the snapcraft.yaml +file when you call the `build-snaps.sh` file. - `$ python3 ./build/build.py --project agent --build-for-snap` - `$ python3 ./build/build.py --project sdk --build-for-snap` @@ -32,7 +35,7 @@ It is a fruitful exercise to look around in the host file system and see how sna ## Connecting to Other Snaps -- Snapcraft allows communication between different snaps by using a content interface to handle connections with the purpose share code and data between them. These connections are composed by plugs and slots, where a slot is the producer snap and the plug is the consumer snap. +- Snapcraft allows communication between different snaps by using a content interface to handle connections with the purpose of sharing code and data between them. These connections are composed by plugs and slots, where a slot is the producer snap and the plug is the consumer snap. - For the SDK test snap to work, the plugs and slots must be connected. Run the **connect-snaps.sh** script after both snaps are installed. - The connections can be listed using this command: From bd1b01a039e2b69018729ed8d13dd4a4cb76344c Mon Sep 17 00:00:00 2001 From: andretoyama-msft <106272532+andretoyama-msft@users.noreply.github.com> Date: Tue, 21 Mar 2023 14:36:41 -0300 Subject: [PATCH 3/3] Update ubuntu-snap.md --- snapcraft-options/ubuntu-snap.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/snapcraft-options/ubuntu-snap.md b/snapcraft-options/ubuntu-snap.md index 85518589..46ecbdfa 100644 --- a/snapcraft-options/ubuntu-snap.md +++ b/snapcraft-options/ubuntu-snap.md @@ -10,7 +10,8 @@ Run the commands in the root of the repo. - `$ ./build/build-snaps.sh agent` - `$ ./build/build-snaps.sh sdk-tests` -- By default snapcraft doesn't allow multiple snaps definition in the same code base, so this build-snaps.sh file was created so that we can copy the different snap files into the main snapcraft.yaml file and then build it. +- By default snapcraft doesn't allow multiple snaps definition in the same code base, so this build-snaps.sh file was created so that +we can copy the different snap files into the main snapcraft.yaml file and then build it. - Subsequent builds of the same component without modifying the corresponding yaml file: - `$ snapcraft` @@ -35,7 +36,9 @@ It is a fruitful exercise to look around in the host file system and see how sna ## Connecting to Other Snaps -- Snapcraft allows communication between different snaps by using a content interface to handle connections with the purpose of sharing code and data between them. These connections are composed by plugs and slots, where a slot is the producer snap and the plug is the consumer snap. +- Snapcraft allows communication between different snaps by using a content interface to handle connections with the purpose +of sharing code and data between them. These connections are composed by plugs and slots, where a slot is the producer snap +and the plug is the consumer snap. - For the SDK test snap to work, the plugs and slots must be connected. Run the **connect-snaps.sh** script after both snaps are installed. - The connections can be listed using this command: