lorax/docs/html/composer-cli.html

479 lines
24 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>composer-cli &mdash; Lorax 28.14.59 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Product and Updates Images" href="product-images.html" />
<link rel="prev" title="lorax-composer" href="lorax-composer.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Lorax
</a>
<div class="version">
28.14.59
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction to Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="intro.html#before-lorax">Before Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="lorax.html">Lorax</a></li>
<li class="toctree-l1"><a class="reference internal" href="livemedia-creator.html">livemedia-creator</a></li>
<li class="toctree-l1"><a class="reference internal" href="mkksiso.html">mkksiso</a></li>
<li class="toctree-l1"><a class="reference internal" href="lorax-composer.html">lorax-composer</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">composer-cli</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#composer-cli-cmdline-arguments">composer-cli cmdline arguments</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#Positional Arguments">Positional Arguments</a></li>
<li class="toctree-l3"><a class="reference internal" href="#Named Arguments">Named Arguments</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#edit-a-blueprint">Edit a Blueprint</a></li>
<li class="toctree-l2"><a class="reference internal" href="#build-an-image">Build an image</a></li>
<li class="toctree-l2"><a class="reference internal" href="#monitor-the-build-status">Monitor the build status</a></li>
<li class="toctree-l2"><a class="reference internal" href="#download-the-image">Download the image</a></li>
<li class="toctree-l2"><a class="reference internal" href="#image-uploads">Image Uploads</a></li>
<li class="toctree-l2"><a class="reference internal" href="#providers">Providers</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#aws">AWS</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#build-an-image-and-upload-results">Build an image and upload results</a></li>
<li class="toctree-l2"><a class="reference internal" href="#debugging">Debugging</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="product-images.html">Product and Updates Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="modules.html">pylorax</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Lorax</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
<li>composer-cli</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/composer-cli.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="composer-cli">
<h1>composer-cli<a class="headerlink" href="#composer-cli" title="Permalink to this headline"></a></h1>
<dl class="field-list simple">
<dt class="field-odd">Authors</dt>
<dd class="field-odd"><p>Brian C. Lane &lt;<a class="reference external" href="mailto:bcl&#37;&#52;&#48;redhat&#46;com">bcl<span>&#64;</span>redhat<span>&#46;</span>com</a>&gt;</p>
</dd>
</dl>
<p><code class="docutils literal notranslate"><span class="pre">composer-cli</span></code> is an interactive tool for use with a WELDR API server,
managing blueprints, exploring available packages, and building new images.
<cite>lorax-composer &lt;lorax-composer.html&gt;</cite> and <cite>osbuild-composer
&lt;https://osbuild.org&gt;</cite> both implement compatible servers.</p>
<p>It requires server to be installed on the local system, and the user running it
needs to be a member of the <code class="docutils literal notranslate"><span class="pre">weldr</span></code> group. They do not need to be root, but
all of the <a class="reference external" href="lorax-composer.html#security">security precautions</a> apply.</p>
<section id="composer-cli-cmdline-arguments">
<h2>composer-cli cmdline arguments<a class="headerlink" href="#composer-cli-cmdline-arguments" title="Permalink to this headline"></a></h2>
<p><p>Lorax Composer commandline tool</p>
</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">usage</span><span class="p">:</span> <span class="n">composer</span><span class="o">-</span><span class="n">cli</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">j</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">s</span> <span class="n">SOCKET</span><span class="p">]</span> <span class="p">[</span><span class="o">--</span><span class="n">log</span> <span class="n">LOG</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">a</span> <span class="n">APIVER</span><span class="p">]</span>
<span class="p">[</span><span class="o">--</span><span class="n">test</span> <span class="n">TESTMODE</span><span class="p">]</span> <span class="p">[</span><span class="o">-</span><span class="n">V</span><span class="p">]</span>
<span class="o">...</span>
</pre></div>
</div>
<section id="Positional Arguments">
<h3>Positional Arguments<a class="headerlink" href="#Positional Arguments" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd>args</kbd></dt>
<dd></dd>
</dl>
</section>
<section id="Named Arguments">
<h3>Named Arguments<a class="headerlink" href="#Named Arguments" title="Permalink to this headline"></a></h3>
<dl class="option-list">
<dt><kbd>-j, --json</kbd></dt>
<dd><p>Output the raw JSON response instead of the normal output.</p>
<p>Default: False</p>
</dd>
<dt><kbd>-s, --socket</kbd></dt>
<dd><p>Path to the socket file to listen on</p>
<p>Default: “/run/weldr/api.socket”</p>
</dd>
<dt><kbd>--log</kbd></dt>
<dd><p>Path to logfile (./composer-cli.log)</p>
</dd>
<dt><kbd>-a, --api</kbd></dt>
<dd><p>API Version to use (overrides server API version)</p>
</dd>
<dt><kbd>--test</kbd></dt>
<dd><p>Pass test mode to compose. 1=Mock compose with fail. 2=Mock compose with finished.</p>
<p>Default: 0</p>
</dd>
<dt><kbd>-V</kbd></dt>
<dd><p>show programs version number and exit</p>
<p>Default: False</p>
</dd>
</dl>
</section>
<p><dl class="simple">
<dt>compose start [size XXXX] &lt;BLUEPRINT&gt; &lt;TYPE&gt; [&lt;IMAGE-NAME&gt; &lt;PROVIDER&gt; &lt;PROFILE&gt; | &lt;IMAGE-NAME&gt; &lt;PROFILE.TOML&gt;]</dt><dd><p>Start a compose using the selected blueprint and output type. size is in MiB.
NOTE: uploading and size are only supported by osbuild-composer.</p>
</dd>
<dt>compose start-ostree [size XXXX] [parent PARENT] [ref REF] [url url] &lt;BLUEPRINT&gt; &lt;TYPE&gt; [&lt;IMAGE-NAME&gt; &lt;PROFILE.TOML&gt;]</dt><dd><p>Start an ostree compose using the selected blueprint and output type. Optionally start an upload. This command
is only supported by osbuild-composer. size is in MiB.</p>
</dd>
<dt>compose types</dt><dd><p>List the supported output types.</p>
</dd>
<dt>compose status</dt><dd><p>List the status of all running and finished composes.</p>
</dd>
<dt>compose list [waiting|running|finished|failed]</dt><dd><p>List basic information about composes.</p>
</dd>
<dt>compose log &lt;UUID&gt; [&lt;SIZE&gt;]</dt><dd><p>Show the last SIZE kB of the compose log.</p>
</dd>
<dt>compose cancel &lt;UUID&gt;</dt><dd><p>Cancel a running compose and delete any intermediate results.</p>
</dd>
<dt>compose delete &lt;UUID,…&gt;</dt><dd><p>Delete the listed compose results.</p>
</dd>
<dt>compose info &lt;UUID&gt;</dt><dd><p>Show detailed information on the compose.</p>
</dd>
<dt>compose metadata &lt;UUID&gt;</dt><dd><p>Download the metadata use to create the compose to &lt;uuid&gt;-metadata.tar</p>
</dd>
<dt>compose logs &lt;UUID&gt;</dt><dd><p>Download the compose logs to &lt;uuid&gt;-logs.tar</p>
</dd>
<dt>compose results &lt;UUID&gt;</dt><dd><p>Download all of the compose results; metadata, logs, and image to &lt;uuid&gt;.tar</p>
</dd>
<dt>compose image &lt;UUID&gt;</dt><dd><p>Download the output image from the compose. Filename depends on the type.</p>
</dd>
<dt>blueprints list</dt><dd><p>List the names of the available blueprints.</p>
</dd>
<dt>blueprints show &lt;BLUEPRINT,…&gt;</dt><dd><p>Display the blueprint in TOML format.</p>
</dd>
<dt>blueprints changes &lt;BLUEPRINT,…&gt;</dt><dd><p>Display the changes for each blueprint.</p>
</dd>
<dt>blueprints diff &lt;BLUEPRINT&gt; &lt;FROM-COMMIT&gt; &lt;TO-COMMIT&gt;</dt><dd><p>Display the differences between 2 versions of a blueprint.
FROM-COMMIT can be a commit hash or NEWEST
TO-COMMIT can be a commit hash, NEWEST, or WORKSPACE</p>
</dd>
<dt>blueprints save &lt;BLUEPRINT,…&gt;</dt><dd><p>Save the blueprint to a file, &lt;BLUEPRINT&gt;.toml</p>
</dd>
<dt>blueprints delete &lt;BLUEPRINT&gt;</dt><dd><p>Delete a blueprint from the server</p>
</dd>
<dt>blueprints depsolve &lt;BLUEPRINT,…&gt;</dt><dd><p>Display the packages needed to install the blueprint.</p>
</dd>
<dt>blueprints push &lt;BLUEPRINT&gt;</dt><dd><p>Push a blueprint TOML file to the server.</p>
</dd>
<dt>blueprints freeze &lt;BLUEPRINT,…&gt;</dt><dd><p>Display the frozen blueprints modules and packages.</p>
</dd>
<dt>blueprints freeze show &lt;BLUEPRINT,…&gt;</dt><dd><p>Display the frozen blueprint in TOML format.</p>
</dd>
<dt>blueprints freeze save &lt;BLUEPRINT,…&gt;</dt><dd><p>Save the frozen blueprint to a file, &lt;blueprint-name&gt;.frozen.toml.</p>
</dd>
<dt>blueprints tag &lt;BLUEPRINT&gt;</dt><dd><p>Tag the most recent blueprint commit as a release.</p>
</dd>
<dt>blueprints undo &lt;BLUEPRINT&gt; &lt;COMMIT&gt;</dt><dd><p>Undo changes to a blueprint by reverting to the selected commit.</p>
</dd>
<dt>blueprints workspace &lt;BLUEPRINT&gt;</dt><dd><p>Push the blueprint TOML to the temporary workspace storage.</p>
</dd>
<dt>modules list</dt><dd><p>List the available modules.</p>
</dd>
<dt>projects list</dt><dd><p>List the available projects.</p>
</dd>
<dt>projects info &lt;PROJECT,…&gt;</dt><dd><p>Show details about the listed projects.</p>
</dd>
<dt>sources list</dt><dd><p>List the available sources</p>
</dd>
<dt>sources info &lt;SOURCE-NAME,…&gt;</dt><dd><p>Details about the source.</p>
</dd>
<dt>sources add &lt;SOURCE.TOML&gt;</dt><dd><p>Add a package source to the server.</p>
</dd>
<dt>sources change &lt;SOURCE.TOML&gt;</dt><dd><p>Change an existing source</p>
</dd>
<dt>sources delete &lt;SOURCE-NAME&gt;</dt><dd><p>Delete a package source.</p>
</dd>
</dl>
<p>status show Show API server status.</p>
<p>NOTE: uploading is only available as part of the compose command
using the osbuild-composer API server.</p>
</p>
</section>
<section id="edit-a-blueprint">
<h2>Edit a Blueprint<a class="headerlink" href="#edit-a-blueprint" title="Permalink to this headline"></a></h2>
<p>Start out by listing the available blueprints using <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">blueprints</span>
<span class="pre">list</span></code>, pick one and save it to the local directory by running <code class="docutils literal notranslate"><span class="pre">composer-cli</span>
<span class="pre">blueprints</span> <span class="pre">save</span> <span class="pre">http-server</span></code>. If there are no blueprints available you can
copy one of the examples <a class="reference external" href="https://github.com/weldr/lorax/tree/rhel8-branch/tests/pylorax/blueprints/">from the test suite</a>.</p>
<p>Edit the file (it will be saved with a .toml extension) and change the
description, add a package or module to it. Send it back to the server by
running <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">blueprints</span> <span class="pre">push</span> <span class="pre">http-server.toml</span></code>. You can verify that it was
saved by viewing the changelog - <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">blueprints</span> <span class="pre">changes</span> <span class="pre">http-server</span></code>.</p>
<p>The full blueprint documentation <a class="reference external" href="https://www.osbuild.org/guides/blueprint-reference/blueprint-reference.html">is here</a>.</p>
</section>
<section id="build-an-image">
<h2>Build an image<a class="headerlink" href="#build-an-image" title="Permalink to this headline"></a></h2>
<p>Build a <code class="docutils literal notranslate"><span class="pre">qcow2</span></code> disk image from this blueprint by running <code class="docutils literal notranslate"><span class="pre">composer-cli</span>
<span class="pre">compose</span> <span class="pre">start</span> <span class="pre">http-server</span> <span class="pre">qcow2</span></code>. It will print a UUID that you can use to
keep track of the build. You can also cancel the build if needed.</p>
<p>The available types of images is displayed by <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">types</span></code>.
Currently this consists of: alibaba, ami, ext4-filesystem, google, live-iso,
openstack, partitioned-disk, qcow2, tar, vhd, vmdk</p>
</section>
<section id="monitor-the-build-status">
<h2>Monitor the build status<a class="headerlink" href="#monitor-the-build-status" title="Permalink to this headline"></a></h2>
<p>Monitor it using <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">status</span></code>, which will show the status of
all the builds on the system. You can view the end of the anaconda build logs
once it is in the <code class="docutils literal notranslate"><span class="pre">RUNNING</span></code> state using <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">log</span> <span class="pre">UUID</span></code>
where UUID is the UUID returned by the start command.</p>
<p>Once the build is in the <code class="docutils literal notranslate"><span class="pre">FINISHED</span></code> state you can download the image.</p>
</section>
<section id="download-the-image">
<h2>Download the image<a class="headerlink" href="#download-the-image" title="Permalink to this headline"></a></h2>
<p>Downloading the final image is done with <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">image</span> <span class="pre">UUID</span></code> and it will
save the qcow2 image as <code class="docutils literal notranslate"><span class="pre">UUID-disk.qcow2</span></code> which you can then use to boot a VM like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">qemu</span><span class="o">-</span><span class="n">kvm</span> <span class="o">--</span><span class="n">name</span> <span class="n">test</span><span class="o">-</span><span class="n">image</span> <span class="o">-</span><span class="n">m</span> <span class="mi">1024</span> <span class="o">-</span><span class="n">hda</span> <span class="o">./</span><span class="n">UUID</span><span class="o">-</span><span class="n">disk</span><span class="o">.</span><span class="n">qcow2</span>
</pre></div>
</div>
</section>
<section id="image-uploads">
<h2>Image Uploads<a class="headerlink" href="#image-uploads" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">composer-cli</span></code> can upload the images to a number of services, including AWS,
OpenStack, and vSphere. The upload can be started when the build is finished
by using <code class="docutils literal notranslate"><span class="pre">composer-cli</span> <span class="pre">compose</span> <span class="pre">start</span> <span class="pre">...</span></code>. In order to access the service you need
to pass authentication details to composer-cli using a TOML file.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is only supported when running the <code class="docutils literal notranslate"><span class="pre">osbuild-composer</span></code> API server.</p>
</div>
</section>
<section id="providers">
<h2>Providers<a class="headerlink" href="#providers" title="Permalink to this headline"></a></h2>
<p>Providers are where the images are uploaded to. You
will need to gather some provider
specific information in order to authenticate with it. Please refer to the <code class="docutils literal notranslate"><span class="pre">osbuild-composer</span></code>
documentation for the provider specific fields. You will then create a TOML file with the
name of the provider and the settings, like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">provider</span> <span class="o">=</span> <span class="s2">&quot;aws&quot;</span>
<span class="p">[</span><span class="n">settings</span><span class="p">]</span>
<span class="n">aws_access_key</span> <span class="o">=</span> <span class="s2">&quot;AWS Access Key&quot;</span>
<span class="n">aws_bucket</span> <span class="o">=</span> <span class="s2">&quot;AWS Bucket&quot;</span>
<span class="n">aws_region</span> <span class="o">=</span> <span class="s2">&quot;AWS Region&quot;</span>
<span class="n">aws_secret_key</span> <span class="o">=</span> <span class="s2">&quot;AWS Secret Key&quot;</span>
</pre></div>
</div>
<p>Save this into an <code class="docutils literal notranslate"><span class="pre">aws-credentials.toml</span></code> file and use it when running <code class="docutils literal notranslate"><span class="pre">start</span></code>.</p>
<section id="aws">
<h3>AWS<a class="headerlink" href="#aws" title="Permalink to this headline"></a></h3>
<p>The access key and secret key can be created by going to the
<code class="docutils literal notranslate"><span class="pre">IAM-&gt;Users-&gt;Security</span> <span class="pre">Credentials</span></code> section and creating a new access key. The
secret key will only be shown when it is first created so make sure to record
it in a secure place. The region should be the region that you want to use the
AMI in, and the bucket can be an existing bucket, or a new one, following the
normal AWS bucket naming rules. It will be created if it doesnt already exist.</p>
<p>When uploading the image it is first uploaded to the s3 bucket, and then
converted to an AMI. If the conversion is successful the s3 object will be
deleted. If it fails, re-trying after correcting the problem will re-use the
object if you have not deleted it in the meantime, speeding up the process.</p>
</section>
</section>
<section id="build-an-image-and-upload-results">
<h2>Build an image and upload results<a class="headerlink" href="#build-an-image-and-upload-results" title="Permalink to this headline"></a></h2>
<p>With the settings stored in a TOML file:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">composer</span><span class="o">-</span><span class="n">cli</span> <span class="n">compose</span> <span class="n">start</span> <span class="n">example</span><span class="o">-</span><span class="n">http</span><span class="o">-</span><span class="n">server</span> <span class="n">ami</span> <span class="s2">&quot;http image&quot;</span> <span class="n">aws</span><span class="o">-</span><span class="n">settings</span><span class="o">.</span><span class="n">toml</span>
</pre></div>
</div>
<p>It will return the UUID of the image build. Once
the build has finished successfully it will start the upload process.</p>
</section>
<section id="debugging">
<h2>Debugging<a class="headerlink" href="#debugging" title="Permalink to this headline"></a></h2>
<p>There are a couple of arguments that can be helpful when debugging problems.
These are only meant for debugging and should not be used to script access to
the API. If you need to do that you can communicate with it directly in the
language of your choice.</p>
<p><code class="docutils literal notranslate"><span class="pre">--json</span></code> will return the servers response as a nicely formatted json output
instead of printing what the command would usually print.</p>
<p><code class="docutils literal notranslate"><span class="pre">--test=1</span></code> will cause a compose start to start creating an image, and then
end with a failed state.</p>
<p><code class="docutils literal notranslate"><span class="pre">--test=2</span></code> will cause a compose to start and then end with a finished state,
without actually composing anything.</p>
</section>
</section>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="product-images.html" class="btn btn-neutral float-right" title="Product and Updates Images" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="lorax-composer.html" class="btn btn-neutral float-left" title="lorax-composer" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2018-2019, Red Hat, Inc..
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>