provisioning/docs/book/quickstart/03-first-deployment.html

447 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>First Deployment - 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/quickstart/03-first-deployment.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="first-deployment"><a class="header" href="#first-deployment">First Deployment</a></h1>
<p>This guide walks you through deploying your first infrastructure using the Provisioning Platform.</p>
<h2 id="overview"><a class="header" href="#overview">Overview</a></h2>
<p>In this chapter, youll:</p>
<ol>
<li>Configure a simple infrastructure</li>
<li>Create your first server</li>
<li>Install a task service (Kubernetes)</li>
<li>Verify the deployment</li>
</ol>
<p>Estimated time: 10-15 minutes</p>
<h2 id="step-1-configure-infrastructure"><a class="header" href="#step-1-configure-infrastructure">Step 1: Configure Infrastructure</a></h2>
<p>Create a basic infrastructure configuration:</p>
<pre><code class="language-bash"># Generate infrastructure template
provisioning generate infra --new my-infra
# This creates: workspace/infra/my-infra/
# - config.toml (infrastructure settings)
# - settings.k (KCL configuration)
</code></pre>
<h2 id="step-2-edit-configuration"><a class="header" href="#step-2-edit-configuration">Step 2: Edit Configuration</a></h2>
<p>Edit the generated configuration:</p>
<pre><code class="language-bash"># Edit with your preferred editor
$EDITOR workspace/infra/my-infra/settings.k
</code></pre>
<p>Example configuration:</p>
<pre><code class="language-kcl">import provisioning.settings as cfg
# Infrastructure settings
infra_settings = cfg.InfraSettings {
name = "my-infra"
provider = "local" # Start with local provider
environment = "development"
}
# Server configuration
servers = [
{
hostname = "dev-server-01"
cores = 2
memory = 4096 # MB
disk = 50 # GB
}
]
</code></pre>
<h2 id="step-3-create-server-check-mode"><a class="header" href="#step-3-create-server-check-mode">Step 3: Create Server (Check Mode)</a></h2>
<p>First, run in check mode to see what would happen:</p>
<pre><code class="language-bash"># Check mode - no actual changes
provisioning server create --infra my-infra --check
# Expected output:
# ✓ Validation passed
# ⚠ Check mode: No changes will be made
#
# Would create:
# - Server: dev-server-01 (2 cores, 4GB RAM, 50GB disk)
</code></pre>
<h2 id="step-4-create-server-real"><a class="header" href="#step-4-create-server-real">Step 4: Create Server (Real)</a></h2>
<p>If check mode looks good, create the server:</p>
<pre><code class="language-bash"># Create server
provisioning server create --infra my-infra
# Expected output:
# ✓ Creating server: dev-server-01
# ✓ Server created successfully
# ✓ IP Address: 192.168.1.100
# ✓ SSH access: ssh user@192.168.1.100
</code></pre>
<h2 id="step-5-verify-server"><a class="header" href="#step-5-verify-server">Step 5: Verify Server</a></h2>
<p>Check server status:</p>
<pre><code class="language-bash"># List all servers
provisioning server list
# Get detailed server info
provisioning server info dev-server-01
# SSH to server (optional)
provisioning server ssh dev-server-01
</code></pre>
<h2 id="step-6-install-kubernetes-check-mode"><a class="header" href="#step-6-install-kubernetes-check-mode">Step 6: Install Kubernetes (Check Mode)</a></h2>
<p>Install a task service on the server:</p>
<pre><code class="language-bash"># Check mode first
provisioning taskserv create kubernetes --infra my-infra --check
# Expected output:
# ✓ Validation passed
# ⚠ Check mode: No changes will be made
#
# Would install:
# - Kubernetes v1.28.0
# - Required dependencies: containerd, etcd
# - On servers: dev-server-01
</code></pre>
<h2 id="step-7-install-kubernetes-real"><a class="header" href="#step-7-install-kubernetes-real">Step 7: Install Kubernetes (Real)</a></h2>
<p>Proceed with installation:</p>
<pre><code class="language-bash"># Install Kubernetes
provisioning taskserv create kubernetes --infra my-infra --wait
# This will:
# 1. Check dependencies
# 2. Install containerd
# 3. Install etcd
# 4. Install Kubernetes
# 5. Configure and start services
# Monitor progress
provisioning workflow monitor &lt;task-id&gt;
</code></pre>
<h2 id="step-8-verify-installation"><a class="header" href="#step-8-verify-installation">Step 8: Verify Installation</a></h2>
<p>Check that Kubernetes is running:</p>
<pre><code class="language-bash"># List installed task services
provisioning taskserv list --infra my-infra
# Check Kubernetes status
provisioning server ssh dev-server-01
kubectl get nodes # On the server
exit
# Or remotely
provisioning server exec dev-server-01 -- kubectl get nodes
</code></pre>
<h2 id="common-deployment-patterns"><a class="header" href="#common-deployment-patterns">Common Deployment Patterns</a></h2>
<h3 id="pattern-1-multiple-servers"><a class="header" href="#pattern-1-multiple-servers">Pattern 1: Multiple Servers</a></h3>
<p>Create multiple servers at once:</p>
<pre><code class="language-kcl">servers = [
{hostname = "web-01", cores = 2, memory = 4096},
{hostname = "web-02", cores = 2, memory = 4096},
{hostname = "db-01", cores = 4, memory = 8192}
]
</code></pre>
<pre><code class="language-bash">provisioning server create --infra my-infra --servers web-01,web-02,db-01
</code></pre>
<h3 id="pattern-2-server-with-multiple-task-services"><a class="header" href="#pattern-2-server-with-multiple-task-services">Pattern 2: Server with Multiple Task Services</a></h3>
<p>Install multiple services on one server:</p>
<pre><code class="language-bash">provisioning taskserv create kubernetes,cilium,postgres --infra my-infra --servers web-01
</code></pre>
<h3 id="pattern-3-complete-cluster"><a class="header" href="#pattern-3-complete-cluster">Pattern 3: Complete Cluster</a></h3>
<p>Deploy a complete cluster configuration:</p>
<pre><code class="language-bash">provisioning cluster create buildkit --infra my-infra
</code></pre>
<h2 id="deployment-workflow"><a class="header" href="#deployment-workflow">Deployment Workflow</a></h2>
<p>The typical deployment workflow:</p>
<pre><code class="language-bash"># 1. Initialize workspace
provisioning workspace init production
# 2. Generate infrastructure
provisioning generate infra --new prod-infra
# 3. Configure (edit settings.k)
$EDITOR workspace/infra/prod-infra/settings.k
# 4. Validate configuration
provisioning validate config --infra prod-infra
# 5. Create servers (check mode)
provisioning server create --infra prod-infra --check
# 6. Create servers (real)
provisioning server create --infra prod-infra
# 7. Install task services
provisioning taskserv create kubernetes --infra prod-infra --wait
# 8. Deploy cluster (if needed)
provisioning cluster create my-cluster --infra prod-infra
# 9. Verify
provisioning server list
provisioning taskserv list
</code></pre>
<h2 id="troubleshooting"><a class="header" href="#troubleshooting">Troubleshooting</a></h2>
<h3 id="server-creation-fails"><a class="header" href="#server-creation-fails">Server Creation Fails</a></h3>
<pre><code class="language-bash"># Check logs
provisioning server logs dev-server-01
# Try with debug mode
provisioning --debug server create --infra my-infra
</code></pre>
<h3 id="task-service-installation-fails"><a class="header" href="#task-service-installation-fails">Task Service Installation Fails</a></h3>
<pre><code class="language-bash"># Check task service logs
provisioning taskserv logs kubernetes
# Retry installation
provisioning taskserv create kubernetes --infra my-infra --force
</code></pre>
<h3 id="ssh-connection-issues"><a class="header" href="#ssh-connection-issues">SSH Connection Issues</a></h3>
<pre><code class="language-bash"># Verify SSH key
ls -la ~/.ssh/
# Test SSH manually
ssh -v user@&lt;server-ip&gt;
# Use provisioning SSH helper
provisioning server ssh dev-server-01 --debug
</code></pre>
<h2 id="next-steps"><a class="header" href="#next-steps">Next Steps</a></h2>
<p>Now that youve completed your first deployment:
<strong><a href="04-verification.html">Verification</a></strong> - Verify your deployment is working correctly</p>
<h2 id="additional-resources"><a class="header" href="#additional-resources">Additional Resources</a></h2>
<ul>
<li><a href="../guides/from-scratch.html">Complete Deployment Guide</a></li>
<li><a href="../user/infrastructure-management.html">Infrastructure Management</a></li>
<li><a href="../user/troubleshooting-guide.html">Troubleshooting Guide</a></li>
</ul>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../quickstart/02-installation.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="../quickstart/04-verification.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="../quickstart/02-installation.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="../quickstart/04-verification.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>