Introduzione ad ubuntu core - Qt day 2017
-
Upload
marco-trevisan -
Category
Technology
-
view
103 -
download
1
Transcript of Introduzione ad ubuntu core - Qt day 2017
![Page 1: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/1.jpg)
Marco TrevisanSoftware Engineer - Ubuntu Desktop Team
[email protected]@3v1n0 · +MarcoTrevisan · irc://Trevinho
Snappy, ovvero
![Page 2: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/2.jpg)
We are the company behind Ubuntu.
![Page 3: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/3.jpg)
Ubuntu e Canonical
EMPLOYEES
500+COUNTRIES
49+FOUNDED
2004
Canonical sviluppa il sistema operativo dal 2004, ed adesso sta estendendo Ubuntu su dispositivi mobili ed IoT.
Ubuntu è un sistema operativo attualmente disponibile su server, cloud personal computer, telefoni e dispositivi IoT.
![Page 4: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/4.jpg)
![Page 5: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/5.jpg)
Ubuntu Linux, il più utilizzato per lo sviluppo
Source: Eclipse Foundation + StackOverflow survey
Mint Fedora Debian Other Ubuntu
2% 2%
3%
6%
17%
![Page 6: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/6.jpg)
dalla nuvola alle cose
![Page 7: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/7.jpg)
Ubuntu già da vita a dispositivi IoT
Smart drone controllers
Advanced robotics
Home gateways Industrial gateways
Smart drone controllers
Advanced robotics
Home gateways Edge gateways Digital Signage
Digital Signage
![Page 8: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/8.jpg)
Le sfide dell’IoT
Sicurezza Aggiornamenti Monetizzazione
1 2 3
![Page 9: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/9.jpg)
Ma siam davvero sicuri?!?
Hackers remotely kill a jeep on the highway – with me in it.Andy Greenberg
![Page 10: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/10.jpg)
Aggiornamenti, non raffreddori!
Nest thermostat glitchleaves users in the coldNick Bilton
![Page 11: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/11.jpg)
Fosse solo hardware…Accessori, tools e servizi indotti.
E magari facciamoci anche cassa!
![Page 12: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/12.jpg)
Dispositivi Linux
distribuitiindirizzatieconomci
vulnerabile
Difficile da gestire e riparare
Server Linux
centralizzatosupportato
costosoridondante
Economico da gestire e riparare
![Page 13: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/13.jpg)
source: https://www.flickr.com/photos/mom2sofia/8394217408/in/photostream/
![Page 14: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/14.jpg)
source: https://www.reddit.com/r/funny/comments/2ad0s8/apparently_ace_ventura_is_my_new_fedex_guy/
![Page 15: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/15.jpg)
source: http://nathantracy.net/
![Page 16: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/16.jpg)
A minimal, secure, transactional Ubuntu designed for IoT
![Page 17: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/17.jpg)
Ubuntu Core: piccolo, sicuro, veloce
Tutto il meglio di Ubuntu in uno spazio nato per tutti i dispositivi
Aggiornamenti transizionali
Sistema di pacchetti semplice da creare, mantenere e fare il deploy
Sicurezza in primo piano
![Page 18: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/18.jpg)
Mettiamolo a dieta quest’Ubuntu!
DIMENSIONE DELL’IMMAGINE
776 MB
Ubuntu Core CentOS Atomic Host 7
350 MB
![Page 19: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/19.jpg)
Abbiamo gli snap!
![Page 20: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/20.jpg)
![Page 21: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/21.jpg)
Snap - pacchetti Linux universali
Distro supportate Snap / framework
Sicuri | Facili da creare | Transazionali | Appstore-friendly
![Page 22: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/22.jpg)
Ubuntu classic Ubuntu Core
Kernel 4.4
Kernel 4.4
Applicazioni confinate come snap, senza dipendenze
OS minimale come snap
Kernel, anche questo uno snap
Pacchetto di Sistema
App B Libreria DriverApp A
Legenda
![Page 23: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/23.jpg)
Interazione tra snap
app snapapp snap
app writable area
app writable area
Le app sono confinate ed isolate
app snap
app writable area
app snap
app writable area
![Page 24: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/24.jpg)
Aggiornamenti Atomici: Apps, OS e kernel
DatiArea scrivibile
Snap originarioAggiornamento
Dati aggiornatiArea scrivibile
Snap aggiornato
Dati originariArea scrivibile
I dati precedenti vengono mantenuti
sul device
Snap orgiginario
Dati precedentiArea scrivibile
Snap precedente
Rollback in caso di fallimento
![Page 25: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/25.jpg)
Un appstore per tutti i gusti...
![Page 26: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/26.jpg)
$600 drone (hardware)
Business App
Farmers ($500)Avalanches ($2500)Miners ($9950)
Sicurezza. Aggiornamenti. Guadagno. Long Term Support.
… gestibile dal produttore ...
![Page 27: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/27.jpg)
… Con tutti i numeri alla mano
![Page 28: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/28.jpg)
Dal codice al metallo...
Snapcraft → Build → Store → Deploy: Tutto in mano ai developers!
![Page 29: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/29.jpg)
18.04 (TBD) 9 mo
Trusted by Linux developers
Long Term Support Developer Release
Ubuntu 14.04 LTS (Kernel 3.13)
Ubuntu 16.04 LTS (Kernel 4.4)
Ubuntu 18.04 LTS (TBD)
...
5 yrs
5 yrs
5 yrs
14.10 (3.16) 9 mo
15.04 (3.19) 9 mo
15.10 (4.2) 9 mo
16.10 (4.8) 9 mo
17.04 (TBD) 9 mo
17.10 (TBD) 9 mo
14.04 14.10 15.04 15.10 16.04 16.10 17.04 17.10 18.04 18.10 19.04
Ubuntu Core 16 (Kernel 4.4) 5 yrs
Ubuntu 18.04 LTS (TBD) 5 yrs
![Page 30: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/30.jpg)
● Docker e LXC sono container○ Un unico processo con una gestione a sé○ Kernel condiviso, proprio filesystem
● Snap si occupa di confinare○ Le app nei pacchetti snap sono avviate e
gestite dal kernel come gli altri processi nel sistema
○ Kernel/rete condivisi, filesystem solo parzialmente proprio
○ Processi controllati dai tool classici○ Non c’è bisogno di fare routing○ I file sono accessibili direttamente (se
consentito)○ Multi-utente, un’unica istanza per app
LXD
snap
Contenere o Confinare, questo è il problema!
![Page 31: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/31.jpg)
Perfetto per tutti i dispositivi
I Vendor controllano la distribuzione delle loro app direttamente, e dei gadget snap (kernel, o driver specifici)
Platform condivise per estendere il sistema operativo con librerie riutilizzabili da più snap
Il sistema di base è Ubuntu: per sempre libero e gratuito.
![Page 32: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/32.jpg)
Hardware alla mano...
Processori
Intel x86 or ARMv7/v8 (Cortex-A7)
Memoria
256MB+
Flash
4GB System storage
Connettività disponibile
WiFi, Ethernet, USB, BT4.0 BLE, …
Board supportate ufficialmente
Raspberry Pi, Dragonboard, Intel DUC e Joule, Artik, …
![Page 33: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/33.jpg)
Scoperchiamo il core
![Page 34: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/34.jpg)
classic
kernel
snappy
os
appapp
kernel config
Scribile dall’OS
Area scrivibile dall’app
Area scrivibile dall’app
Un pacchetto può scrivere in qualsiasi area
Snapsin sola lettura
Aree scrivibiliper snap
filesystem
![Page 35: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/35.jpg)
versioned root writable area(for services)
$SNAP_DATA
common root writable area(for services)
$SNAP_COMMON
versioned user writable area
$SNAP_USER_DATA
/tmp (per service and app)/tmp (per service and
app)/tmp
(per service and app process)
snap code & assets(squashfs, RO bind-mounted in /snap/<snap_name>/<version>)
$SNAP
Service
common user writable area
$SNAP_USER_COMMON
Service CLI GUI
![Page 36: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/36.jpg)
versioned root writable area(for services)
$SNAP_DATA
common root writable area(for services)
$SNAP_COMMON
versioned user writable area
$SNAP_USER_DATA
/tmp (per service and app)/tmp (per service and
app)/tmp
(per service and app process)
~
/dev/<device>
/sys
/(from
core snap)
/var/lib/snapd/hostfs(/ from host)
snap code & assets(squashfs, RO bind-mounted in /snap/<snap_name>/<version>)
$SNAP
Service
common user writable area
$SNAP_USER_COMMON
Service CLI GUI
![Page 37: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/37.jpg)
Interazione tra snap
app snapapp snap
app writable area
app writable area
Le app sono confinate ed isolate
app snap
app writable area
app snap
app writable area
![Page 38: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/38.jpg)
Ubuntu Core: un sistema all-snaps!
Ed un sistema moderno per creare distribuzioni
Kernel snap
Core snap
Gadget snap
App snap
App snap
App snap
Content interface snap
● Integrità assicurata da un sistema in sola lettura squashfs● Non serve riflashare tutto quando cambia un componente
![Page 39: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/39.jpg)
alla prova di snapd
![Page 40: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/40.jpg)
# Prerequisito: installa snapd nel sistema# Od usa un immagine per KVM di Ubuntu-core# http://snapcraft.io
# Installa ed esegui il tuo primo snap$ snap find hello$ sudo snap install hello$ hello$ snap list
# Snap può fornire servizi e diversi binari$ hello$ hello.universe
![Page 41: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/41.jpg)
# Aggiorna gli snap nel sistema (automatico)$ sudo snap refresh
# Passa alla versione di “hello” di un altro# canale$ sudo snap refresh hello --beta$ hello
# Rimuove uno snap$ sudo snap remove hello
![Page 42: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/42.jpg)
# Uno snap più complesso!$ snap info qml-hello-world
name: qml-hello-worldsummary: "Get started in the fantastic QML world"publisher: 3v1n0description: | Snap me, please. And see how I run qml! https://github.com/3v1n0/snap-qml-hello-world commands: - qml-hello-world - qml-hello-world.qtquick-controlstracking: candidateinstalled: 0.2-wow-version (3) 76MB -refreshed: 2017-06-24 01:44:53 +0200 CESTchannels: stable: 0.1-awesome-version (2) 76MB - candidate: 0.2-wow-version (3) 76MB - beta: ↑ edge: ↑
![Page 43: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/43.jpg)
# Installa lo snap in version stabile$ snap install qml-hello-world
# Aggiorna all’ultima versione dell’app!$ snap refresh qml-hello-world --candidate
# Se non dovesse più funzionare a dovere...$ snap revert qml-hello-world --devmode
# La versione è blacklisted, non viene# riscaricata mentre la versione funzionante# in stable viene ripristinata
![Page 44: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/44.jpg)
Si… Ma come si fannogli snap?
Mettiamoli al servizio di
![Page 45: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/45.jpg)
Crea gli snap in classic, li usi su Ubuntu Core
![Page 46: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/46.jpg)
https://tutorials.ubuntu.com/
create-first-snap
![Page 47: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/47.jpg)
# Per far gli snap, serve snapcraft$ sudo apt install snapcraft
# Un nuovo progetto si inizia con$ snapcraft init
# Il codice d’esempio$ git clone \ https://github.com/3v1n0/snap-qml-hello-world
# Hint: snapcraft.yaml nella cartella ‘snap’
![Page 48: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/48.jpg)
# Il file yaml… Nel suo complesso
name: qml-hello-worldversion: '0.1-awesome-version'icon: qt-logo.svgsummary: Get started in the fantastic QML worlddescription: | Snap me, please. And see how I run qml! https://github.com/3v1n0/snap-qml-hello-world
grade: stableconfinement: strict
parts: hello-world: plugin: nil source: . after: [ desktop-qt5 ] stage-packages: [ qmlscene, qml-module-qtquick2 ] install: | cp -v hello-world.qml qt-logo.svg $SNAPCRAFT_PART_INSTALL
apps: qml-hello-world: command: desktop-launch qmlscene $SNAP/hello-world.qml plugs: [ x11 ]
![Page 49: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/49.jpg)
# Metadati di base del file yaml
name: qml-hello-worldversion: '0.1-awesome-version'icon: qt-logo.svgsummary: Get started in the QML worlddescription: | Snap me, please. And see how I run qml!
grade: stableconfinement: strict
![Page 50: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/50.jpg)
# Le parti del file yaml
parts: hello-world-qml: plugin: nil source: . after: [ desktop-qt5 ] stage-packages: - qmlscene - module-qtquick2 install: | cp -v hello-world.qml qt-logo.svg \ $SNAPCRAFT_PART_INSTALL
![Page 51: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/51.jpg)
# Le app incluse
apps: qml-hello-world: command: | desktop-launch qmlscene \ $SNAP/hello-world.qml plugs: [ x11 ]
![Page 52: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/52.jpg)
# Genera lo snap:$ snapcraft
# prova lo snap$ snap try prime$ snap run qml-hello-world
# E poi distribuiscilo al mondo!$ snap register qml-hello-world$ snap push qml-hello-world*.snap \ --release [stable|candidate|beta|edge]
# Sì, *adesso* chiunque può installarlo
![Page 53: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/53.jpg)
Build.snapcraft.iogoditi il tuo tempo, a compilare ci pensa lui
(in sicurezza, multi-arch, ed affidabilità)
![Page 54: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/54.jpg)
Gestisci cicli di rilascio, versioni senza limiti
![Page 55: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/55.jpg)
Esempi di snapcraft.yaml e Qt:
- QtWidgets e librerie condivise
- QtWidgets e librerie statiche(ricompilando qt)
- Applicazione complessa con molte librerie di terze parti sia statiche che condivise con versione custom di Qt:
http://go.3v1n0.net/snapcraft-qt-examples
![Page 56: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/56.jpg)
snapcraft.io
developer.ubuntu.com/en/snappy
github.com/snapcore/snapd
github.com/snapcore/snapcraft
sudo snap install snap-codelabs# http://localhost:8123
![Page 57: Introduzione ad ubuntu core - Qt day 2017](https://reader031.fdocuments.net/reader031/viewer/2022030318/5a6483777f8b9a36568b4c1f/html5/thumbnails/57.jpg)
Per saperne di piùubuntu.com
· @3v1n0
· +MarcoTrevisan
· irc://freenode/Trevinho