provisioning/docs/book/guides/update-infrastructure.html

442 lines
20 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE HTML>
<html lang="en" class="ayu sidebar-visible" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Update Infrastructure - Provisioning Platform Documentation</title>
<!-- Custom HTML head -->
<meta name="description" content="Complete documentation for the Provisioning Platform - Infrastructure automation with Nushell, KCL, and Rust">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="../favicon.svg">
<link rel="shortcut icon" href="../favicon.png">
<link rel="stylesheet" href="../css/variables.css">
<link rel="stylesheet" href="../css/general.css">
<link rel="stylesheet" href="../css/chrome.css">
<link rel="stylesheet" href="../css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="../fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" id="highlight-css" href="../highlight.css">
<link rel="stylesheet" id="tomorrow-night-css" href="../tomorrow-night.css">
<link rel="stylesheet" id="ayu-highlight-css" href="../ayu-highlight.css">
<!-- Custom theme stylesheets -->
<!-- Provide site root and default themes to javascript -->
<script>
const path_to_root = "../";
const default_light_theme = "ayu";
const default_dark_theme = "navy";
</script>
<!-- Start loading toc.js asap -->
<script src="../toc.js"></script>
</head>
<body>
<div id="mdbook-help-container">
<div id="mdbook-help-popup">
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
<div>
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
<p>Press <kbd>?</kbd> to show this help</p>
<p>Press <kbd>Esc</kbd> to hide this help</p>
</div>
</div>
</div>
<div id="body-container">
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
let theme = localStorage.getItem('mdbook-theme');
let sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
let theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
const html = document.documentElement;
html.classList.remove('ayu')
html.classList.add(theme);
html.classList.add("js");
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
let sidebar = null;
const sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<!-- populated by js -->
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
<noscript>
<iframe class="sidebar-iframe-outer" src="../toc.html"></iframe>
</noscript>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="default_theme">Auto</button></li>
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Provisioning Platform Documentation</h1>
<div class="right-buttons">
<a href="../print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/provisioning/provisioning-platform" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
<a href="https://github.com/provisioning/provisioning-platform/edit/main/provisioning/docs/src/guides/update-infrastructure.md" title="Suggest an edit" aria-label="Suggest an edit">
<i id="git-edit-button" class="fa fa-edit"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="update-infrastructure-guide"><a class="header" href="#update-infrastructure-guide">Update Infrastructure Guide</a></h1>
<p>Guide for safely updating existing infrastructure deployments.</p>
<h2 id="overview"><a class="header" href="#overview">Overview</a></h2>
<p>This guide covers strategies and procedures for updating provisioned infrastructure, including servers, task services, and cluster configurations.</p>
<h2 id="prerequisites"><a class="header" href="#prerequisites">Prerequisites</a></h2>
<p>Before updating infrastructure:</p>
<ul>
<li>✅ Backup current configuration</li>
<li>✅ Test updates in development environment</li>
<li>✅ Review changelog and breaking changes</li>
<li>✅ Schedule maintenance window</li>
</ul>
<h2 id="update-strategies"><a class="header" href="#update-strategies">Update Strategies</a></h2>
<h3 id="1-in-place-update"><a class="header" href="#1-in-place-update">1. In-Place Update</a></h3>
<p>Update existing resources without replacement:</p>
<pre><code class="language-bash"># Check for available updates
provisioning version check
# Update specific taskserv
provisioning taskserv update kubernetes --version 1.29.0 --check
# Update all taskservs
provisioning taskserv update --all --check
</code></pre>
<p><strong>Pros</strong>: Fast, no downtime
<strong>Cons</strong>: Risk of service interruption</p>
<hr />
<h3 id="2-rolling-update"><a class="header" href="#2-rolling-update">2. Rolling Update</a></h3>
<p>Update resources one at a time:</p>
<pre><code class="language-bash"># Enable rolling update strategy
provisioning config set update.strategy rolling
# Update cluster with rolling strategy
provisioning cluster update my-cluster --rolling --max-unavailable 1
</code></pre>
<p><strong>Pros</strong>: No downtime, gradual rollout
<strong>Cons</strong>: Slower, requires multiple nodes</p>
<hr />
<h3 id="3-blue-green-deployment"><a class="header" href="#3-blue-green-deployment">3. Blue-Green Deployment</a></h3>
<p>Create new infrastructure alongside old:</p>
<pre><code class="language-bash"># Create new "green" environment
provisioning workspace create my-cluster-green
# Deploy updated infrastructure
provisioning cluster create my-cluster --workspace my-cluster-green
# Test green environment
provisioning test env cluster my-cluster-green
# Switch traffic to green
provisioning cluster switch my-cluster-green --production
# Cleanup old "blue" environment
provisioning workspace delete my-cluster-blue --confirm
</code></pre>
<p><strong>Pros</strong>: Zero downtime, easy rollback
<strong>Cons</strong>: Requires 2x resources temporarily</p>
<hr />
<h2 id="update-procedures"><a class="header" href="#update-procedures">Update Procedures</a></h2>
<h3 id="updating-task-services"><a class="header" href="#updating-task-services">Updating Task Services</a></h3>
<pre><code class="language-bash"># List installed taskservs with versions
provisioning taskserv list --with-versions
# Check for updates
provisioning taskserv check-updates
# Update specific service
provisioning taskserv update kubernetes \
--version 1.29.0 \
--backup \
--check
# Verify update
provisioning taskserv status kubernetes
</code></pre>
<h3 id="updating-server-configuration"><a class="header" href="#updating-server-configuration">Updating Server Configuration</a></h3>
<pre><code class="language-bash"># Update server plan (resize)
provisioning server update web-01 \
--plan 4xCPU-8GB \
--check
# Update server zone (migrate)
provisioning server migrate web-01 \
--to-zone us-west-2 \
--check
</code></pre>
<h3 id="updating-cluster-configuration"><a class="header" href="#updating-cluster-configuration">Updating Cluster Configuration</a></h3>
<pre><code class="language-bash"># Update cluster configuration
provisioning cluster update my-cluster \
--config updated-config.k \
--backup \
--check
# Apply configuration changes
provisioning cluster apply my-cluster
</code></pre>
<h2 id="rollback-procedures"><a class="header" href="#rollback-procedures">Rollback Procedures</a></h2>
<p>If update fails, rollback to previous state:</p>
<pre><code class="language-bash"># List available backups
provisioning backup list
# Rollback to specific backup
provisioning backup restore my-cluster-20251010-1200 --confirm
# Verify rollback
provisioning cluster status my-cluster
</code></pre>
<h2 id="post-update-verification"><a class="header" href="#post-update-verification">Post-Update Verification</a></h2>
<p>After updating, verify system health:</p>
<pre><code class="language-bash"># Check system status
provisioning status
# Verify all services
provisioning taskserv list --health
# Run smoke tests
provisioning test quick kubernetes
provisioning test quick postgres
# Check orchestrator
provisioning workflow orchestrator
</code></pre>
<h2 id="update-best-practices"><a class="header" href="#update-best-practices">Update Best Practices</a></h2>
<h3 id="before-update"><a class="header" href="#before-update">Before Update</a></h3>
<ol>
<li><strong>Backup everything</strong>: <code>provisioning backup create --all</code></li>
<li><strong>Review docs</strong>: Check taskserv update notes</li>
<li><strong>Test first</strong>: Use test environment</li>
<li><strong>Schedule window</strong>: Plan for maintenance time</li>
</ol>
<h3 id="during-update"><a class="header" href="#during-update">During Update</a></h3>
<ol>
<li><strong>Monitor logs</strong>: <code>provisioning logs follow</code></li>
<li><strong>Check health</strong>: <code>provisioning health</code> continuously</li>
<li><strong>Verify phases</strong>: Ensure each phase completes</li>
<li><strong>Document changes</strong>: Keep update log</li>
</ol>
<h3 id="after-update"><a class="header" href="#after-update">After Update</a></h3>
<ol>
<li><strong>Verify functionality</strong>: Run test suite</li>
<li><strong>Check performance</strong>: Monitor metrics</li>
<li><strong>Review logs</strong>: Check for errors</li>
<li><strong>Update documentation</strong>: Record changes</li>
<li><strong>Cleanup</strong>: Remove old backups after verification</li>
</ol>
<h2 id="automated-updates"><a class="header" href="#automated-updates">Automated Updates</a></h2>
<p>Enable automatic updates for non-critical updates:</p>
<pre><code class="language-bash"># Configure auto-update policy
provisioning config set auto-update.enabled true
provisioning config set auto-update.strategy minor
provisioning config set auto-update.schedule "0 2 * * 0" # Weekly Sunday 2AM
# Check auto-update status
provisioning config show auto-update
</code></pre>
<h2 id="update-notifications"><a class="header" href="#update-notifications">Update Notifications</a></h2>
<p>Configure notifications for update events:</p>
<pre><code class="language-bash"># Enable update notifications
provisioning config set notifications.updates.enabled true
provisioning config set notifications.updates.email "admin@example.com"
# Test notifications
provisioning test notification update-available
</code></pre>
<h2 id="troubleshooting-updates"><a class="header" href="#troubleshooting-updates">Troubleshooting Updates</a></h2>
<h3 id="common-issues"><a class="header" href="#common-issues">Common Issues</a></h3>
<p><strong>Update Fails Mid-Process</strong>:</p>
<pre><code class="language-bash"># Check update status
provisioning update status
# Resume failed update
provisioning update resume --from-checkpoint
# Or rollback
provisioning update rollback
</code></pre>
<p><strong>Service Incompatibility</strong>:</p>
<pre><code class="language-bash"># Check compatibility
provisioning taskserv compatibility kubernetes 1.29.0
# See dependency tree
provisioning taskserv dependencies kubernetes
</code></pre>
<p><strong>Configuration Conflicts</strong>:</p>
<pre><code class="language-bash"># Validate configuration
provisioning validate config
# Show configuration diff
provisioning config diff --before --after
</code></pre>
<h2 id="related-documentation"><a class="header" href="#related-documentation">Related Documentation</a></h2>
<ul>
<li><strong><a href="../quickstart/01-prerequisites.html">Quick Start Guide</a></strong> - Initial setup</li>
<li><strong><a href="../user/SERVICE_MANAGEMENT_GUIDE.html">Service Management</a></strong> - Service operations</li>
<li><strong><a href="../operations/backup-restore.html">Backup &amp; Restore</a></strong> - Backup procedures</li>
<li><strong><a href="../user/troubleshooting-guide.html">Troubleshooting</a></strong> - Common issues</li>
</ul>
<hr />
<p><strong>Need Help?</strong> Run <code>provisioning help update</code> or see <a href="../user/troubleshooting-guide.html">Troubleshooting Guide</a>.</p>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../guides/from-scratch.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="../guides/customize-infrastructure.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="../guides/from-scratch.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="../guides/customize-infrastructure.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<!-- Livereload script (if served using the cli tool) -->
<script>
const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsAddress = wsProtocol + "//" + location.host + "/" + "__livereload";
const socket = new WebSocket(wsAddress);
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload();
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script>
window.playground_copyable = true;
</script>
<script src="../elasticlunr.min.js"></script>
<script src="../mark.min.js"></script>
<script src="../searcher.js"></script>
<script src="../clipboard.min.js"></script>
<script src="../highlight.js"></script>
<script src="../book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>