-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforge-deployment.html.backup
More file actions
628 lines (569 loc) · 29.7 KB
/
forge-deployment.html.backup
File metadata and controls
628 lines (569 loc) · 29.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
<!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ForgeDeployment - Forge Kernel Documentation</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="assets/css/docs.css">
</head>
<body class="bg-gray-50 text-gray-900">
<!-- Navigation -->
<nav class="bg-white shadow-sm border-b">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex items-center">
<div class="flex-shrink-0">
<h1 class="text-xl font-bold text-gray-900">
Forge Kernel
</h1>
</div>
<div class="hidden sm:ml-6 sm:flex sm:space-x-8">
<a href="index.html"
class="text-gray-900 inline-flex items-center px-1 pt-1 text-sm font-medium hover:text-blue-600">
Home
</a>
<a href="getting-started.html"
class="text-gray-900 inline-flex items-center px-1 pt-1 text-sm font-medium hover:text-blue-600">
Getting Started
</a>
<a href="core-concepts.html"
class="text-gray-900 inline-flex items-center px-1 pt-1 text-sm font-medium hover:text-blue-600">
Core Concepts
</a>
<a href="modules.html"
class="text-gray-900 inline-flex items-center px-1 pt-1 text-sm font-medium hover:text-blue-600">
Capabilities
</a>
<a href="api-reference.html"
class="text-gray-900 inline-flex items-center px-1 pt-1 text-sm font-medium hover:text-blue-600">
API Reference
</a>
<a href="tutorial.html"
class="text-gray-900 inline-flex items-center px-1 pt-1 text-sm font-medium hover:text-blue-600">
Tutorials
</a>
</div>
</div>
<div class="flex items-center sm:hidden">
<button id="mobile-menu-button" class="text-gray-700 hover:text-blue-600 px-3 py-2">
<i class="fas fa-bars text-xl"></i>
</button>
</div>
</div>
</div>
<!-- Mobile menu -->
<div id="mobile-menu" class="hidden sm:hidden bg-white border-t">
<div class="px-2 pt-2 pb-3 space-y-1">
<a href="index.html" class="block px-3 py-2 text-gray-700 hover:text-blue-600">
Home
</a>
<a href="getting-started.html" class="block px-3 py-2 text-gray-700 hover:text-blue-600">
Getting Started
</a>
<a href="core-concepts.html" class="block px-3 py-2 text-gray-700 hover:text-blue-600">
Core Concepts
</a>
<a href="modules.html" class="block px-3 py-2 text-gray-700 hover:text-blue-600">
Capabilities
</a>
<a href="api-reference.html" class="block px-3 py-2 text-gray-700 hover:text-blue-600">
API Reference
</a>
<a href="tutorial.html" class="block px-3 py-2 text-gray-700 hover:text-blue-600">
Tutorials
</a>
</div>
</div>
</nav>
<!-- Main Content -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="flex flex-col lg:flex-row gap-8">
<!-- Sidebar Navigation -->
<div class="lg:w-1/4">
<div class="bg-white rounded-lg shadow-sm p-6 sticky top-8 max-h-[calc(100vh-4rem)] overflow-y-auto">
<h3 class="text-lg font-semibold text-gray-900 mb-4">
ForgeDeployment
</h3>
<nav class="space-y-2">
<a href="#overview"
class="nav-link block px-3 py-2 text-sm text-gray-700 rounded-md hover:text-blue-600">
Overview
</a>
<a href="#features"
class="nav-link block px-3 py-2 text-sm text-gray-700 rounded-md hover:text-blue-600">
Key Features
</a>
<a href="#architecture"
class="nav-link block px-3 py-2 text-sm text-gray-700 rounded-md hover:text-blue-600">
Architecture
</a>
<a href="#providers"
class="nav-link block px-3 py-2 text-sm text-gray-700 rounded-md hover:text-blue-600">
Cloud Providers
</a>
<a href="#commands"
class="nav-link block px-3 py-2 text-sm text-gray-700 rounded-md hover:text-blue-600">
CLI Commands
</a>
<a href="#services"
class="nav-link block px-3 py-2 text-sm text-gray-700 rounded-md hover:text-blue-600">
Services
</a>
<a href="#configuration"
class="nav-link block px-3 py-2 text-sm text-gray-700 rounded-md hover:text-blue-600">
Configuration
</a>
<a href="#installation"
class="nav-link block px-3 py-2 text-sm text-gray-700 rounded-md hover:text-blue-600">
Installation
</a>
</nav>
</div>
</div>
<!-- Main Content -->
<div class="lg:w-3/4">
<div class="bg-white rounded-lg shadow-sm p-8">
<h1 class="text-4xl font-bold text-gray-900 mb-6">
ForgeDeployment
</h1>
<p class="text-xl text-gray-600 mb-8">
Complete deployment automation system for Forge applications. Deploy to cloud providers
with automated provisioning, rollback capabilities, and zero-downtime deployments.
</p>
<!-- Overview -->
<section id="overview" class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Overview</h2>
<p class="text-gray-600 mb-4">
ForgeDeployment automates the entire deployment pipeline from server creation to production
deployment. It solves the complexity of cloud infrastructure management by providing
automated provisioning, configuration, and deployment coordination.
</p>
<div class="bg-blue-50 border border-blue-200 rounded-lg p-6 mb-6">
<h3 class="text-lg font-semibold text-blue-900 mb-3">Problems Solved</h3>
<ul class="list-disc list-inside space-y-2 text-blue-800">
<li><strong>Manual Server Setup:</strong> Automated cloud provider integration eliminates manual server configuration</li>
<li><strong>Deployment Downtime:</strong> Zero-downtime deployments with rollback capabilities</li>
<li><strong>SSL Management:</strong> Automated Let's Encrypt certificate generation and renewal</li>
<li><strong>Infrastructure as Code:</strong> Declarative configuration for reproducible deployments</li>
<li><strong>Multi-Provider Support:</strong> Extensible provider system for different cloud platforms</li>
</ul>
</div>
</section>
<!-- Key Features -->
<section id="features" class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Key Features</h2>
<div class="grid md:grid-cols-2 gap-6 mb-8">
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Automated Provisioning</h3>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>DigitalOcean provider integration</li>
<li>Custom provider extensibility</li>
<li>SSH key management</li>
<li>System installation (PHP, Nginx, Database)</li>
<li>Environment-specific configurations</li>
</ul>
</div>
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Deployment Management</h3>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>Incremental project uploads</li>
<li>Deployment state tracking</li>
<li>Automatic rollback capabilities</li>
<li>Git diff verification</li>
<li>Zero-downtime deployments</li>
</ul>
</div>
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Security & SSL</h3>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>Let's Encrypt integration</li>
<li>Custom SSL certificate support</li>
<li>Automatic DNS configuration</li>
<li>Secure SSH key handling</li>
<li>Production environment safeguards</li>
</ul>
</div>
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Monitoring & Logging</h3>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>Real-time deployment status</li>
<li>Detailed deployment logs</li>
<li>Progress tracking with steps</li>
<li>Hub dashboard integration</li>
<li>Production environment detection</li>
</ul>
</div>
</div>
</section>
<!-- Architecture -->
<section id="architecture" class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Architecture</h2>
<div class="code-block p-6 text-white rounded-lg mb-6">
<pre><code class="language-mermaid">graph TD
A[Deployment Controller] --> B[Deployment Hub Service]
B --> C[Deployment Execution Service]
B --> D[Provider Interface]
B --> E[Configuration Reader]
B --> F[State Service]
C --> G[Provisioners]
C --> H[SSH Service]
D --> I[DigitalOcean Provider]
D --> J[Custom Providers]
F --> K[Deployment State]
E --> L[Deployment Config]
style A fill:#e5e7eb
style B fill:#3b82f6
style C fill:#10b981
style D fill:#f59e0b
style E fill:#ef4444
style F fill:#8b5cf6
style G fill:#6366f1
style H fill:#ec4899
style I fill:#3b82f6
style J fill:#06b6d4
style K fill:#8b5cf6
style L fill:#ef4444</code></pre>
</div>
<div class="space-y-6">
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Provider Abstraction</h3>
<p class="text-gray-600 mb-4">
Extensible provider system allows adding new cloud providers through a simple interface.
</p>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>DigitalOcean provider included</li>
<li>Custom providers via ProviderInterface</li>
<li>Provider-specific configuration management</li>
<li>API key and credential handling</li>
</ul>
</div>
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">State Management</h3>
<p class="text-gray-600 mb-4">
Complete deployment state tracking with validation and recovery capabilities.
</p>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>Step-by-step progress tracking</li>
<li>State validation and recovery</li>
<li>Resume interrupted deployments</li>
<li>Rollback point management</li>
</ul>
</div>
</div>
</section>
<!-- Cloud Providers -->
<section id="providers" class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Cloud Providers</h2>
<div class="grid md:grid-cols-2 gap-6">
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3 text-blue-600">DigitalOcean</h3>
<p class="text-gray-600 mb-4">
Full-featured provider for DigitalOcean cloud platform.
</p>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>Droplet creation and management</li>
<li>SSH key provisioning</li>
<li>Firewall configuration</li>
<li>Domain management</li>
<li>Resource monitoring</li>
</ul>
</div>
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3 text-green-600">Custom Providers</h3>
<p class="text-gray-600 mb-4">
Extensible system for adding your own cloud providers.
</p>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>Implement ProviderInterface</li>
<li>Custom provisioning logic</li>
<li>Provider-specific configurations</li>
<li>Plugin architecture</li>
</ul>
</div>
</div>
</section>
<!-- CLI Commands -->
<section id="commands" class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">CLI Commands</h2>
<div class="space-y-6">
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Deployment Commands</h3>
<div class="code-block p-6 text-white rounded-lg mb-4">
<pre><code class="language-bash"># Full deployment wizard
forge-deployment:deploy
# With specific provider
forge-deployment:deploy --provider=digitalocean
# With custom config
forge-deployment:deploy --config=./deployment.php
# With SSH key
forge-deployment:deploy --ssh-key=~/.ssh/id_rsa.pub</code></pre>
</div>
<ul class="list-disc list-inside space-y-2 text-gray-600">
<li>Interactive deployment wizard</li>
<li>Resume interrupted deployments</li>
<li>Provider selection and configuration</li>
<li>SSH key management</li>
</ul>
</div>
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Management Commands</h3>
<div class="code-block p-6 text-white rounded-lg mb-4">
<pre><code class="language-bash"># Server management
forge-deployment:create-server
forge-deployment:delete-server
forge-deployment:configure-dns
# Deployment management
forge-deployment:deploy-env
forge-deployment:rollback
forge-deployment:resume
forge-deployment:status
forge-deployment:update
# SSL and security
forge-deployment:setup-ssl
forge-deployment:fix-permissions
# Configuration
forge-deployment:init-deployment-config</code></pre>
</div>
</div>
</div>
</section>
<!-- Services -->
<section id="services" class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Core Services</h2>
<div class="grid md:grid-cols-2 gap-6">
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Deployment Services</h3>
<div class="code-block p-6 text-white rounded-lg">
<pre><code class="language-php">DeploymentHubService
├── State management
├── Configuration handling
├── Progress tracking
└── Logging coordination
DeploymentExecutionService
├── Provider orchestration
├── Provisioning coordination
├── Upload automation
└── Rollback management</code></pre>
</div>
</div>
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Support Services</h3>
<div class="code-block p-6 text-white rounded-lg">
<pre><code class="language-php">SshService
├── Connection management
├── Command execution
└── Key handling
LetsEncryptService
├── Certificate generation
├── DNS configuration
└── Auto-renewal
CloudflareService
├── DNS management
├── SSL management
└── API integration</code></pre>
</div>
</div>
</div>
</section>
<!-- Configuration -->
<section id="configuration" class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Configuration</h2>
<div class="code-block p-6 text-white rounded-lg mb-6">
<pre><code class="language-php">// deployment.php - Complete deployment configuration
return [
'provider' => 'digitalocean',
'server' => [
'name' => 'my-app-server',
'region' => 'nyc3',
'size' => 's-2vcpu-4gb',
'image' => 'ubuntu-22-04-x64',
],
'ssh' => [
'key_path' => '~/.ssh/deploy_key.pub',
'user' => 'forge',
],
'domain' => [
'name' => 'myapp.com',
'subdomains' => ['api', 'www'],
],
'ssl' => [
'enabled' => true,
'email' => 'admin@myapp.com',
'type' => 'letsencrypt',
],
'provision' => [
'php' => '8.3',
'nginx' => true,
'database' => 'mysql',
'system_packages' => ['git', 'curl', 'zip'],
],
'deployment' => [
'path' => '/var/www/myapp',
'repository' => 'git@github.com:user/myapp.git',
'branch' => 'main',
'exclude' => ['.env', 'node_modules', 'storage/logs'],
],
];</code></pre>
</div>
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
<h4 class="font-semibold text-yellow-800 mb-2">Security Note</h4>
<p class="text-sm text-yellow-700">
All sensitive configuration values (API tokens, passwords, SSH keys) are automatically masked
in logs and UI responses. Use environment variables for production deployments.
</p>
</div>
</section>
<!-- Installation -->
<section id="installation" class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Installation</h2>
<div class="code-block p-6 text-white rounded-lg mb-6">
<pre><code class="language-bash"># Install ForgeDeployment module
php forge.php package:install-module --module=forge-deployment
# Install with dependencies (ForgeHub, ForgeLogger, etc.)
php forge.php package:install-module forge-deployment forge-hub forge-logger
# Force reinstallation
php forge.php package:install-module --module=forge-deployment --force</code></pre>
</div>
<div class="bg-green-50 border border-green-200 rounded-lg p-6">
<h3 class="font-semibold text-green-800 mb-3">Module Registration</h3>
<p class="text-green-700 mb-4">
ForgeDeployment automatically registers with Forge Kernel and provides:
</p>
<ul class="list-disc list-inside space-y-2 text-green-700">
<li>Hub integration under /hub/deployment</li>
<li>Middleware and permission integration</li>
<li>Configuration defaults management</li>
<li>CLI command registration</li>
<li>Service container registration</li>
</ul>
</div>
<div class="bg-blue-50 border border-blue-200 rounded-lg p-6">
<h3 class="font-semibold text-blue-800 mb-3">Environment Setup</h3>
<div class="code-block p-6 text-white">
<pre><code class="language-env"># Required environment variables
FORGE_DEPLOYMENT_DIGITALOCEAN_API_TOKEN=your_api_token
FORGE_DEPLOYMENT_CLOUDFLARE_API_TOKEN=your_cloudflare_token
# Optional configuration files
# .env.local - Local development overrides
# .env.production - Production-specific values</code></pre>
</div>
</div>
</section>
<!-- Usage Examples -->
<section class="section-anchor mb-12">
<h2 class="text-2xl font-bold text-gray-900 mb-4">Usage Examples</h2>
<div class="space-y-6">
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Hub Dashboard Integration</h3>
<p class="text-gray-600 mb-4">
ForgeDeployment provides a complete Hub dashboard for managing deployments:
</p>
<div class="code-block p-6 text-white">
<pre><code class="language-php">// Controller integration
#[Route("/hub/deployment")]
public function index(): Response
{
$status = $this->deploymentHubService->getDeploymentStatus();
$config = $this->deploymentHubService->getDeploymentConfig();
$logs = $this->deploymentHubService->listDeploymentLogs();
return $this->view("pages/hub/deployment", [
'title' => "Deployment",
'status' => $status,
'config' => $config,
'logs' => $logs,
]);
}</code></pre>
</div>
</div>
<div class="border border-gray-200 rounded-lg p-6">
<h3 class="font-semibold text-lg mb-3">Custom Provider Development</h3>
<p class="text-gray-600 mb-4">
Create custom cloud providers by implementing the ProviderInterface:
</p>
<div class="code-block p-6 text-white">
<pre><code class="language-php">class CustomProvider implements ProviderInterface
{
public function createServer(ServerConfig $config): array
{
// Custom server creation logic
return ['id' => 'server-123', 'ip' => '192.168.1.100'];
}
public function provisionSystem(ProvisionConfig $config): bool
{
// Custom provisioning logic
return true;
}
public function configureDomain(string $domain): bool
{
// Custom domain configuration
return true;
}
}</code></pre>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer class="bg-gray-800 text-white mt-12">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="text-center">
<p class="text-gray-400">
© 2024 Forge Kernel. Built with passion for PHP developers.
</p>
</div>
</div>
</footer>
<!-- Scripts -->
<script>
// Mobile menu toggle
document.getElementById('mobile-menu-button')?.addEventListener('click', () => {
document.getElementById('mobile-menu').classList.toggle('hidden');
});
// Smooth scroll for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
});
});
// Active navigation state
function updateActiveNav() {
const sections = document.querySelectorAll('section[id]');
const navLinks = document.querySelectorAll('.nav-link');
let currentSection = '';
sections.forEach(section => {
const rect = section.getBoundingClientRect();
if (rect.top <= 100 && rect.bottom >= 100) {
currentSection = section.id;
}
});
navLinks.forEach(link => {
link.classList.remove('text-blue-600', 'bg-blue-50');
if (link.getAttribute('href') === '#' + currentSection) {
link.classList.add('text-blue-600', 'bg-blue-50');
}
});
}
window.addEventListener('scroll', updateActiveNav);
updateActiveNav();
</script>
<!-- Mermaid.js for diagrams -->
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>
mermaid.initialize({ startOnLoad: true });
</script>
</body>
</html>