SlideShare a Scribd company logo
Snaps: from Zero to Hero
Dal pacchetto, all’immagine
Marco Trevisan
marco@ubuntu.com
CC BY-SA 3.0
classic
kernel
snappy
os
appapp
kernel config
os writable files
app writable
area
app writable
areaany package can
write to any file
read-only
snaps
writable
spaces
per snap
filesystem
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
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
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
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
alla prova di snapd
Minimum system requirements
Processor Architecture
x86 or ARMv7+ (Cortex-A7 single core)
Memory
256MB
Flash Storage
512MB storage
Available Connectivity types
WiFi, Ethernet, USB, BT4.0 BLE, ..
# Prerequisito: installa snapd nel sistema
# O 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
# 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
# Uno snap più complesso!
$ sudo snap install face-detection-demo --devmode
--beta
# Apri http://localhost:8080 (service).
# Attiva la webcam via web o da:
$ face-detection-demo --enable-camera
# Il comando comunica (via Unix socket)
# col servizio, che è collegato alla webcam
# ed in ascolto sulla rete.
# Utilizza le altre opzioni, disponibili anche
# nell’interfaccia web
# Aggiorna all’ultima versione dell’app!
$ sudo snap refresh face-detection-demo --devmode --edge
# L’interfaccia web non funziona più,
# ed i dati son stati eliminati!
# facciamo il revert per recuperare servizio (e dati!):
$ sudo snap revert face-detection-demo --devmode
# La versione è blacklisted, non viene riscaricata
$ sudo snap refresh face-detection-demo --devmode --edge
$ sudo snap remove face-detection-demo
Build your first snap
Build snaps on classic, deploy on Ubuntu Core
https://tutorials.ubuntu.com/
create-first-snap
build-a-nodejs-service
# Creating this first (non trivial) snap!
# Ensure you have snapcraft installed
$ sudo apt install snapcraft
# Clone our source code
$ git clone
https://github.com/ubuntu/face-detection-demo
--branch vanilla
# Hint: snapcraft.yaml is available at
http://bit.ly/2d9UOKH
# Creazione metadata
$ cd face-detection-demo
$ snapcraft init
# Apri e modifica lo snapcraft.yaml:
name: face-detection-demo
version: ‘1.0’
summary: Demo for Face Detection statistics
description: |
This demo shows face detection statistics
with fun heads.
grade: devel
confinement: devmode
# Adding golang part
parts:
face-detection-backend:
source: .
plugin: go
go-importpath: github.com/ubuntu/face-detection-demo
build-packages:
- build-essential
- libopencv-dev
# Shipping backend assets
parts:
face-detection-backend:
[…]
assets-backend:
source: .
plugin: dump
snap: [images, frontfacedetection.xml]
# And finally, the website part!
parts:
face-detection-backend:
[…]
assets-backend:
[…]
website:
source: https://github.com/ubuntu/face-detection-web.git
plugin: bower
organize:
‘*’: ‘www/’
# First build and install
$ snapcraft
$ sudo snap install *.snap --devmode
# No http://localhost:8080 service or
face-detection-demo CLI!
-> We need to expose them explicitly
# Exposing a command and a service:
apps:
tool:
command: face-detection-cli
service:
command: face-detection-service
daemon: simple
restart-condition: always
# Rebuild, reinstall and profit!
$ snapcraft
$ sudo snap install *.snap --devmode
$ face-detection-demo.tool --help
# Simplifying command name:
apps:
face-detection-demo:
command: face-detection-cli
service:
[…]
# Rebuild, reinstall and check the new command
name!
$ snapcraft
$ sudo snap install *.snap --devmode
$ face-detection-demo --help
# Head over to http://localhost:8080
snapcraft.io/
developer.ubuntu.com/en/snappy
github.com/snapcore/snapd
github.com/snapcore/snapcraft
sudo snap install snap-codelabs
# http://localhost:8123

More Related Content

Similar to Workshop: snap from zero to hero

May The Nodejs Be With You
May The Nodejs Be With YouMay The Nodejs Be With You
May The Nodejs Be With You
Dalibor Gogic
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and Symfony
André Rømcke
 
