~snappy-dev/snapcraft/core

« back to all changes in this revision

Viewing changes to docs/intro.md

  • Committer: Snappy Tarmac
  • Author(s): Michael Terry, Michael Vogt
  • Date: 2015-08-04 21:01:35 UTC
  • mfrom: (105.3.11 docs-1)
  • Revision ID: snappy_tarmac-20150804210135-w8e1to44t689ju6k
Add intro and tutorial docs.

The intro file explains Snappy and the general Snapcraft concepts a bit.  It covers the same material as flow.md, so I dropped that file.

The tutorial file goes through crafting a webcam demo snap [1].

I want to add an installing/testing/uploading-to-store section too, but I want to get some experience using the webcam bit and dealing with apparmor for it (seeing if I can get kvm to use my laptop webcam or if I need to have a real USB webcam with a beaglebone).  But that addition can happen in a separate branch.

This is taking over from lp:~mvo/snapcraft/docs-1 since mvo is on vacation.

[1] Very similar to https://developer.ubuntu.com/en/snappy/guides/appliance-builder-guide-webcam/ by snappy-dev approved by elopio

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Intro
 
2
 
 
3
Snapcraft allows easy crafting of packages for Snappy Ubuntu. It makes it
 
4
easy to incorporate components from different sources like GitHub, Launchpad,
 
5
or npm.
 
6
 
 
7
# Snappy
 
8
 
 
9
Snappy Ubuntu Core is a new rendition of Ubuntu with transactional updates — a
 
10
minimal server image with the same libraries as today’s Ubuntu, but
 
11
applications are provided through a simpler mechanism.
 
12
 
 
13
Snappy apps and Ubuntu Core itself can be upgraded atomically and rolled back
 
14
if needed. Apps are also strictly confined and sandboxed to safeguard your
 
15
data and system.
 
16
 
 
17
# Key concepts
 
18
 
 
19
A .snap package for the Ubuntu Core system contains all its
 
20
dependencies. This has a couple of advantages over traditional deb or
 
21
rpm based dependency handling, the most important being that a
 
22
developer can always be assured that there are no regressions triggered by
 
23
changes to the system underneath their app.
 
24
 
 
25
Snapcraft makes bundling these dependencies easy by allowing you to
 
26
specify them as “parts” in the snapcraft.yaml file.
 
27
 
 
28
## Parts
 
29
 
 
30
A central aspect of a snapcraft recipe is a “part”. A part is a piece
 
31
of software or data that the snap package requires to work or to
 
32
build other parts. Each part is managed by a snapcraft plugin and parts
 
33
are usually independent of each other.
 
34
 
 
35
## Plugins
 
36
 
 
37
Snapcraft plugins are written in Python and have a yaml
 
38
description. A lot of default plugins are included, for example for
 
39
projects written in Go, Java, Python or C. It is also possible
 
40
to simply download binary content as part of the snapcraft recipe.
 
41
 
 
42
## Lifecycle
 
43
 
 
44
Each part goes through the following steps:
 
45
 
 
46
### Pull
 
47
 
 
48
The first is that each part is pulled. This step will download
 
49
content, e.g. checkout a git repository or download a binary component
 
50
like the Java SDK. Snapcraft will create a parts/ directory with
 
51
sub-directories like parts/part-name/src for each part that contains
 
52
the downloaded content.
 
53
 
 
54
#### Build
 
55
 
 
56
The next step is that each part is built in its parts/part-name/build
 
57
directory and installs itself into parts/part-name/install.
 
58
 
 
59
### Stage
 
60
 
 
61
After the build of each part the parts are combined into a single
 
62
directory tree that is called the “staging area”. It can be found
 
63
under the ./stage directory.
 
64
 
 
65
This ./stage directory is useful for building outside code that isn’t in the
 
66
snapcraft.yaml recipe against the snap contents. For example, you might build a
 
67
local project against the libraries in ./stage by running
 
68
`snapcraft shell make`. Though in general, you are encouraged to add even local
 
69
projects to snapcraft.yaml with a local `source:` path.
 
70
 
 
71
### Snap
 
72
 
 
73
The snap step moves the data into a ./snap directory. It contains only
 
74
the content that will be put into the final snap package, unlike the staging
 
75
area which may include some development files not destined for your package.
 
76
 
 
77
The Snappy metadata information about your project will also now be placed in
 
78
./snap/meta.
 
79
 
 
80
This ./snap directory is useful for inspecting what is going into your snap
 
81
and to make any final post-processing on snapcraft’s output.
 
82
 
 
83
### Assemble
 
84
 
 
85
The final step builds a snap package out of the snap directory. This .snap file
 
86
can be uploaded to the Ubuntu Store and published directly to Snappy users.
 
87
 
 
88
# Next
 
89
 
 
90
After introducing the key concept of snapcraft it is probably a good
 
91
time to look at the tutorial in docs/tutorial.md to see how it works
 
92
for an example project.