فهرست منبع

Initial desktop support resume website

parkeradmin 1 ماه پیش
کامیت
73317e3a29
5فایلهای تغییر یافته به همراه194 افزوده شده و 0 حذف شده
  1. 7 0
      .gitignore
  2. 49 0
      README.md
  3. 17 0
      Vagrantfile
  4. 72 0
      provision/bootstrap.sh
  5. 49 0
      public/index.php

+ 7 - 0
.gitignore

@@ -0,0 +1,7 @@
+.vagrant/
+*.log
+.env
+.ssh-askpass.cmd
+*.env
+.idea/
+.vscode/

+ 49 - 0
README.md

@@ -0,0 +1,49 @@
+# Desktop Support Website
+
+A local Debian 13 (Trixie) LAMP development environment managed by Vagrant.
+
+## Requirements
+
+- Vagrant 2.4+
+- VirtualBox with hardware virtualization enabled
+
+## Start the environment
+
+```powershell
+vagrant up
+```
+
+Open <http://localhost:8080>. The project is mounted at `/vagrant` in the VM and Apache serves `public/`, so edits made on the host appear immediately.
+
+Connect to the VM with:
+
+```powershell
+vagrant ssh
+```
+
+Re-run provisioning after changing `provision/bootstrap.sh`:
+
+```powershell
+vagrant provision
+```
+
+Stop or remove the VM:
+
+```powershell
+vagrant halt
+vagrant destroy
+```
+
+## Local database
+
+| Setting | Value |
+| --- | --- |
+| Database | `desktop_support` |
+| User | `desktop_support` |
+| Password | `development_only` |
+| VM host | `localhost:3306` |
+| Host connection | `127.0.0.1:33060` |
+
+These credentials are for local development only. Do not reuse them in production.
+
+Apache logs are stored in `/var/log/apache2/desktop-support-*.log` inside the VM.

+ 17 - 0
Vagrantfile

@@ -0,0 +1,17 @@
+Vagrant.configure("2") do |config|
+  config.vm.box = "bento/debian-13"
+  config.vm.hostname = "desktop-support"
+
+  config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1", auto_correct: true
+  config.vm.network "forwarded_port", guest: 3306, host: 33060, host_ip: "127.0.0.1", auto_correct: true
+
+  config.vm.synced_folder ".", "/vagrant", disabled: false
+
+  config.vm.provider "virtualbox" do |vb|
+    vb.name = "desktop-support-debian13"
+    vb.memory = 2048
+    vb.cpus = 2
+  end
+
+  config.vm.provision "shell", path: "provision/bootstrap.sh"
+end

+ 72 - 0
provision/bootstrap.sh

@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+export DEBIAN_FRONTEND=noninteractive
+
+apt-get update
+apt-get install -y --no-install-recommends \
+  apache2 \
+  mariadb-server \
+  php \
+  libapache2-mod-php \
+  php-cli \
+  php-curl \
+  php-gd \
+  php-intl \
+  php-mbstring \
+  php-mysql \
+  php-xml \
+  php-zip \
+  unzip \
+  curl \
+  ca-certificates
+
+a2enmod rewrite headers expires
+
+echo "ServerName desktop-support.test" >/etc/apache2/conf-available/servername.conf
+a2enconf servername
+
+cat >/etc/apache2/sites-available/desktop-support.conf <<'APACHE'
+<VirtualHost *:80>
+    ServerName desktop-support.test
+    DocumentRoot /vagrant/public
+
+    <Directory /vagrant/public>
+        Options Indexes FollowSymLinks
+        AllowOverride All
+        Require all granted
+    </Directory>
+
+    ErrorLog ${APACHE_LOG_DIR}/desktop-support-error.log
+    CustomLog ${APACHE_LOG_DIR}/desktop-support-access.log combined
+</VirtualHost>
+APACHE
+
+a2dissite 000-default.conf
+a2ensite desktop-support.conf
+
+cat >/etc/php/development-overrides.ini <<'PHP'
+display_errors = On
+display_startup_errors = On
+error_reporting = E_ALL
+date.timezone = America/New_York
+PHP
+
+PHP_VERSION="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')"
+ln -sf /etc/php/development-overrides.ini "/etc/php/${PHP_VERSION}/apache2/conf.d/99-development.ini"
+ln -sf /etc/php/development-overrides.ini "/etc/php/${PHP_VERSION}/cli/conf.d/99-development.ini"
+
+systemctl enable --now mariadb apache2
+
+mariadb <<'SQL'
+CREATE DATABASE IF NOT EXISTS desktop_support
+  CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
+CREATE USER IF NOT EXISTS 'desktop_support'@'localhost' IDENTIFIED BY 'development_only';
+GRANT ALL PRIVILEGES ON desktop_support.* TO 'desktop_support'@'localhost';
+FLUSH PRIVILEGES;
+SQL
+
+apache2ctl configtest
+systemctl restart apache2
+
+echo "LAMP provisioning complete: http://localhost:8080"

+ 49 - 0
public/index.php

@@ -0,0 +1,49 @@
+<?php
+declare(strict_types=1);
+
+$databaseStatus = 'Unavailable';
+
+try {
+    $database = new PDO(
+        'mysql:host=localhost;dbname=desktop_support;charset=utf8mb4',
+        'desktop_support',
+        'development_only',
+        [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
+    );
+    $databaseStatus = 'Connected';
+} catch (PDOException $exception) {
+    $databaseStatus = 'Unavailable';
+}
+?>
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Desktop Support Portfolio</title>
+    <style>
+        :root { color-scheme: dark; font-family: system-ui, sans-serif; }
+        body { margin: 0; background: #0b1220; color: #e5edf7; }
+        main { width: min(720px, calc(100% - 2rem)); margin: 12vh auto; }
+        .card { padding: 2rem; border: 1px solid #26364d; border-radius: 18px; background: #111c2e; box-shadow: 0 24px 70px #0006; }
+        h1 { margin-top: 0; font-size: clamp(2rem, 8vw, 4rem); line-height: 1; }
+        p { color: #b8c6d9; line-height: 1.65; }
+        dl { display: grid; grid-template-columns: max-content 1fr; gap: .75rem 1.25rem; margin: 2rem 0 0; }
+        dt { color: #7dd3fc; } dd { margin: 0; }
+        .ok { color: #86efac; }
+    </style>
+</head>
+<body>
+<main>
+    <section class="card">
+        <h1>Desktop support,<br>done right.</h1>
+        <p>Your Debian 13 LAMP development environment is ready. Replace this page with your experience, certifications, projects, and contact information.</p>
+        <dl>
+            <dt>PHP</dt><dd><?= htmlspecialchars(PHP_VERSION, ENT_QUOTES) ?></dd>
+            <dt>MariaDB</dt><dd class="<?= $databaseStatus === 'Connected' ? 'ok' : '' ?>"><?= htmlspecialchars($databaseStatus, ENT_QUOTES) ?></dd>
+            <dt>Apache</dt><dd class="ok">Running</dd>
+        </dl>
+    </section>
+</main>
+</body>
+</html>