diff --git a/snapcraft-options/ubuntu-snap.md b/snapcraft-options/ubuntu-snap.md index a256bb48..46ecbdfa 100644 --- a/snapcraft-options/ubuntu-snap.md +++ b/snapcraft-options/ubuntu-snap.md @@ -10,11 +10,21 @@ 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 +34,26 @@ 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 +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: - `$ 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.