Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ubuntu-snap.md #165

Merged
merged 3 commits into from
Mar 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion snapcraft-options/ubuntu-snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
andretoyama-msft marked this conversation as resolved.
Show resolved Hide resolved

- 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`
Expand All @@ -24,11 +30,24 @@ It is a fruitful exercise to look around in the host file system and see how sna
- /snap/<snap-name>
- /var/snap/<snap-name>

## 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.
andretoyama-msft marked this conversation as resolved.
Show resolved Hide resolved

- 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.
Expand Down