Stork Tutorial: Pacman
Pacman
Stork's package manager (pacman) can help you manage your packages
across all your nodes. Rather than installing or uninstalling packages on
each of your nodes individually, you can assign your nodes to groups and
instruct stork to install or remove packages on those groups. Pacman
is therefore efficient to use when a package needs to be installed on
a large number of nodes. Pacman also allows packages to be automatically
updated when the package creator updates them in the repository; this
allows Stork to be nearly autonomous.
Pacman uses two files; groups and packages. Using storkutil, you can create these two
files and upload them. Stork will then distribute these files to your nodes
and perform the tasks you assigned.
Pacman Groups
Your groups.pacman file allows you organize your nodes into separate
groups. You are allowed to include a node into a group or exclude a node
from a group. You can also include, exclude, or intersect groups with each
other. To define our groups, we can use:
./storkutil.py pacgroups (include|exclude|intersect|remove) group NAME [NAME...]
where group is the name of the group to be affected, and
NAME are the names of the nodes or groups to be included/excluded/removed.
We start by adding a node to a group. If a pacman group file for your
username does not exist, then storkutil will create a new one.
./storkutil.py pacgroups include myGroup foo1.node foo2.node
Using groups file: ./foo.~~~.groups.pacman
File Not Found, Creating New File
File './foo.~~~.groups.pacman' successfully signed
./storkutil.py view groups
Viewing: foo.~~~.groups.pacman
PACMAN GROUP FILE
GROUP: myGroup
INCLUDE: foo1.node
INCLUDE: foo2.node
|
Storkutil will automatically sign the file using your default private key
file, which you created when you generated your first key pairs. If
you want to use a username that is not your default, you can use the --username
option to work on a different file.
We can continue adding more data
into our group definitions. For instance, if we want myGroup to include all the
nodes in the group oldGroup, except for the node badNode which is a member of oldGroup,
we can run the following commands:
./storkutil.py pacgroups include myGroup oldGroup
./storkutil.py pacgroups exclude myGroup badNode
This means that installing a package to myGroup will install it to every node
included in oldGroup except for badNode.
We can remove groups or nodes from a group by simply using the remove
command, as such:
./storkutil.py pacgroups remove myGroup
If you want to
view the contents of the group file, you can use the view groups command in
storkutil, but you will first need to add a node to a group to generate a group file.
When you are done, you will need to upload the groups.pacman file to the Stork repository.
Pacman Packages
The packages.pacman file allows you to manage which packages to
install on which nodes. With the pacman packages file, you can tell a node
or group (as defined by your groups.pacman file) to install or
uninstall a package. To create and modify our packages file, we will use:
./storkutil.py pacpackages (node|group|all) NAME (install|remove|update) PACKAGE
|
We can start by assigning a node to install a package. Be sure your
filename follows the pattern .packages.pacman, where the name is the
one your configured in your Stork configuration file. This will aid
your nodes in finding the correct group file to use. If the file you
specified does not exist, then storkutil will create a new one.
./storkutil.py pacpackages node planetlab.foo.edu install gnuchess
This will assign the planetlab.foo.edu node to install gnuchess.
We can also assign groups to install or remove packages:
./storkutil.py pacpackages group myGroup install lynx man gnuchess
This command will tell myGroup to install the lynx, man, and gnuchess packages
in all the nodes in the group.
We can also instruct Pacman to install packages on multiple nodes without grouping them,
using the all command:
./storkutil.py pacpackages all install gnuchess
Note that in this example, the group and node commands are replaced
with all command, and also that there is no group or node name required. This command
will instruct Stork to install gnuchess on every node to which the packages.pacman file is distributed.
Using the update command, Stork will also instruct all nodes in a group
to update a preexisting package:
./storkutil.py pacpackages group myGroup update gnuchess
This will instruct all myGroup nodes to update gnuchess when necessary.
Storkutil will automatically sign the file using your default private key
file, which you created when you generated your first key pairs.
If you want to work using a different set of keys and files, you can use the
--username option.
You can view the contents of your package file using the view packages
command.
When you are done,
upload your Pacman config file to the Stork repository.
Return to the tutorial contents.
Home Top
|