Ubuntu Core 技术详解
Ubuntu Core 技术详解Ubuntu Core 技术详解
Ubuntu Core 技术详解
Rex Tsai
 
Setting Up a Cloud Server - Part 3 - Transcript.pdf
Setting Up a Cloud Server - Part 3 - Transcript.pdfSetting Up a Cloud Server - Part 3 - Transcript.pdf
Setting Up a Cloud Server - Part 3 - Transcript.pdf
ShaiAlmog1
 
Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13
Rafael Dohms
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
晓东 杜
 
ERP System Implementation Kubernetes Cluster with Sticky Sessions
ERP System Implementation Kubernetes Cluster with Sticky Sessions ERP System Implementation Kubernetes Cluster with Sticky Sessions
ERP System Implementation Kubernetes Cluster with Sticky Sessions
Chanaka Lasantha
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
adrian_nye
 
Command line for the beginner - Using the command line in developing for the...
Command line for the beginner -  Using the command line in developing for the...Command line for the beginner -  Using the command line in developing for the...
Command line for the beginner - Using the command line in developing for the...
Jim Birch
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
Christophe Muller
 
Backtrack Manual Part4
Backtrack Manual Part4Backtrack Manual Part4
Backtrack Manual Part4
Nutan Kumar Panda
 
Composer: putting dependencies on the score
Composer: putting dependencies on the scoreComposer: putting dependencies on the score
Composer: putting dependencies on the score
Rafael Dohms
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
Carlos Sanchez
 
Command Line Applications with Ruby
Command Line Applications with RubyCommand Line Applications with Ruby
Command Line Applications with Ruby
Alexander Merkulov
 
Composer, putting dependencies on the score
Composer, putting dependencies on the scoreComposer, putting dependencies on the score
Composer, putting dependencies on the score
Rafael Dohms
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltStack
 
Capistrano Overview
Capistrano OverviewCapistrano Overview
Capistrano Overview
Travis Roberts
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
Eric D. Schabell
 
Snaps on open suse
Snaps on open suseSnaps on open suse
Snaps on open suse
Zygmunt Krynicki
 
DockerCon EU 2018 - Dockerfile Best Practices
DockerCon EU 2018 - Dockerfile Best PracticesDockerCon EU 2018 - Dockerfile Best Practices
DockerCon EU 2018 - Dockerfile Best Practices
Tibor Vass
 

Similar to Workshop: snap from zero to hero (20)

May The Nodejs Be With You
May The Nodejs Be With YouMay The Nodejs Be With You
May The Nodejs Be With You
 
Getting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and SymfonyGetting instantly up and running with Docker and Symfony
Getting instantly up and running with Docker and Symfony
 
Ubuntu Core 技术详解
Ubuntu Core 技术详解Ubuntu Core 技术详解
Ubuntu Core 技术详解
 
Setting Up a Cloud Server - Part 3 - Transcript.pdf
Setting Up a Cloud Server - Part 3 - Transcript.pdfSetting Up a Cloud Server - Part 3 - Transcript.pdf
Setting Up a Cloud Server - Part 3 - Transcript.pdf
 
Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13Composer for Busy Developers - php|tek13
Composer for Busy Developers - php|tek13
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 
ERP System Implementation Kubernetes Cluster with Sticky Sessions
ERP System Implementation Kubernetes Cluster with Sticky Sessions ERP System Implementation Kubernetes Cluster with Sticky Sessions
ERP System Implementation Kubernetes Cluster with Sticky Sessions
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Command line for the beginner - Using the command line in developing for the...
Command line for the beginner -  Using the command line in developing for the...Command line for the beginner -  Using the command line in developing for the...
Command line for the beginner - Using the command line in developing for the...
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Backtrack Manual Part4
Backtrack Manual Part4Backtrack Manual Part4
Backtrack Manual Part4
 
Composer: putting dependencies on the score
Composer: putting dependencies on the scoreComposer: putting dependencies on the score
Composer: putting dependencies on the score
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Command Line Applications with Ruby
Command Line Applications with RubyCommand Line Applications with Ruby
Command Line Applications with Ruby
 
