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

Graphical Snaps for Ubuntu Core #755

Merged
merged 51 commits into from Jun 25, 2018

Conversation

Projects
None yet
8 participants
@AlanGriffiths
Copy link
Contributor

AlanGriffiths commented May 25, 2018

Guide to creating graphical snaps for Ubuntu Core

AlanGriffiths and others added some commits May 17, 2018

@webteam-app

This comment has been minimized.

Copy link

webteam-app commented May 25, 2018

User is not a collaborator of this repo. Please start demo manually.

@webteam-app

This comment has been minimized.

Copy link

webteam-app commented May 28, 2018

AlanGriffiths added some commits Jun 5, 2018

@Saviq

Saviq approved these changes Jun 6, 2018

Copy link
Contributor

Saviq left a comment

I'm good with this, a couple nitpicks left but good for approval already.

AlanGriffiths added some commits Jun 6, 2018

content: wayland-socket-dir
interface: content
target: $SNAP_DATA/wayland
default-provider: mir-kiosk

This comment has been minimized.

@gerboland

gerboland Jun 6, 2018

Contributor

I just tested this file as-is, and installing it I got
2018-06-06T13:15:12Z INFO snap "iot-example-graphical-xwayland-snap" has bad plugs or slots: x11-plug (unknown interface "x11-plug")

Seems snapcraft doesn't deal well with having two "plugs" sections. If I combined them into one, that warning was removed.

On your ssh session to your device:
```bash
snap install --dangerous iot-example-graphical-xwayland-snap_0.1_arm64.snap
snap connect iot-example-graphical-xwayland-snap:wayland-socket-dir mir-kiosk:wayland-socket-dir

This comment has been minimized.

@gerboland

gerboland Jun 6, 2018

Contributor

So it isn't auto-connecting. The plug does apply to itself, i.e. since we declare that we satisfy the x11 plug, then the correct apparmor permissions for an X11 server (here Xwayland) are being automatically applied, i.e. bind to a socket. Here's the profile location:
/var/lib/snapd/apparmor/profiles/snap.iot-example-graphical-xwayland-snap.glxgears-kiosk
and contents on install: https://pastebin.ubuntu.com/p/kTgGBxm4kM/

What this connection should be needed for is to allow an x11 client connect to the X socket. These lines are added to to the apparmor profile: https://pastebin.ubuntu.com/p/5cRyhxw73y/

I don't understand why the application works without this. glxgears shouldn't be able to connect to the X11 socket without this. (glxgears not needing fonts or the other bits really)

AlanGriffiths added some commits Jun 6, 2018

* Ubuntu Core is available on a range of devices.
This guide shows you how to set up an existing device: [https://developer.ubuntu.com/core/get-started/installation-medias](https://developer.ubuntu.com/core/get-started/installation-medias). If there's no supported image that fits your needs you can [create your own core image](https://tutorials.ubuntu.com/tutorial/create-your-own-core-image).
* Using a VM
You don't *have* to have a physical "Target Device", you can follow the tutorial with Ubuntu Core on a VM:

This comment has been minimized.

@Saviq

Saviq Jun 14, 2018

Contributor

s/on a VM/in a VM/

* Using Ubuntu Classic
You don't *have* to use Ubuntu Core, you can use also a "Target Device" with Ubuntu Classic. You just need to install an SSH server on the device.
```bash
sudo apt install openssh-server

This comment has been minimized.

@Saviq

Saviq Jun 14, 2018

Contributor

ssh is a handy metapackage for this

