updatectl
lets you control and test the CoreOS update service. Subcommands
let you manage applications, users, groups, packages and write a very simple client that gets
its state via environment variables.
There are a few flags that you must provide to the administrative commands below.
--user
is your username, usually this is an email address oradmin
--key
is your API key--server
is the URL to your update service instance
The commands below will all have a prefix like this:
./bin/updatectl --user=admin --key=d3b07384d113edec49eaa6238ad5ff00 --server=https://example.update.core-os.net
If you do not wish to specify these every time, they can also be exported as environment variables like this:
export UPDATECTL_USER=admin
export UPDATECTL_KEY=d3b07384d113edec49eaa6238ad5ff00
export UPDATECTL_SERVER=http://localhost:8000
There are two tools to test out the update service: instance fake
and watch
.
instance fake
simulates a number of clients from a single
command. watch
is
used to quickly implement a simple update client with a minimal amount of code.
This example will start 132 fake instances pinging the update service every 1 to 50 seconds against the CoreOS application's UUID and put them in the beta group starting at version 1.0.0.
./bin/updatectl instance fake --clients-per-app=132 --min-sleep=1 \
--max-sleep=50 --app-id=e96281a6-d1af-4bde-9a0a-97b76e56dc57 \
--group-id=beta --version=1.0.0
Real clients should implement the Omaha protocol but if you want a fast way to
create your own client you can use watch
. This will exec a program of your
choosing every time a new update is available.
First, create a simple application that dumps the environment variables that
the watcher will pass in. Call the script updater.sh
.
#!/bin/sh
env | grep UPDATE_SERVICE
Next we will generate a random client UUID and start watching for changes to the given app:
./bin/updatectl watch --app-id=e96281a6-d1af-4bde-9a0a-97b76e56dc57 \
--group-id=beta ./updater.sh
If you change the version of the beta group's channel then your script will be re-executed and you will see the UPDATE_SERVICE environment variables change.
Applications have three pieces of data: a universal unique identifier (UUID), a label and a description. During a request to the update service, the UUID is submitted in order to retrieve the details of the currently available version.
Create an application called CoreOS using its UUID along with a nice description.
./bin/updatectl app create --app-id=e96281a6-d1af-4bde-9a0a-97b76e56dc57 --label="CoreOS" --description="Linux for Servers"
./bin/updatectl app list
Packages represent an individual version of an application and the URL associated with it.
This will create a new package with version 1.0.5 from the file update.gz
.
./bin/updatectl package create --app-id=e96281a6-d1af-4bde-9a0a-97b76e56dc57 \
--version=1.0.5 --file=update.gz \
The --meta
option allows you to specify a cryptographic signature
and file size for verification purposes. It should look like this:
{"metadata_size":"1024", "metadata_signature_rsa":"<insert hash here>"}
./bin/updatectl package list --app-id=e96281a6-d1af-4bde-9a0a-97b76e56dc57
A channel gives a nice symbolic name to packages. A group tracks a specific channel. Think of channels as a DNS name for a package.
A channel has a version of individual applications. To change the version of an
application specify the app id, channel and the version that channel
should present. Additionally you can publish a channel by setting the --publish
flag, if not specified publish will always be set to false
.
./bin/updatectl channel update --app-id=e96281a6-d1af-4bde-9a0a-97b76e56dc57 --channel=master --version=1.0.1 --publish=true
Instances get their updates by giving the service a combination of their group and application id. Groups are usually some division of data centers, environments or customers.
Create a group for the CoreOS application pointing at the master channel called testing. This group might be used in your test environment.
./bin/updatectl group create --app-id=e96281a6-d1af-4bde-9a0a-97b76e56dc57 \
--channel=master --group-id=testing --label="Testing Group"
./bin/updatectl group pause --app-id=e96281a6-d1af-4bde-9a0a-97b76e56dc57 --group-id=testing
./bin/updatectl group list
Label Token UpdatesPaused
Default Group default false
The service keeps track of instances and gives you a number of tools to see their
state. Most of these endpoints are more nicely consumed via the control panel
but you can use them from updatectl
too.
This will list all instances that have been seen since the given timestamp.
./bin/updatectl instance list-updates --start=1392401442
This will list the instances grouped by AppId and Version
./bin/updatectl instance list-app-versions --start=1392401442
./bin/updatectl admin-user create [email protected]
./bin/updatectl admin-user list
./bin/updatectl admin-user delete [email protected]