Composer, putting dependencies on the score
Composer, putting dependencies on the scoreComposer, putting dependencies on the score
Composer, putting dependencies on the score
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
Capistrano Overview
Capistrano OverviewCapistrano Overview
Capistrano Overview
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
 
Snaps on open suse
Snaps on open suseSnaps on open suse
Snaps on open suse
 
DockerCon EU 2018 - Dockerfile Best Practices
DockerCon EU 2018 - Dockerfile Best PracticesDockerCon EU 2018 - Dockerfile Best Practices
DockerCon EU 2018 - Dockerfile Best Practices
 

More from Marco Trevisan

State of the GNOME - 2022 - Ubuntu Summit
State of the GNOME - 2022 - Ubuntu SummitState of the GNOME - 2022 - Ubuntu Summit
State of the GNOME - 2022 - Ubuntu Summit
Marco Trevisan
 
Ubucon 19 - The making of ubuntu desktop for 20.04
Ubucon 19 - The making of ubuntu desktop for 20.04Ubucon 19 - The making of ubuntu desktop for 20.04
Ubucon 19 - The making of ubuntu desktop for 20.04
Marco Trevisan
 
Introduzione ad ubuntu core - Qt day 2017
Introduzione ad ubuntu core  - Qt day 2017Introduzione ad ubuntu core  - Qt day 2017
Introduzione ad ubuntu core - Qt day 2017
Marco Trevisan
 
Introduzione ad ubuntu core
Introduzione ad ubuntu coreIntroduzione ad ubuntu core
Introduzione ad ubuntu core
Marco Trevisan
 
Alla scoperta di Ubuntu Phone, lo smartphone Open Source
Alla scoperta di Ubuntu Phone, lo smartphone Open SourceAlla scoperta di Ubuntu Phone, lo smartphone Open Source
Alla scoperta di Ubuntu Phone, lo smartphone Open Source
Marco Trevisan
 
Unity: la shell di Ubuntu Phone
Unity: la shell di Ubuntu PhoneUnity: la shell di Ubuntu Phone
Unity: la shell di Ubuntu Phone
Marco Trevisan
 
Introduzione ad Autopilot
Introduzione ad AutopilotIntroduzione ad Autopilot
Introduzione ad Autopilot
Marco Trevisan
 
Unity: la shell di ubuntu
Unity: la shell di ubuntuUnity: la shell di ubuntu
Unity: la shell di ubuntu
Marco Trevisan
 
Openmoko - La costruzione di un “Telefoninux”
Openmoko - La costruzione di un “Telefoninux”Openmoko - La costruzione di un “Telefoninux”
Openmoko - La costruzione di un “Telefoninux”
Marco Trevisan
 

More from Marco Trevisan (9)

State of the GNOME - 2022 - Ubuntu Summit
State of the GNOME - 2022 - Ubuntu SummitState of the GNOME - 2022 - Ubuntu Summit
State of the GNOME - 2022 - Ubuntu Summit
 
Ubucon 19 - The making of ubuntu desktop for 20.04
Ubucon 19 - The making of ubuntu desktop for 20.04Ubucon 19 - The making of ubuntu desktop for 20.04
Ubucon 19 - The making of ubuntu desktop for 20.04
 
Introduzione ad ubuntu core - Qt day 2017
Introduzione ad ubuntu core  - Qt day 2017Introduzione ad ubuntu core  - Qt day 2017
Introduzione ad ubuntu core - Qt day 2017
 
Introduzione ad ubuntu core
Introduzione ad ubuntu coreIntroduzione ad ubuntu core
Introduzione ad ubuntu core
 
Alla scoperta di Ubuntu Phone, lo smartphone Open Source
Alla scoperta di Ubuntu Phone, lo smartphone Open SourceAlla scoperta di Ubuntu Phone, lo smartphone Open Source
Alla scoperta di Ubuntu Phone, lo smartphone Open Source
 
Unity: la shell di Ubuntu Phone
Unity: la shell di Ubuntu PhoneUnity: la shell di Ubuntu Phone
Unity: la shell di Ubuntu Phone
 