* Ubuntu Core is available on a range of devices.
This guide shows you how to set up an existing device: [https://developer.ubuntu.com/core/get-started/installation-medias](https://developer.ubuntu.com/core/get-started/installation-medias). If there's no supported image that fits your needs you can [create your own core image](https://tutorials.ubuntu.com/tutorial/create-your-own-core-image).
* Using a VM
You don't *have* to have a physical "Target Device", you can follow the tutorial with Ubuntu Core on a VM:

This comment has been minimized.

@Saviq

Saviq Jun 14, 2018

Contributor

s/on a VM/in a VM/

* Using Ubuntu Classic
You don't *have* to use Ubuntu Core, you can use also a "Target Device" with Ubuntu Classic. You just need to install an SSH server on the device.
```bash
sudo apt install openssh-server

This comment has been minimized.

@Saviq

Saviq Jun 14, 2018

Contributor

ssh is a handy metapackage for this.

AlanGriffiths added some commits Jun 15, 2018

@webteam-app

This comment has been minimized.

Copy link

webteam-app commented Jun 15, 2018

@degville
Copy link
Contributor

degville left a comment

Great tutorial I really enjoyed reading it, thanks! I'm approving this as I can't see any blocking issues, but I've left plenty of paper cut comments inline you can tackle if you have the time. As some of the text is duplicated, I've only made the comments in the first tutorial. My only general comment is that images would make the tutorial even better.

* Industrial machine User Interface

positive
: The combination of Snap, the "mir-kiosk" Wayland server and Ubuntu Core ensures reliability and security of any graphical embedded device application.

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

ensures the reliability


negative
: This tutorial assumes you are familiar with the material in [Graphical Snaps for Ubuntu Core](tutorial/graphical-snaps). In particular, techniques for debugging problems in your snap are not covered.

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

from a layout perspective, I'm not sure a negative admonition immediately following a positive one is a good look - maybe make the negative an ordinary sentence beneath the above small list?


* An Ubuntu desktop running any current release of Ubuntu

* Your Target Device

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

A 'Target Device' from one of the following:

* An Ubuntu desktop running any current release of Ubuntu

* Your Target Device
* Ubuntu Core is available on a range of devices.

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

Ubuntu Core is available on a range of devices. A device running Ubuntu Core.
^ this would also be good with a link to https://www.ubuntu.com/core


* Your Target Device
* Ubuntu Core is available on a range of devices.
This guide shows you how to set up an existing device: [https://developer.ubuntu.com/core/get-started/installation-medias](https://developer.ubuntu.com/core/get-started/installation-medias). If there's no supported image that fits your needs you can [create your own core image](https://tutorials.ubuntu.com/tutorial/create-your-own-core-image).

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

how about supported device rather than existing device, which may confuse the reader.

positive
: **On a Desktop Environment that supports Wayland** you may find that glmark connects to that and not Mir.
This is easy to work around: tell Mir and the snap how to connect to each other:
```

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

missing bash

This comment has been minimized.

@AlanGriffiths

AlanGriffiths Jun 21, 2018

Contributor

Would be nice, but it leads to a stray "bash" in the preformatted block

$SNAP/usr/bin/glmark2-wayland
```
and point the “command:” in the snapcraft.yaml file to it (don’t forget to install it in the snap!!)

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

ellipses?

This comment has been minimized.

@AlanGriffiths

AlanGriffiths Jun 21, 2018

Contributor

I don't follow

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

eg. ...and point the "command:", to avoid starting with a lower case a.

This comment has been minimized.

@AlanGriffiths

AlanGriffiths Jun 21, 2018

Contributor

done

Because snapping applications can reveal lots of hard-coded paths and assumptions that applications make, which snap confinement will break. It is good to understand the steps needed to debug and solve these problems.
There can be many, many environment variables and support files that need to be set up inside snaps, for applications to run correctly. Much of this work has already been done and automated in the *snapcraft-desktop-helpers* project, we will be using this in a follow-up tutorial.

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

project , which we will be using this in a follow-up tutorial.

### Device Setup
Open another terminal and ssh login to your device and logged in install the “mir-kiosk” snap.

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

to your device and from this login install the...

## Snapping to use mir-kiosk
duration: 3:00
Changing this snapcraft.yaml to work with mir-kiosk requires one main alteration: Wayland is provided by another snap: mir-kiosk, so we need to get the Wayland socket from it somehow.

This comment has been minimized.

@degville

degville Jun 21, 2018

Contributor

Replace the first colon with a full stop/period - two colons in a sentence seems a little too much.

@caldav
Copy link
Contributor

caldav left a comment

Thanks for this, I left summary suggestions for both.

@@ -0,0 +1,605 @@
---
id: graphical-snaps
summary: A guide to creating graphical snaps for Ubuntu IoT devices

This comment has been minimized.

@caldav

caldav Jun 21, 2018

Contributor

Suggestion: "A guide to creating graphical snaps for Ubuntu IoT devices. Learn how to build a digital signage app for kiosks, advertising screens and other embedded displays."

@@ -0,0 +1,431 @@
---
id: graphical-snaps-xwayland
summary: A guide to creating graphical snaps for Ubuntu IoT devices

This comment has been minimized.

@caldav

caldav Jun 21, 2018

Contributor

Suggestion: "A guide to creating graphical snaps for Ubuntu IoT devices on top of an XWayland stack. Learn how to build a digital signage app for kiosks, advertising screens and other embedded displays."

AlanGriffiths added some commits Jun 21, 2018

@webteam-app

This comment has been minimized.

Copy link

webteam-app commented Jun 21, 2018

@evilnick

This comment has been minimized.

Copy link
Contributor

evilnick commented Jun 22, 2018

Let us know when you are happy to publish these and I will merge (you will need to change the status in the metadata to 'published' as well

@AlanGriffiths

This comment has been minimized.

Copy link
Contributor

AlanGriffiths commented Jun 22, 2018

@evilnick I'm happy. Pushing the metadata change...

@caldav caldav merged commit a2228dc into canonical-websites:master Jun 25, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Saviq

This comment has been minimized.

Copy link
Contributor

Saviq commented Jun 25, 2018

Aand they're live! https://tutorials.ubuntu.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment