Files
Infra-Management/database/migrations/2024_01_01_000003_create_containers_table.php
I-Fun c649f055d8 feat: initialize Infra Manager with React, Tailwind CSS, and Inertia.js
- Added main application entry point (app.jsx) and bootstrap file for React setup.
- Created Wiki index page (Index.jsx) for documentation and file management.
- Implemented utility functions for formatting and status handling in utils.js.
- Set up Blade template (app.blade.php) for Inertia.js integration.
- Defined API routes for metrics and terminal access in api.php.
- Established console commands for scheduled tasks in console.php.
- Created web routes for various application features including authentication, hypervisors, containers, cloud accounts, security, backups, and wiki management in web.php.
- Developed setup scripts for Windows (setup.ps1) and Linux (setup.sh) environments.
- Configured Tailwind CSS for styling with custom themes and animations in tailwind.config.js.
- Set up Vite for asset bundling and development server in vite.config.js.
2026-04-07 20:29:32 +07:00

81 lines
3.3 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('docker_endpoints', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('type')->default('docker'); // docker, swarm, k8s
$table->string('host'); // unix:///var/run/docker.sock or tcp://host:port
$table->boolean('tls_enabled')->default(false);
$table->text('tls_cert')->nullable();
$table->text('tls_key')->nullable();
$table->text('tls_ca')->nullable();
$table->string('status')->default('unknown');
$table->json('info')->nullable(); // Docker engine info
$table->timestamp('last_sync_at')->nullable();
$table->foreignId('created_by')->constrained('users');
$table->timestamps();
$table->softDeletes();
});
Schema::create('containers', function (Blueprint $table) {
$table->id();
$table->foreignId('endpoint_id')->constrained('docker_endpoints')->cascadeOnDelete();
$table->string('container_id', 64); // Docker container ID
$table->string('name');
$table->string('image');
$table->string('image_id')->nullable();
$table->string('status'); // running, stopped, paused, exited, dead
$table->string('state')->nullable();
$table->json('ports')->nullable();
$table->json('volumes')->nullable();
$table->json('env')->nullable();
$table->json('labels')->nullable();
$table->json('networks')->nullable();
$table->bigInteger('created_at_unix')->nullable();
$table->timestamps();
$table->unique(['endpoint_id', 'container_id']);
});
Schema::create('stacks', function (Blueprint $table) {
$table->id();
$table->foreignId('endpoint_id')->constrained('docker_endpoints')->cascadeOnDelete();
$table->string('name');
$table->string('type')->default('compose'); // compose, swarm-stack
$table->text('compose_content'); // docker-compose.yml content
$table->json('env_vars')->nullable();
$table->string('status')->default('stopped');
$table->string('remote_id')->nullable();
$table->foreignId('created_by')->constrained('users');
$table->timestamps();
$table->softDeletes();
});
Schema::create('docker_images', function (Blueprint $table) {
$table->id();
$table->foreignId('endpoint_id')->constrained('docker_endpoints')->cascadeOnDelete();
$table->string('image_id', 71);
$table->json('repo_tags')->nullable();
$table->bigInteger('size')->default(0);
$table->bigInteger('created_at_unix')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('docker_images');
Schema::dropIfExists('stacks');
Schema::dropIfExists('containers');
Schema::dropIfExists('docker_endpoints');
}
};