Introduzione ad Autopilot
Introduzione ad AutopilotIntroduzione ad Autopilot
Introduzione ad Autopilot
 
Unity: la shell di ubuntu
Unity: la shell di ubuntuUnity: la shell di ubuntu
Unity: la shell di ubuntu
 
Openmoko - La costruzione di un “Telefoninux”
Openmoko - La costruzione di un “Telefoninux”Openmoko - La costruzione di un “Telefoninux”
Openmoko - La costruzione di un “Telefoninux”
 

Recently uploaded

Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 

Recently uploaded (20)

Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 

Workshop: snap from zero to hero

  • 1. Snaps: from Zero to Hero Dal pacchetto, all’immagine Marco Trevisan marco@ubuntu.com CC BY-SA 3.0
  • 2. classic kernel snappy os appapp kernel config os writable files app writable area app writable areaany package can write to any file read-only snaps writable spaces per snap filesystem
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. 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
  • 8. Minimum system requirements Processor Architecture x86 or ARMv7+ (Cortex-A7 single core) Memory 256MB Flash Storage 512MB storage Available Connectivity types WiFi, Ethernet, USB, BT4.0 BLE, ..
  • 9. # Prerequisito: installa snapd nel sistema # O 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
  • 10. # 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
  • 11. # Uno snap più complesso! $ sudo snap install face-detection-demo --devmode --beta # Apri http://localhost:8080 (service). # Attiva la webcam via web o da: $ face-detection-demo --enable-camera # Il comando comunica (via Unix socket) # col servizio, che è collegato alla webcam # ed in ascolto sulla rete. # Utilizza le altre opzioni, disponibili anche # nell’interfaccia web
  • 12. # Aggiorna all’ultima versione dell’app! $ sudo snap refresh face-detection-demo --devmode --edge # L’interfaccia web non funziona più, # ed i dati son stati eliminati! # facciamo il revert per recuperare servizio (e dati!): $ sudo snap revert face-detection-demo --devmode # La versione è blacklisted, non viene riscaricata $ sudo snap refresh face-detection-demo --devmode --edge $ sudo snap remove face-detection-demo
  • 14. Build snaps on classic, deploy on Ubuntu Core
  • 16. # Creating this first (non trivial) snap! # Ensure you have snapcraft installed $ sudo apt install snapcraft # Clone our source code $ git clone https://github.com/ubuntu/face-detection-demo --branch vanilla # Hint: snapcraft.yaml is available at http://bit.ly/2d9UOKH
  • 17. # Creazione metadata $ cd face-detection-demo $ snapcraft init # Apri e modifica lo snapcraft.yaml: name: face-detection-demo version: ‘1.0’ summary: Demo for Face Detection statistics description: | This demo shows face detection statistics with fun heads. grade: devel confinement: devmode
  • 18. # Adding golang part parts: face-detection-backend: source: . plugin: go go-importpath: github.com/ubuntu/face-detection-demo build-packages: - build-essential - libopencv-dev
  • 19. # Shipping backend assets parts: face-detection-backend: […] assets-backend: source: . plugin: dump snap: [images, frontfacedetection.xml]
  • 20. # And finally, the website part! parts: face-detection-backend: […] assets-backend: […] website: source: https://github.com/ubuntu/face-detection-web.git plugin: bower organize: ‘*’: ‘www/’
  • 21. # First build and install $ snapcraft $ sudo snap install *.snap --devmode # No http://localhost:8080 service or face-detection-demo CLI! -> We need to expose them explicitly
  • 22. # Exposing a command and a service: apps: tool: command: face-detection-cli service: command: face-detection-service daemon: simple restart-condition: always # Rebuild, reinstall and profit! $ snapcraft $ sudo snap install *.snap --devmode $ face-detection-demo.tool --help
  • 23. # Simplifying command name: apps: face-detection-demo: command: face-detection-cli service: […] # Rebuild, reinstall and check the new command name! $ snapcraft $ sudo snap install *.snap --devmode $ face-detection-demo --help # Head over to http://localhost:8080