Configuring Backy on A tool for commands http://example.org/config/index.html Recent content in Configuring Backy on A tool for commands Hugo -- gohugo.io en-us Commands http://example.org/config/commands/index.html Mon, 01 Jan 0001 00:00:00 +0000 http://example.org/config/commands/index.html <p>The yaml top-level map can be any string.</p> <p>The top-level name must be unique.</p> <h3 id="example-config">Example Config</h3> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">commands</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">stop-docker-container</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">cmd</span>: <span style="color:#ae81ff">docker</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">Args</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">compose</span> </span></span><span style="display:flex;"><span> - -<span style="color:#ae81ff">f /some/path/to/docker-compose.yaml</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">down</span> </span></span><span style="display:flex;"><span> <span style="color:#75715e"># if host is not defined, command will be run locally</span> </span></span><span style="display:flex;"><span> <span style="color:#75715e"># The host has to be defined in either the config file or the SSH Config files</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">host</span>: <span style="color:#ae81ff">some-host</span> </span></span><span style="display:flex;"><span> <span style="color:#ae81ff">hooks</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">error</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">some-other-command-when-failing</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">success</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">success-command</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">final</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">final-command</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">backup-docker-container-script</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">cmd</span>: <span style="color:#ae81ff">/path/to/local/script</span> </span></span><span style="display:flex;"><span> <span style="color:#75715e"># script file is input as stdin to SSH</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">type</span>: <span style="color:#ae81ff">scriptFile</span> <span style="color:#75715e"># also can be script</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">environment</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">FOO=BAR</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">APP=$VAR</span> </span></span></code></pre></div><p>Values available for this section:</p> Command Lists http://example.org/config/command-lists/index.html Mon, 01 Jan 0001 00:00:00 +0000 http://example.org/config/command-lists/index.html <p>Command lists are for executing commands in sequence and getting notifications from them.</p> <p>The top-level object key can be anything you want but not the same as another.</p> <p>Lists can go in a separate file. Command lists should be in a separate file if:</p> <ol> <li>key &lsquo;cmd-lists.file&rsquo; is found</li> <li>hosts.yml or hosts.yaml is found in the same directory as the backy config file</li> </ol> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span> <span style="color:#f92672">test2</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">name</span>: <span style="color:#ae81ff">test2</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">order</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">test</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">test2</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">notifications</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">mail.prod-email</span> </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">matrix.sysadmin</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">cron</span>: <span style="color:#e6db74">&#34;0 * * * * *&#34;</span> </span></span></code></pre></div><table> <thead> <tr> <th style="text-align: left">key</th> <th style="text-align: left">description</th> <th style="text-align: left">type</th> <th style="text-align: left">required</th> </tr> </thead> <tbody> <tr> <td style="text-align: left"><code>order</code></td> <td style="text-align: left">Defines the sequence of commands to execute</td> <td style="text-align: left"><code>[]string</code></td> <td style="text-align: left">yes</td> </tr> <tr> <td style="text-align: left"><code>getOutput</code></td> <td style="text-align: left">Command(s) output is in the notification(s)</td> <td style="text-align: left"><code>bool</code></td> <td style="text-align: left">no</td> </tr> <tr> <td style="text-align: left"><code>notifications</code></td> <td style="text-align: left">The notification service(s) and ID(s) to use on success and failure. Must be <em><code>service.id</code></em>. See the <a href="http://example.org/config/notifications/">notifications documentation page</a> for more</td> <td style="text-align: left"><code>[]string</code></td> <td style="text-align: left">no</td> </tr> <tr> <td style="text-align: left"><code>name</code></td> <td style="text-align: left">Optional name of the list</td> <td style="text-align: left"><code>string</code></td> <td style="text-align: left">no</td> </tr> <tr> <td style="text-align: left"><code>cron</code></td> <td style="text-align: left">Time at which to schedule the list. Only has affect when cron subcommand is run.</td> <td style="text-align: left"><code>string</code></td> <td style="text-align: left">no</td> </tr> </tbody> </table> <h3 id="order">Order</h3> <p>The order is an array of commands to execute in order. Each command must be defined.</p> Notifications http://example.org/config/notifications/index.html Mon, 01 Jan 0001 00:00:00 +0000 http://example.org/config/notifications/index.html <p>Notifications can be sent on command list completion and failure.</p> <p>The supported platforms for notifications are email (SMTP) and <a href="https://matrix.org/" target="_blank">Matrix</a>.</p> <p>Notifications are defined by service, with the current form following below. Ids must come after the service.</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">notifications</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">mail</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">prod-email</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">host</span>: <span style="color:#ae81ff">yourhost.tld</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">port</span>: <span style="color:#ae81ff">587</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">senderaddress</span>: <span style="color:#ae81ff">email@domain.tld</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">to</span>: </span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">admin@domain.tld</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">username</span>: <span style="color:#ae81ff">smtp-username@domain.tld</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">password</span>: <span style="color:#ae81ff">your-password-here</span> </span></span><span style="display:flex;"><span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">matrix</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">matrix</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">home-server</span>: <span style="color:#ae81ff">your-home-server.tld</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">room-id</span>: <span style="color:#ae81ff">room-id</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">access-token</span>: <span style="color:#ae81ff">your-access-token</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">user-id</span>: <span style="color:#ae81ff">your-user-id</span> </span></span></code></pre></div><p>Sections recognized are <code>mail</code> and <code>matrix</code></p> <p>There must be a section with an id (eg. <code>mail.test-svr</code>) following one of these sections.</p> Vault http://example.org/config/vault/index.html Mon, 01 Jan 0001 00:00:00 +0000 http://example.org/config/vault/index.html <p><a href="https://www.vaultproject.io/" target="_blank">Vault</a> is a tool for storing secrets and other data securely.</p> <p>Vault config can be used by prefixing <code>vault:</code> in front of a password or ENV var.</p> <p>This is the object in the config file:</p> <div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">vault</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">token</span>: <span style="color:#ae81ff">hvs.tXqcASvTP8wg92f7riyvGyuf</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">address</span>: <span style="color:#ae81ff">http://127.0.0.1:8200</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">enabled</span>: <span style="color:#66d9ef">false</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">keys</span>: </span></span><span style="display:flex;"><span> - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">mongourl</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">mountpath</span>: <span style="color:#ae81ff">secret</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">path</span>: <span style="color:#ae81ff">mongo/url</span> </span></span><span style="display:flex;"><span> <span style="color:#f92672">type</span>: <span style="color:#75715e"># KVv1 or KVv2</span> </span></span><span style="display:flex;"><span> - <span style="color:#f92672">name</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">path</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">type</span>: </span></span><span style="display:flex;"><span> <span style="color:#f92672">mountpath</span>: </span></span></code></pre></div>