Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Add standalone WordPress and SSL management UI

Juan Denis06d63cbc52d8
diff --git a/README.md b/README.md
index 93f02f15..0c509984 100644
--- a/README.md
+++ b/README.md
@@ -174,7 +174,7 @@ ServerKit is a lightweight, modern server control panel for managing web applica
### Option 1: One-Line Install (Recommended)
```bash
-curl -fsSL https://raw.githubusercontent.com/jhd3197/serverkit/main/install.sh | bash
+curl -fsSL https://serverkit.ai/install.sh | bash
```
> Works on Ubuntu 22.04+ and Debian 12+. Sets up everything automatically.
diff --git a/backend/app/api/ssl.py b/backend/app/api/ssl.py
index 30f2ae55..dbe6d8ca 100644
--- a/backend/app/api/ssl.py
+++ b/backend/app/api/ssl.py
@@ -111,6 +111,18 @@ def setup_auto_renewal():
return jsonify(result), 200 if result['success'] else 400
+@ssl_bp.route('/install-certbot', methods=['POST'])
+@jwt_required()
+@admin_required
+def install_certbot():
+ """Install certbot if not already installed."""
+ if SSLService.is_certbot_installed():
+ return jsonify({'success': True, 'message': 'Certbot is already installed'}), 200
+
+ result = SSLService.install_certbot()
+ return jsonify(result), 200 if result['success'] else 400
+
+
@ssl_bp.route('/status', methods=['GET'])
@jwt_required()
@admin_required
diff --git a/backend/app/api/wordpress.py b/backend/app/api/wordpress.py
index f73be4c4..88b0a0bb 100644
--- a/backend/app/api/wordpress.py
+++ b/backend/app/api/wordpress.py
@@ -7,6 +7,89 @@ from app import db
wordpress_bp = Blueprint('wordpress', __name__)
+# ==================== STANDALONE WORDPRESS (DOCKER) ENDPOINTS ====================
+
+@wordpress_bp.route('/standalone/status', methods=['GET'])
+@jwt_required()
+def get_standalone_status():
+ """Get WordPress standalone installation status."""
+ result = WordPressService.get_wordpress_standalone_status()
+ return jsonify(result), 200
+
+
+@wordpress_bp.route('/standalone/requirements', methods=['GET'])
+@jwt_required()
+def get_standalone_requirements():
+ """Get resource requirements for WordPress installation."""
+ result = WordPressService.get_wordpress_resource_requirements()
+ return jsonify(result), 200
+
+
+@wordpress_bp.route('/standalone/install', methods=['POST'])
+@jwt_required()
+def install_standalone():
+ """Install WordPress via Docker Compose."""
+ data = request.get_json() or {}
+
+ result = WordPressService.install_wordpress_standalone(
+ admin_email=data.get('adminEmail')
+ )
+
+ if result.get('success'):
+ return jsonify(result), 201
+ return jsonify(result), 400
+
+
+@wordpress_bp.route('/standalone/uninstall', methods=['POST'])
+@jwt_required()
+def uninstall_standalone():
+ """Uninstall standalone WordPress and optionally remove data."""
+ data = request.get_json() or {}
+
+ result = WordPressService.uninstall_wordpress_standalone(
+ remove_data=data.get('removeData', False)
+ )
+
+ if result.get('success'):
+ return jsonify(result), 200
+ return jsonify(result), 400
+
+
+@wordpress_bp.route('/standalone/start', methods=['POST'])
+@jwt_required()
+def start_standalone():
+ """Start WordPress containers."""
+ result = WordPressService.start_wordpress_standalone()
+
+ if result.get('success'):
+ return jsonify(result), 200
+ return jsonify(result), 400
+
+
+@wordpress_bp.route('/standalone/stop', methods=['POST'])
+@jwt_required()
+def stop_standalone():
+ """Stop WordPress containers."""
+ result = WordPressService.stop_wordpress_standalone()
+
+ if result.get('success'):
+ return jsonify(result), 200
+ return jsonify(result), 400
+
+
+@wordpress_bp.route('/standalone/restart', methods=['POST'])
+@jwt_required()
+def restart_standalone():
+ """Restart WordPress containers."""
+ result = WordPressService.restart_wordpress_standalone()
+
+ if result.get('success'):
+ return jsonify(result), 200
+ return jsonify(result), 400
+
+
+# ==================== LEGACY WP-CLI ENDPOINTS ====================
+
def admin_required(fn):
"""Decorator to require admin role."""
from functools import wraps
diff --git a/backend/app/services/nginx_service.py b/backend/app/services/nginx_service.py
index 9d7b757b..c610da0b 100644
--- a/backend/app/services/nginx_service.py
+++ b/backend/app/services/nginx_service.py
@@ -165,6 +165,7 @@ class NginxService:
# Private URL routing templates
PRIVATE_URL_CONFIG_NAME = 'serverkit-private-urls'
GITEA_CONFIG_NAME = 'serverkit-gitea'
+ WORDPRESS_CONFIG_NAME = 'serverkit-wordpress'
# Gitea location block for /gitea path
GITEA_LOCATION_TEMPLATE = '''server {{
@@ -201,6 +202,40 @@ class NginxService:
return 301 /gitea/;
}}
}}
+'''
+
+ # WordPress location block for /wordpress path
+ WORDPRESS_LOCATION_TEMPLATE = '''server {{
+ listen 80;
+ listen [::]:80;
+ server_name _;
+
+ access_log /var/log/nginx/wordpress.access.log;
+ error_log /var/log/nginx/wordpress.error.log;
+
+ # WordPress at /wordpress path
+ location /wordpress/ {{
+ proxy_pass http://127.0.0.1:{port}/;
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Forwarded-Host $host;
+ proxy_cache_bypass $http_upgrade;
+ proxy_read_timeout 300;
+ proxy_connect_timeout 60;
+ proxy_send_timeout 60;
+
+ # WordPress file uploads
+ client_max_body_size 256M;
+ }}
+
+ # Handle /wordpress without trailing slash
+ location = /wordpress {{
+ return 301 /wordpress/;
+ }}
+}}
'''
PRIVATE_URL_LOCATION_TEMPLATE = ''' # Private URL: /p/{slug}
@@ -927,3 +962,87 @@ server {{
Dict with exists, enabled, content, and path
"""
return cls.get_site_config(cls.GITEA_CONFIG_NAME)
+
+ # ==================== WORDPRESS CONFIGURATION ====================
+
+ @classmethod
+ def create_wordpress_config(cls, port: int) -> Dict:
+ """Create Nginx configuration for WordPress at /wordpress path.
+
+ Args:
+ port: The internal port WordPress is running on
+
+ Returns:
+ Dict with success status and message
+ """
+ try:
+ config = cls.WORDPRESS_LOCATION_TEMPLATE.format(port=port)
+ config_path = os.path.join(cls.SITES_AVAILABLE, cls.WORDPRESS_CONFIG_NAME)
+
+ # Write config file
+ process = subprocess.run(
+ ['sudo', 'tee', config_path],
+ input=config,
+ capture_output=True,
+ text=True
+ )
+ if process.returncode != 0:
+ return {'success': False, 'error': f'Failed to write config: {process.stderr}'}
+
+ # Enable the site
+ enabled_path = os.path.join(cls.SITES_ENABLED, cls.WORDPRESS_CONFIG_NAME)
+ result = subprocess.run(
+ ['sudo', 'ln', '-sf', config_path, enabled_path],
+ capture_output=True,
+ text=True
+ )
+ if result.returncode != 0:
+ return {'success': False, 'error': f'Failed to enable config: {result.stderr}'}
+
+ # Reload Nginx
+ reload_result = cls.reload()
+ if not reload_result['success']:
+ return reload_result
+
+ return {
+ 'success': True,
+ 'message': 'WordPress nginx config created',
+ 'config_path': config_path,
+ 'url_path': '/wordpress'
+ }
+
+ except Exception as e:
+ return {'success': False, 'error': str(e)}
+
+ @classmethod
+ def remove_wordpress_config(cls) -> Dict:
+ """Remove Nginx configuration for WordPress.
+
+ Returns:
+ Dict with success status and message
+ """
+ try:
+ # Remove symlink
+ enabled_path = os.path.join(cls.SITES_ENABLED, cls.WORDPRESS_CONFIG_NAME)
+ subprocess.run(['sudo', 'rm', '-f', enabled_path], capture_output=True, text=True)
+
+ # Remove config file
+ config_path = os.path.join(cls.SITES_AVAILABLE, cls.WORDPRESS_CONFIG_NAME)
+ subprocess.run(['sudo', 'rm', '-f', config_path], capture_output=True, text=True)
+
+ # Reload Nginx
+ cls.reload()
+
+ return {'success': True, 'message': 'WordPress nginx config removed'}
+
+ except Exception as e:
+ return {'success': False, 'error': str(e)}
+
+ @classmethod
+ def get_wordpress_config(cls) -> Dict:
+ """Get the current WordPress nginx configuration.
+
+ Returns:
+ Dict with exists, enabled, content, and path
+ """
+ return cls.get_site_config(cls.WORDPRESS_CONFIG_NAME)
diff --git a/backend/app/services/wordpress_service.py b/backend/app/services/wordpress_service.py
index 1ed69924..1808832b 100644
--- a/backend/app/services/wordpress_service.py
+++ b/backend/app/services/wordpress_service.py
@@ -622,3 +622,233 @@ RewriteRule ^wp-content/uploads/.*\\.php$ - [F]
"""Generate a secure random password."""
alphabet = string.ascii_letters + string.digits + '!@#$%^&*'
return ''.join(secrets.choice(alphabet) for _ in range(length))
+
+ # ========================================
+ # WORDPRESS STANDALONE (DOCKER) MANAGEMENT
+ # ========================================
+
+ WP_APP_NAME = 'serverkit-wordpress'
+ WP_CONFIG_DIR = '/etc/serverkit'
+ WP_CONFIG_FILE = os.path.join(WP_CONFIG_DIR, 'wordpress.json')
+
+ @classmethod
+ def get_wordpress_standalone_status(cls) -> Dict:
+ """Check if standalone WordPress is installed and running."""
+ from app.models import Application
+
+ app = Application.query.filter_by(name=cls.WP_APP_NAME).first()
+
+ if not app:
+ return {
+ 'installed': False,
+ 'running': False,
+ 'http_port': None,
+ 'url': None,
+ 'url_path': None
+ }
+
+ running = cls._is_wordpress_running()
+ config = cls._load_wp_config()
+
+ return {
+ 'installed': True,
+ 'running': running,
+ 'http_port': app.port or config.get('http_port'),
+ 'url_path': '/wordpress',
+ 'url': f"http://localhost:{app.port}" if app.port else None,
+ 'app_id': app.id,
+ 'version': config.get('version', '6.4')
+ }
+
+ @classmethod
+ def _is_wordpress_running(cls) -> bool:
+ """Check if WordPress container is running."""
+ try:
+ result = subprocess.run(
+ ['docker', 'ps', '--filter', f'name={cls.WP_APP_NAME}', '--format', '{{.Names}}'],
+ capture_output=True,
+ text=True,
+ timeout=10
+ )
+ return cls.WP_APP_NAME in result.stdout
+ except Exception:
+ return False
+
+ @classmethod
+ def _load_wp_config(cls) -> Dict:
+ """Load WordPress standalone configuration."""
+ if os.path.exists(cls.WP_CONFIG_FILE):
+ try:
+ with open(cls.WP_CONFIG_FILE, 'r') as f:
+ return json.load(f)
+ except Exception:
+ pass
+ return {}
+
+ @classmethod
+ def _save_wp_config(cls, config: Dict) -> bool:
+ """Save WordPress standalone configuration."""
+ try:
+ os.makedirs(cls.WP_CONFIG_DIR, exist_ok=True)
+ with open(cls.WP_CONFIG_FILE, 'w') as f:
+ json.dump(config, f, indent=2)
+ return True
+ except Exception:
+ return False
+
+ @classmethod
+ def get_wordpress_resource_requirements(cls) -> Dict:
+ """Get resource requirements for WordPress installation."""
+ return {
+ 'memory_min': '512MB',
+ 'memory_recommended': '1GB',
+ 'storage_min': '2GB',
+ 'storage_recommended': '10GB',
+ 'components': [
+ {'name': 'WordPress', 'memory': '~256MB', 'storage': '~500MB'},
+ {'name': 'MySQL 8.0', 'memory': '~256MB', 'storage': '~1GB'}
+ ],
+ 'warning': 'Installation will spin up a MySQL database container'
+ }
+
+ @classmethod
+ def install_wordpress_standalone(cls, admin_email: str = None) -> Dict:
+ """Install WordPress as integrated ServerKit service via Docker."""
+ from app.services.template_service import TemplateService
+ from app.services.nginx_service import NginxService
+
+ status = cls.get_wordpress_standalone_status()
+ if status['installed']:
+ return {'success': False, 'error': 'WordPress is already installed'}
+
+ try:
+ result = TemplateService.install_template(
+ template_id='wordpress',
+ app_name=cls.WP_APP_NAME,
+ user_variables={},
+ user_id=1
+ )
+
+ if not result.get('success'):
+ return result
+
+ variables = result.get('variables', {})
+ http_port = variables.get('HTTP_PORT')
+
+ # Create nginx config for /wordpress path
+ nginx_result = NginxService.create_wordpress_config(int(http_port))
+ if not nginx_result.get('success'):
+ print(f"Warning: Failed to create WordPress nginx config: {nginx_result.get('error')}")
+
+ config = {
+ 'admin_email': admin_email,
+ 'http_port': http_port,
+ 'db_password': variables.get('DB_PASSWORD'),
+ 'wp_db_password': variables.get('WP_DB_PASSWORD'),
+ 'installed_at': datetime.now().isoformat(),
+ 'version': '6.4',
+ 'url_path': '/wordpress'
+ }
+ cls._save_wp_config(config)
+
+ return {
+ 'success': True,
+ 'message': 'WordPress installed successfully',
+ 'http_port': http_port,
+ 'url_path': '/wordpress'
+ }
+
+ except Exception as e:
+ return {'success': False, 'error': str(e)}
+
+ @classmethod
+ def uninstall_wordpress_standalone(cls, remove_data: bool = False) -> Dict:
+ """Uninstall standalone WordPress."""
+ from app import db
+ from app.models import Application
+ from app.services.docker_service import DockerService
+ from app.services.nginx_service import NginxService
+
+ app = Application.query.filter_by(name=cls.WP_APP_NAME).first()
+ if not app:
+ return {'success': False, 'error': 'WordPress is not installed'}
+
+ try:
+ NginxService.remove_wordpress_config()
+
+ if app.root_path and os.path.exists(app.root_path):
+ DockerService.compose_down(app.root_path, remove_volumes=remove_data)
+
+ if remove_data:
+ shutil.rmtree(app.root_path, ignore_errors=True)
+
+ db.session.delete(app)
+ db.session.commit()
+
+ if os.path.exists(cls.WP_CONFIG_FILE):
+ os.remove(cls.WP_CONFIG_FILE)
+
+ return {
+ 'success': True,
+ 'message': 'WordPress uninstalled successfully',
+ 'data_removed': remove_data
+ }
+
+ except Exception as e:
+ return {'success': False, 'error': str(e)}
+
+ @classmethod
+ def start_wordpress_standalone(cls) -> Dict:
+ """Start WordPress containers."""
+ from app import db
+ from app.models import Application
+ from app.services.docker_service import DockerService
+
+ app = Application.query.filter_by(name=cls.WP_APP_NAME).first()
+ if not app:
+ return {'success': False, 'error': 'WordPress is not installed'}
+
+ if not app.root_path or not os.path.exists(app.root_path):
+ return {'success': False, 'error': 'WordPress installation path not found'}
+
+ try:
+ result = DockerService.compose_up(app.root_path, detach=True)
+ if result.get('success'):
+ app.status = 'running'
+ db.session.commit()
+ return {'success': True, 'message': 'WordPress started'}
+ return result
+ except Exception as e:
+ return {'success': False, 'error': str(e)}
+
+ @classmethod
+ def stop_wordpress_standalone(cls) -> Dict:
+ """Stop WordPress containers."""
+ from app import db
+ from app.models import Application
+ from app.services.docker_service import DockerService
+
+ app = Application.query.filter_by(name=cls.WP_APP_NAME).first()
+ if not app:
+ return {'success': False, 'error': 'WordPress is not installed'}
+
+ if not app.root_path or not os.path.exists(app.root_path):
+ return {'success': False, 'error': 'WordPress installation path not found'}
+
+ try:
+ result = DockerService.compose_stop(app.root_path)
+ if result.get('success'):
+ app.status = 'stopped'
+ db.session.commit()
+ return {'success': True, 'message': 'WordPress stopped'}
+ return result
+ except Exception as e:
+ return {'success': False, 'error': str(e)}
+
+ @classmethod
+ def restart_wordpress_standalone(cls) -> Dict:
+ """Restart WordPress containers."""
+ stop_result = cls.stop_wordpress_standalone()
+ if not stop_result.get('success'):
+ return stop_result
+ return cls.start_wordpress_standalone()
diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md
index c7483ad6..7548d916 100644
--- a/docs/DEPLOYMENT.md
+++ b/docs/DEPLOYMENT.md
@@ -6,7 +6,7 @@ Complete guide for deploying ServerKit on Ubuntu servers.
```bash
# One-line install
-curl -fsSL https://raw.githubusercontent.com/jhd3197/serverkit/main/install.sh | bash
+curl -fsSL https://serverkit.ai/install.sh | bash
# Or clone and install manually
git clone https://github.com/jhd3197/serverkit.git
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 39c01340..1cf2434b 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -32,6 +32,7 @@ import ServerDetail from './pages/ServerDetail';
import Downloads from './pages/Downloads';
import WordPress from './pages/WordPress';
import WordPressDetail from './pages/WordPressDetail';
+import SSLCertificates from './pages/SSLCertificates';
// Page title mapping
const PAGE_TITLES = {
@@ -162,7 +163,7 @@ function AppRoutes() {
<Route path="workflow" element={<WorkflowBuilder />} />
<Route path="domains" element={<Domains />} />
<Route path="databases" element={<Databases />} />
- <Route path="ssl" element={<div className="page">SSL Certificates</div>} />
+ <Route path="ssl" element={<SSLCertificates />} />
<Route path="docker" element={<Docker />} />
<Route path="servers" element={<Servers />} />
<Route path="servers/:id" element={<ServerDetail />} />
diff --git a/frontend/src/pages/SSLCertificates.jsx b/frontend/src/pages/SSLCertificates.jsx
new file mode 100644
index 00000000..d422289c
--- /dev/null
+++ b/frontend/src/pages/SSLCertificates.jsx
@@ -0,0 +1,467 @@
+import React, { useState, useEffect } from 'react';
+import {
+ ShieldCheck, ShieldOff, RefreshCw, Plus, Trash2,
+ Lock, Clock, Globe, CheckCircle, AlertTriangle,
+ Settings, Download
+} from 'lucide-react';
+import api from '../services/api';
+import { useToast } from '../contexts/ToastContext';
+
+const SSLCertificates = () => {
+ const toast = useToast();
+ const [status, setStatus] = useState(null);
+ const [loading, setLoading] = useState(true);
+ const [actionLoading, setActionLoading] = useState(false);
+ const [renewingDomain, setRenewingDomain] = useState(null);
+
+ // Modal states
+ const [showObtainModal, setShowObtainModal] = useState(false);
+
+ // Form states
+ const [domains, setDomains] = useState('');
+ const [email, setEmail] = useState('');
+ const [useNginx, setUseNginx] = useState(true);
+ const [webrootPath, setWebrootPath] = useState('');
+
+ useEffect(() => {
+ loadData();
+ }, []);
+
+ async function loadData() {
+ try {
+ setLoading(true);
+ const data = await api.getSSLStatus();
+ setStatus(data);
+ } catch (err) {
+ console.error('Failed to load SSL status:', err);
+ } finally {
+ setLoading(false);
+ }
+ }
+
+ async function handleObtainCertificate(e) {
+ e.preventDefault();
+ const domainList = domains.split(',').map(d => d.trim()).filter(Boolean);
+ if (domainList.length === 0 || !email) return;
+
+ try {
+ setActionLoading(true);
+ const data = { domains: domainList, email, use_nginx: useNginx };
+ if (!useNginx && webrootPath) {
+ data.webroot_path = webrootPath;
+ }
+ const result = await api.obtainCertificate(data);
+ if (result.success) {
+ toast.success('Certificate obtained successfully');
+ setShowObtainModal(false);
+ setDomains('');
+ setEmail('');
+ loadData();
+ } else {
+ toast.error(result.error || 'Failed to obtain certificate');
+ }
+ } catch (err) {
+ toast.error(err.message || 'Failed to obtain certificate');
+ } finally {
+ setActionLoading(false);
+ }
+ }
+
+ async function handleRenewCertificate(domain) {
+ try {
+ setRenewingDomain(domain);
+ const result = await api.renewCertificate(domain);
+ if (result.success) {
+ toast.success(`Certificate for ${domain} renewed`);
+ loadData();
+ } else {
+ toast.error(result.error || 'Renewal failed');
+ }
+ } catch (err) {
+ toast.error(err.message || 'Renewal failed');
+ } finally {
+ setRenewingDomain(null);
+ }
+ }
+
+ async function handleRenewAll() {
+ try {
+ setActionLoading(true);
+ const result = await api.renewAllCertificates();
+ if (result.success) {
+ toast.success('All certificates renewed');
+ loadData();
+ } else {
+ toast.error(result.error || 'Renewal failed');
+ }
+ } catch (err) {
+ toast.error(err.message || 'Renewal failed');
+ } finally {
+ setActionLoading(false);
+ }
+ }
+
+ async function handleRevokeCertificate(domain) {
+ if (!confirm(`Revoke and delete the certificate for ${domain}? This cannot be undone.`)) return;
+
+ try {
+ setActionLoading(true);
+ const result = await api.revokeCertificate(domain);
+ if (result.success) {
+ toast.success(`Certificate for ${domain} revoked`);
+ loadData();
+ } else {
+ toast.error(result.error || 'Revocation failed');
+ }
+ } catch (err) {
+ toast.error(err.message || 'Revocation failed');
+ } finally {
+ setActionLoading(false);
+ }
+ }
+
+ async function handleSetupAutoRenewal() {
+ try {
+ setActionLoading(true);
+ const result = await api.setupAutoRenewal();
+ if (result.success) {
+ toast.success(result.message || 'Auto-renewal configured');
+ } else {
+ toast.error(result.error || 'Failed to setup auto-renewal');
+ }
+ } catch (err) {
+ toast.error(err.message || 'Failed to setup auto-renewal');
+ } finally {
+ setActionLoading(false);
+ }
+ }
+
+ async function handleInstallCertbot() {
+ try {
+ setActionLoading(true);
+ toast.info('Installing Certbot... This may take a moment.');
+ const result = await api.installCertbot();
+ if (result.success) {
+ toast.success('Certbot installed successfully');
+ loadData();
+ } else {
+ toast.error(result.error || 'Failed to install Certbot');
+ }
+ } catch (err) {
+ toast.error(err.message || 'Failed to install Certbot');
+ } finally {
+ setActionLoading(false);
+ }
+ }
+
+ if (loading) {
+ return (
+ <div className="ssl-page">
+ <header className="top-bar">
+ <div>
+ <h1>SSL Certificates</h1>
+ <p className="subtitle">Manage Let's Encrypt SSL certificates</p>
+ </div>
+ </header>
+ <div className="ssl-status-bar">
+ {[1, 2, 3].map(i => (
+ <div key={i} className="ssl-status-item">
+ <div className="skeleton-box" style={{ width: 48, height: 48, borderRadius: 12 }} />
+ <div>
+ <div className="skeleton-box" style={{ width: 80, height: 14, marginBottom: 6 }} />
+ <div className="skeleton-box" style={{ width: 50, height: 12 }} />
+ </div>
+ </div>
+ ))}
+ </div>
+ <div className="ssl-cert-list">
+ {[1, 2].map(i => (
+ <div key={i} className="ssl-cert-item">
+ <div className="skeleton-box" style={{ width: 40, height: 40, borderRadius: 10 }} />
+ <div style={{ flex: 1 }}>
+ <div className="skeleton-box" style={{ width: 200, height: 14, marginBottom: 8 }} />
+ <div className="skeleton-box" style={{ width: 300, height: 12 }} />
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+ }
+
+ const certificates = status?.certificates || [];
+ const expiringSoon = status?.expiring_soon || [];
+ const certbotInstalled = status?.certbot_installed ?? false;
+
+ return (
+ <div className="ssl-page">
+ <header className="top-bar">
+ <div>
+ <h1>SSL Certificates</h1>
+ <p className="subtitle">Manage Let's Encrypt SSL certificates</p>
+ </div>
+ <div className="top-bar-actions">
+ <button
+ className="btn btn-secondary"
+ onClick={handleSetupAutoRenewal}
+ disabled={actionLoading || !certbotInstalled}
+ title="Configure automatic renewal via systemd or cron"
+ >
+ <Settings size={16} />
+ Auto-Renew
+ </button>
+ {certificates.length > 0 && (
+ <button
+ className="btn btn-secondary"
+ onClick={handleRenewAll}
+ disabled={actionLoading}
+ >
+ <RefreshCw size={16} />
+ Renew All
+ </button>
+ )}
+ <button className="btn btn-secondary" onClick={loadData}>
+ <RefreshCw size={16} />
+ Refresh
+ </button>
+ <button
+ className="btn btn-primary"
+ onClick={() => setShowObtainModal(true)}
+ disabled={!certbotInstalled}
+ >
+ <Plus size={16} />
+ New Certificate
+ </button>
+ </div>
+ </header>
+
+ {/* Status Cards */}
+ <div className="ssl-status-bar">
+ <div className="ssl-status-item">
+ <div className={`ssl-status-icon ${certbotInstalled ? 'active' : 'inactive'}`}>
+ {certbotInstalled ? <ShieldCheck size={24} /> : <ShieldOff size={24} />}
+ </div>
+ <div className="ssl-status-info">
+ <h4>Certbot</h4>
+ <span>{certbotInstalled ? 'Installed' : 'Not Installed'}</span>
+ </div>
+ {!certbotInstalled && (
+ <button
+ className="btn btn-primary btn-sm"
+ onClick={handleInstallCertbot}
+ disabled={actionLoading}
+ style={{ marginLeft: 'auto' }}
+ >
+ <Download size={14} />
+ Install
+ </button>
+ )}
+ </div>
+ <div className="ssl-status-item">
+ <div className="ssl-status-icon active">
+ <Lock size={24} />
+ </div>
+ <div className="ssl-status-info">
+ <h4>Certificates</h4>
+ <span>{status?.total_certificates || 0} active</span>
+ </div>
+ </div>
+ <div className="ssl-status-item">
+ <div className={`ssl-status-icon ${expiringSoon.length > 0 ? 'warning' : 'active'}`}>
+ {expiringSoon.length > 0 ? <AlertTriangle size={24} /> : <CheckCircle size={24} />}
+ </div>
+ <div className="ssl-status-info">
+ <h4>Expiring Soon</h4>
+ <span>
+ {expiringSoon.length > 0
+ ? `${expiringSoon.length} certificate${expiringSoon.length > 1 ? 's' : ''}`
+ : 'All healthy'
+ }
+ </span>
+ </div>
+ </div>
+ </div>
+
+ {/* Certificates List */}
+ {certificates.length === 0 ? (
+ <div className="empty-state">
+ <Lock size={48} />
+ <h3>No SSL certificates</h3>
+ <p>Obtain your first Let's Encrypt certificate to secure your domains.</p>
+ {certbotInstalled ? (
+ <button className="btn btn-primary" onClick={() => setShowObtainModal(true)}>
+ <Plus size={16} />
+ New Certificate
+ </button>
+ ) : (
+ <button className="btn btn-primary" onClick={handleInstallCertbot} disabled={actionLoading}>
+ <Download size={16} />
+ Install Certbot First
+ </button>
+ )}
+ </div>
+ ) : (
+ <div className="ssl-cert-list">
+ {certificates.map((cert, index) => (
+ <div key={index} className="ssl-cert-item">
+ <div className="ssl-cert-item-info">
+ <div className={`ssl-cert-item-icon ${cert.expiry_valid ? '' : 'expiring'}`}>
+ <ShieldCheck size={20} />
+ </div>
+ <div className="ssl-cert-item-details">
+ <h3>{cert.name}</h3>
+ <div className="ssl-cert-item-meta">
+ <span>
+ <Globe size={12} />
+ {cert.domains?.join(', ') || cert.name}
+ </span>
+ {cert.expiry && (
+ <span className={cert.expiry_valid ? 'valid' : 'expiring'}>
+ <Clock size={12} />
+ Expires: {cert.expiry}
+ </span>
+ )}
+ </div>
+ </div>
+ </div>
+ <div className="ssl-cert-item-status">
+ {cert.expiry_valid ? (
+ <span className="status-badge status-active">
+ <CheckCircle size={14} />
+ Valid
+ </span>
+ ) : (
+ <span className="status-badge status-warning">
+ <AlertTriangle size={14} />
+ Expiring
+ </span>
+ )}
+ </div>
+ <div className="ssl-cert-item-actions">
+ <button
+ className="btn btn-secondary btn-sm"
+ onClick={() => handleRenewCertificate(cert.name)}
+ disabled={renewingDomain === cert.name || actionLoading}
+ >
+ <RefreshCw size={14} className={renewingDomain === cert.name ? 'spin' : ''} />
+ {renewingDomain === cert.name ? 'Renewing...' : 'Renew'}
+ </button>
+ <button
+ className="btn btn-secondary btn-sm"
+ onClick={() => handleRevokeCertificate(cert.name)}
+ disabled={actionLoading}
+ >
+ <Trash2 size={14} />
+ Revoke
+ </button>
+ </div>
+ </div>
+ ))}
+ </div>
+ )}
+
+ {/* Expiring Soon Warning */}
+ {expiringSoon.length > 0 && (
+ <div className="ssl-warning-banner">
+ <AlertTriangle size={18} />
+ <div>
+ <strong>Certificates expiring soon:</strong>{' '}
+ {expiringSoon.join(', ')}
+ </div>
+ <button
+ className="btn btn-primary btn-sm"
+ onClick={handleRenewAll}
+ disabled={actionLoading}
+ >
+ <RefreshCw size={14} />
+ Renew All
+ </button>
+ </div>
+ )}
+
+ {/* Obtain Certificate Modal */}
+ {showObtainModal && (
+ <div className="modal-overlay" onClick={() => setShowObtainModal(false)}>
+ <div className="modal" onClick={e => e.stopPropagation()}>
+ <div className="modal-header">
+ <h2>Obtain SSL Certificate</h2>
+ <button className="modal-close" onClick={() => setShowObtainModal(false)}>×</button>
+ </div>
+ <form onSubmit={handleObtainCertificate}>
+ <div className="ssl-info-box">
+ <ShieldCheck size={32} />
+ <div>
+ <h4>Free SSL from Let's Encrypt</h4>
+ <p>Obtain a free, automatically-renewed SSL certificate for your domains.</p>
+ </div>
+ </div>
+ <div className="form-group">
+ <label>Domains</label>
+ <input
+ type="text"
+ placeholder="example.com, www.example.com"
+ value={domains}
+ onChange={e => setDomains(e.target.value)}
+ required
+ />
+ <p className="hint">Comma-separated list of domains</p>
+ </div>
+ <div className="form-group">
+ <label>Email Address</label>
+ <input
+ type="email"
+ placeholder="[email protected]"
+ value={email}
+ onChange={e => setEmail(e.target.value)}
+ required
+ />
+ <p className="hint">For certificate expiration notifications</p>
+ </div>
+ <div className="form-group">
+ <label className="checkbox-label">
+ <input
+ type="checkbox"
+ checked={useNginx}
+ onChange={e => setUseNginx(e.target.checked)}
+ />
+ Use Nginx plugin (recommended)
+ </label>
+ </div>
+ {!useNginx && (
+ <div className="form-group">
+ <label>Webroot Path</label>
+ <input
+ type="text"
+ placeholder="/var/www/html"
+ value={webrootPath}
+ onChange={e => setWebrootPath(e.target.value)}
+ required={!useNginx}
+ />
+ <p className="hint">Document root for HTTP validation</p>
+ </div>
+ )}
+ <div className="modal-actions">
+ <button
+ type="button"
+ className="btn btn-secondary"
+ onClick={() => setShowObtainModal(false)}
+ >
+ Cancel
+ </button>
+ <button
+ type="submit"
+ className="btn btn-primary"
+ disabled={actionLoading}
+ >
+ {actionLoading ? 'Obtaining...' : 'Obtain Certificate'}
+ </button>
+ </div>
+ </form>
+ </div>
+ </div>
+ )}
+ </div>
+ );
+};
+
+export default SSLCertificates;
diff --git a/frontend/src/pages/WordPress.jsx b/frontend/src/pages/WordPress.jsx
index 04018cc6..9a0c1882 100644
--- a/frontend/src/pages/WordPress.jsx
+++ b/frontend/src/pages/WordPress.jsx
@@ -1,120 +1,177 @@
-import React, { useState, useEffect } from 'react';
-import { Plus, RefreshCw } from 'lucide-react';
-import wordpressApi from '../services/wordpress';
+import { useState, useEffect } from 'react';
+import { api } from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useResourceTier } from '../contexts/ResourceTierContext';
-import { WordPressSiteCard, CreateSiteModal } from '../components/wordpress';
import ResourceGate from '../components/ResourceGate';
+import Spinner from '../components/Spinner';
+import ConfirmDialog from '../components/ConfirmDialog';
-const WordPress = () => {
- const toast = useToast();
- const { canCreateWordPress, isLiteTier } = useResourceTier();
- const [sites, setSites] = useState([]);
+function WordPress() {
+ const [status, setStatus] = useState(null);
const [loading, setLoading] = useState(true);
- const [showCreateModal, setShowCreateModal] = useState(false);
- const [searchTerm, setSearchTerm] = useState('');
- const [stats, setStats] = useState({
- total: 0,
- running: 0,
- production: 0,
- development: 0
+ const [actionLoading, setActionLoading] = useState(false);
+ const [showInstallModal, setShowInstallModal] = useState(false);
+ const [confirmDialog, setConfirmDialog] = useState(null);
+ const [installForm, setInstallForm] = useState({
+ adminEmail: ''
});
+ const toast = useToast();
+ const { isLiteTier } = useResourceTier();
+
useEffect(() => {
- loadSites();
+ loadData();
}, []);
- async function loadSites() {
+ const loadData = async () => {
setLoading(true);
try {
- const data = await wordpressApi.getSites();
- const siteList = data.sites || [];
- setSites(siteList);
+ await loadStatus();
+ } catch (error) {
+ console.error('Failed to load WordPress data:', error);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const loadStatus = async () => {
+ try {
+ const data = await api.getWordPressStatus();
+ setStatus(data);
+ } catch (error) {
+ console.error('Failed to load status:', error);
+ setStatus({ installed: false });
+ }
+ };
- // Calculate stats
- const running = siteList.filter(s => s.status === 'running').length;
- const production = siteList.filter(s => s.is_production).length;
- const development = siteList.filter(s => !s.is_production).length;
+ const handleInstall = async () => {
+ if (!installForm.adminEmail) {
+ toast.error('Admin email is required');
+ return;
+ }
- setStats({
- total: siteList.length,
- running,
- production,
- development
- });
- } catch (err) {
- console.error('Failed to load WordPress sites:', err);
- toast.error('Failed to load WordPress sites');
+ setActionLoading(true);
+ try {
+ const result = await api.installWordPress(installForm);
+ if (result.success) {
+ toast.success('WordPress installed successfully');
+ setShowInstallModal(false);
+ await loadData();
+ } else {
+ toast.error(result.error || 'Installation failed');
+ }
+ } catch (error) {
+ toast.error(`Failed to install: ${error.message}`);
} finally {
- setLoading(false);
+ setActionLoading(false);
}
- }
+ };
- async function handleCreateSite(data) {
- const result = await wordpressApi.createSite(data);
- toast.success('WordPress site created successfully');
- loadSites();
- return result;
- }
+ const handleUninstall = () => {
+ setConfirmDialog({
+ title: 'Uninstall WordPress',
+ message: 'Are you sure you want to uninstall WordPress? This will stop the containers but preserve your data.',
+ confirmText: 'Uninstall',
+ variant: 'danger',
+ onConfirm: async () => {
+ setActionLoading(true);
+ try {
+ await api.uninstallWordPress(false);
+ toast.success('WordPress uninstalled');
+ await loadData();
+ } catch (error) {
+ toast.error(`Failed to uninstall: ${error.message}`);
+ } finally {
+ setActionLoading(false);
+ setConfirmDialog(null);
+ }
+ },
+ onCancel: () => setConfirmDialog(null)
+ });
+ };
- async function handleDeleteSite(siteId) {
+ const handleStart = async () => {
+ setActionLoading(true);
try {
- await wordpressApi.deleteSite(siteId);
- toast.success('WordPress site deleted');
- loadSites();
- } catch (err) {
- console.error('Failed to delete site:', err);
- toast.error(err.message || 'Failed to delete site');
+ await api.startWordPress();
+ toast.success('WordPress started');
+ await loadStatus();
+ } catch (error) {
+ toast.error(`Failed to start: ${error.message}`);
+ } finally {
+ setActionLoading(false);
}
- }
+ };
- const filteredSites = sites.filter(site => {
- if (!searchTerm) return true;
- const search = searchTerm.toLowerCase();
- return site.name?.toLowerCase().includes(search) ||
- site.url?.toLowerCase().includes(search) ||
- site.domain?.toLowerCase().includes(search);
- });
+ const handleStop = () => {
+ setConfirmDialog({
+ title: 'Stop WordPress',
+ message: 'Are you sure you want to stop WordPress?',
+ confirmText: 'Stop',
+ variant: 'warning',
+ onConfirm: async () => {
+ setActionLoading(true);
+ try {
+ await api.stopWordPress();
+ toast.success('WordPress stopped');
+ await loadStatus();
+ } catch (error) {
+ toast.error(`Failed to stop: ${error.message}`);
+ } finally {
+ setActionLoading(false);
+ setConfirmDialog(null);
+ }
+ },
+ onCancel: () => setConfirmDialog(null)
+ });
+ };
- // Skeleton Card Component for loading state
- const SiteCardSkeleton = () => (
- <div className="wp-site-card-skeleton">
- <div className="wp-site-card-skeleton-header">
- <div className="wp-site-card-skeleton-icon" />
- <div className="wp-site-card-skeleton-info">
- <div className="wp-site-card-skeleton-name" />
- <div className="wp-site-card-skeleton-url" />
- </div>
- <div className="wp-site-card-skeleton-status" />
- </div>
- <div className="wp-site-card-skeleton-body">
- <div className="wp-site-card-skeleton-meta">
- <div className="wp-site-card-skeleton-label" />
- <div className="wp-site-card-skeleton-value" />
- </div>
- <div className="wp-site-card-skeleton-meta">
- <div className="wp-site-card-skeleton-label" />
- <div className="wp-site-card-skeleton-value" />
- </div>
- </div>
- <div className="wp-site-card-skeleton-footer">
- <div className="wp-site-card-skeleton-btn" />
- <div className="wp-site-card-skeleton-btn" />
- <div className="wp-site-card-skeleton-btn" />
- </div>
- </div>
- );
+ const handleRestart = async () => {
+ setActionLoading(true);
+ try {
+ await api.restartWordPress();
+ toast.success('WordPress restarted');
+ await loadStatus();
+ } catch (error) {
+ toast.error(`Failed to restart: ${error.message}`);
+ } finally {
+ setActionLoading(false);
+ }
+ };
- const StatCardSkeleton = () => (
- <div className="docker-stat-card-skeleton">
- <div className="docker-stat-card-skeleton-label" />
- <div className="docker-stat-card-skeleton-value" />
- <div className="docker-stat-card-skeleton-meta" />
- </div>
- );
+ const openWordPress = () => {
+ if (status?.url_path) {
+ window.open(`${window.location.origin}${status.url_path}`, '_blank');
+ } else if (status?.http_port) {
+ window.open(`http://${window.location.hostname}:${status.http_port}`, '_blank');
+ }
+ };
+
+ const openWpAdmin = () => {
+ if (status?.url_path) {
+ window.open(`${window.location.origin}${status.url_path}/wp-admin`, '_blank');
+ } else if (status?.http_port) {
+ window.open(`http://${window.location.hostname}:${status.http_port}/wp-admin`, '_blank');
+ }
+ };
+
+ const getWordPressUrl = () => {
+ if (status?.url_path) {
+ return `${window.location.origin}${status.url_path}`;
+ }
+ return `http://${window.location.hostname}:${status?.http_port}`;
+ };
+
+ if (loading) {
+ return (
+ <div className="page-loading">
+ <Spinner size="lg" />
+ </div>
+ );
+ }
- // Show resource gate if on lite tier and no sites exist
- if (isLiteTier && sites.length === 0 && !loading) {
+ // Not installed + lite tier -> resource gate
+ if (!status?.installed && isLiteTier) {
return (
<div className="docker-page-new wordpress-page">
<ResourceGate feature="wordpress_create">
@@ -125,132 +182,248 @@ const WordPress = () => {
}
return (
- <div className="docker-page-new wordpress-page">
- <div className="docker-page-header">
- <div className="docker-page-title">
- <h2>WordPress Sites</h2>
- <div className="docker-page-subtitle">
- Manage your WordPress installations
- </div>
+ <div className="git-page wordpress-standalone-page">
+ <div className="page-header">
+ <div className="page-header-content">
+ <h1>WordPress</h1>
+ <p className="page-description">Self-hosted WordPress powered by Docker</p>
</div>
- <div className="docker-page-actions">
- <button
- className="btn btn-primary"
- onClick={() => setShowCreateModal(true)}
- disabled={!canCreateWordPress}
- title={!canCreateWordPress ? 'Server resources insufficient for WordPress creation' : ''}
- >
- <Plus size={16} /> New Site
- </button>
+ <div className="page-header-actions">
+ {!status?.installed ? (
+ <button className="btn btn-primary" onClick={() => setShowInstallModal(true)}>
+ Install WordPress
+ </button>
+ ) : (
+ <>
+ <button
+ className="btn btn-secondary"
+ onClick={openWordPress}
+ disabled={!status?.running}
+ >
+ Open WordPress
+ </button>
+ <button
+ className="btn btn-secondary"
+ onClick={openWpAdmin}
+ disabled={!status?.running}
+ >
+ Open wp-admin
+ </button>
+ {status?.running ? (
+ <button
+ className="btn btn-warning"
+ onClick={handleStop}
+ disabled={actionLoading}
+ >
+ Stop
+ </button>
+ ) : (
+ <button
+ className="btn btn-primary"
+ onClick={handleStart}
+ disabled={actionLoading}
+ >
+ Start
+ </button>
+ )}
+ </>
+ )}
</div>
</div>
- <div className="docker-stats-row">
- {loading ? (
- <>
- <StatCardSkeleton />
- <StatCardSkeleton />
- <StatCardSkeleton />
- <StatCardSkeleton />
- </>
- ) : (
- <>
- <div className="docker-stat-card">
- <div className="docker-stat-label">Total Sites</div>
- <div className="docker-stat-value">{stats.total}</div>
- <div className="docker-stat-meta">
- <span className="docker-stat-running">{stats.running} Running</span>
- </div>
+ {/* Not installed - show install screen */}
+ {!status?.installed && (
+ <div className="empty-state-large">
+ <div className="empty-icon">
+ <svg viewBox="0 0 24 24" width="64" height="64" fill="none" stroke="currentColor" strokeWidth="1.5">
+ <circle cx="12" cy="12" r="10"/>
+ <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
+ <path d="M2 12h20"/>
+ </svg>
+ </div>
+ <h2>WordPress Not Installed</h2>
+ <p>Deploy WordPress with MySQL using Docker Compose. One-click setup with automatic configuration.</p>
+ <div className="resource-warning">
+ <div className="warning-header">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="12" r="10"/><path d="M12 8v4M12 16h.01"/></svg>
+ <strong>Resource Requirements</strong>
</div>
- <div className="docker-stat-card">
- <div className="docker-stat-label">Production</div>
- <div className="docker-stat-value">{stats.production}</div>
- <div className="docker-stat-meta">Live sites</div>
+ <ul>
+ <li><strong>Memory:</strong> 512MB minimum, 1GB recommended</li>
+ <li><strong>Storage:</strong> 2GB minimum, 10GB recommended</li>
+ <li>Deploys WordPress + MySQL 8.0 containers</li>
+ </ul>
+ </div>
+ <button className="btn btn-primary" onClick={() => setShowInstallModal(true)}>
+ Install WordPress
+ </button>
+ </div>
+ )}
+
+ {/* Installed - show status */}
+ {status?.installed && (
+ <>
+ <div className="status-cards">
+ <div className={`status-card ${status?.running ? 'success' : 'danger'}`}>
+ <div className="status-icon">
+ {status?.running ? (
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
+ ) : (
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>
+ )}
+ </div>
+ <div className="status-info">
+ <span className="status-label">Status</span>
+ <span className="status-value">{status?.running ? 'Running' : 'Stopped'}</span>
+ </div>
</div>
- <div className="docker-stat-card">
- <div className="docker-stat-label">Development</div>
- <div className="docker-stat-value">{stats.development}</div>
- <div className="docker-stat-meta">Dev/staging environments</div>
+ <div className="status-card">
+ <div className="status-icon">
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
+ </div>
+ <div className="status-info">
+ <span className="status-label">Version</span>
+ <span className="status-value">{status?.version || '6.4'}</span>
+ </div>
</div>
- <div className="docker-stat-card">
- <div className="docker-stat-label">Running</div>
- <div className="docker-stat-value">{stats.running}</div>
- <div className="docker-stat-meta">Active sites</div>
+ <div className="status-card">
+ <div className="status-icon">
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
+ </div>
+ <div className="status-info">
+ <span className="status-label">Port</span>
+ <span className="status-value">{status?.http_port || '—'}</span>
+ </div>
</div>
- </>
- )}
- </div>
-
- <div className="docker-panel">
- <div className="docker-panel-header">
- <div className="docker-panel-tabs">
- <div className="docker-panel-tab active">All Sites</div>
- </div>
- <div className="docker-panel-actions">
- <button className="btn btn-secondary btn-sm" onClick={loadSites}>
- <RefreshCw size={14} /> Refresh
- </button>
</div>
- </div>
- <div className="docker-panel-content">
- <div className="docker-table-header">
- <div />
- <input
- type="text"
- className="docker-search"
- placeholder="Search sites..."
- value={searchTerm}
- onChange={(e) => setSearchTerm(e.target.value)}
- />
+ <div className="overview-tab">
+ <div className="info-card">
+ <h3>Access</h3>
+ <div className="info-grid">
+ <div className="info-item">
+ <span className="info-label">URL</span>
+ <span className="info-value">
+ {status?.running ? (
+ <a href={getWordPressUrl()} target="_blank" rel="noopener noreferrer">
+ {getWordPressUrl()}
+ </a>
+ ) : '—'}
+ </span>
+ </div>
+ <div className="info-item">
+ <span className="info-label">Admin Panel</span>
+ <span className="info-value">
+ {status?.running ? (
+ <a href={`${getWordPressUrl()}/wp-admin`} target="_blank" rel="noopener noreferrer">
+ {getWordPressUrl()}/wp-admin
+ </a>
+ ) : '—'}
+ </span>
+ </div>
+ <div className="info-item">
+ <span className="info-label">HTTP Port</span>
+ <span className="info-value code">{status?.http_port || '—'}</span>
+ </div>
+ </div>
+ </div>
+
+ <div className="info-card">
+ <h3>Actions</h3>
+ <div className="info-grid">
+ <div className="quick-actions">
+ {status?.running ? (
+ <>
+ <button className="btn btn-secondary" onClick={handleRestart} disabled={actionLoading}>
+ Restart
+ </button>
+ <button className="btn btn-warning" onClick={handleStop} disabled={actionLoading}>
+ Stop
+ </button>
+ </>
+ ) : (
+ <button className="btn btn-primary" onClick={handleStart} disabled={actionLoading}>
+ Start
+ </button>
+ )}
+ <button className="btn btn-danger" onClick={handleUninstall} disabled={actionLoading}>
+ Uninstall
+ </button>
+ </div>
+ </div>
+ </div>
</div>
+ </>
+ )}
- {loading ? (
- <div className="wp-sites-grid">
- <SiteCardSkeleton />
- <SiteCardSkeleton />
- <SiteCardSkeleton />
+ {/* Install Modal */}
+ {showInstallModal && (
+ <div className="modal-overlay" onClick={() => !actionLoading && setShowInstallModal(false)}>
+ <div className="modal modal-lg" onClick={e => e.stopPropagation()}>
+ <div className="modal-header">
+ <h3>Install WordPress</h3>
+ <button className="modal-close" onClick={() => !actionLoading && setShowInstallModal(false)}>
+ &times;
+ </button>
</div>
- ) : filteredSites.length === 0 ? (
- <div className="docker-empty">
- <div className="wp-empty-icon">
- <svg viewBox="0 0 24 24" width="48" height="48" fill="none" stroke="currentColor" strokeWidth="1.5">
- <circle cx="12" cy="12" r="10"/>
- <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
- <path d="M2 12h20"/>
- </svg>
+ <div className="modal-body">
+ <div className="install-warning">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="12" r="10"/><path d="M12 8v4M12 16h.01"/></svg>
+ <div>
+ <strong>This will install:</strong>
+ <ul>
+ <li>WordPress 6.4 (Apache)</li>
+ <li>MySQL 8.0 database</li>
+ <li>Nginx reverse proxy at /wordpress</li>
+ </ul>
+ </div>
+ </div>
+
+ <div className="form-group">
+ <label>
+ Admin Email <span className="required">*</span>
+ </label>
+ <input
+ type="email"
+ value={installForm.adminEmail}
+ onChange={e => setInstallForm({ ...installForm, adminEmail: e.target.value })}
+ placeholder="[email protected]"
+ disabled={actionLoading}
+ />
</div>
- <h3>No WordPress sites</h3>
- <p>Create your first WordPress site to get started.</p>
+ </div>
+ <div className="modal-footer">
+ <button
+ className="btn btn-secondary"
+ onClick={() => setShowInstallModal(false)}
+ disabled={actionLoading}
+ >
+ Cancel
+ </button>
<button
className="btn btn-primary"
- onClick={() => setShowCreateModal(true)}
+ onClick={handleInstall}
+ disabled={actionLoading || !installForm.adminEmail}
>
- <Plus size={16} /> Create Site
+ {actionLoading ? <><Spinner size="sm" /> Installing...</> : 'Install WordPress'}
</button>
</div>
- ) : (
- <div className="wp-sites-grid">
- {filteredSites.map(site => (
- <WordPressSiteCard
- key={site.id}
- site={site}
- onDelete={handleDeleteSite}
- />
- ))}
- </div>
- )}
+ </div>
</div>
- </div>
+ )}
- {showCreateModal && (
- <CreateSiteModal
- onClose={() => setShowCreateModal(false)}
- onCreate={handleCreateSite}
+ {confirmDialog && (
+ <ConfirmDialog
+ title={confirmDialog.title}
+ message={confirmDialog.message}
+ confirmText={confirmDialog.confirmText}
+ variant={confirmDialog.variant}
+ onConfirm={confirmDialog.onConfirm}
+ onCancel={confirmDialog.onCancel}
/>
)}
</div>
);
-};
+}
export default WordPress;
diff --git a/frontend/src/services/api.js b/frontend/src/services/api.js
index 538a4c93..6257d36c 100644
--- a/frontend/src/services/api.js
+++ b/frontend/src/services/api.js
@@ -467,6 +467,14 @@ class ApiService {
return this.request(`/ssl/certificates/${domain}`, { method: 'DELETE' });
}
+ async setupAutoRenewal() {
+ return this.request('/ssl/auto-renewal', { method: 'POST' });
+ }
+
+ async installCertbot() {
+ return this.request('/ssl/install-certbot', { method: 'POST' });
+ }
+
// Log endpoints
async getLogFiles() {
return this.request('/logs');
@@ -1791,6 +1799,43 @@ class ApiService {
return this.request('/git/restart', { method: 'POST' });
}
+ // ========================================
+ // WordPress Standalone endpoints
+ // ========================================
+ async getWordPressStatus() {
+ return this.request('/wordpress/standalone/status');
+ }
+
+ async getWordPressRequirements() {
+ return this.request('/wordpress/standalone/requirements');
+ }
+
+ async installWordPress(data) {
+ return this.request('/wordpress/standalone/install', {
+ method: 'POST',
+ body: data
+ });
+ }
+
+ async uninstallWordPress(removeData = false) {
+ return this.request('/wordpress/standalone/uninstall', {
+ method: 'POST',
+ body: { removeData }
+ });
+ }
+
+ async startWordPress() {
+ return this.request('/wordpress/standalone/start', { method: 'POST' });
+ }
+
+ async stopWordPress() {
+ return this.request('/wordpress/standalone/stop', { method: 'POST' });
+ }
+
+ async restartWordPress() {
+ return this.request('/wordpress/standalone/restart', { method: 'POST' });
+ }
+
// Git Webhooks
async getWebhooks() {
return this.request('/git/webhooks');
diff --git a/frontend/src/styles/main.less b/frontend/src/styles/main.less
index e08a404f..70f486a7 100644
--- a/frontend/src/styles/main.less
+++ b/frontend/src/styles/main.less
@@ -76,3 +76,4 @@
@import 'pages/_servers';
@import 'pages/_downloads';
@import 'pages/_wordpress';
+@import 'pages/_ssl';
diff --git a/frontend/src/styles/pages/_ssl.less b/frontend/src/styles/pages/_ssl.less
new file mode 100644
index 00000000..a8e378b2
--- /dev/null
+++ b/frontend/src/styles/pages/_ssl.less
@@ -0,0 +1,138 @@
+// ============================================
+// SSL CERTIFICATES PAGE
+// ============================================
+
+.ssl-page {
+ // Reuses .ssl-status-bar, .ssl-status-item, etc. from _domains.less
+}
+
+// Warning icon color variant
+.ssl-status-icon {
+ &.warning {
+ background: @warning-bg;
+ color: @warning;
+ }
+}
+
+// Certificate list
+.ssl-cert-list {
+ .flex-column-gap(@space-3);
+}
+
+.ssl-cert-item {
+ .list-item-base();
+ gap: @space-4;
+
+ @media (max-width: @breakpoint-md) {
+ flex-wrap: wrap;
+ }
+}
+
+.ssl-cert-item-info {
+ .flex-start();
+ gap: @space-4;
+ flex: 1;
+ min-width: 0;
+}
+
+.ssl-cert-item-icon {
+ .icon-box();
+ background: @success-bg;
+ border-radius: @radius-lg;
+ color: @success;
+
+ &.expiring {
+ background: @warning-bg;
+ color: @warning;
+ }
+}
+
+.ssl-cert-item-details {
+ min-width: 0;
+
+ h3 {
+ font-size: @font-size-base;
+ font-weight: @font-weight-semibold;
+ color: @text-primary;
+ margin-bottom: @space-1;
+ }
+}
+
+.ssl-cert-item-meta {
+ .flex-start();
+ gap: @space-4;
+ font-size: @font-size-sm;
+ color: @text-tertiary;
+ flex-wrap: wrap;
+
+ span {
+ .flex-start();
+ gap: @space-1;
+
+ &.valid {
+ color: @success;
+ }
+
+ &.expiring {
+ color: @warning;
+ }
+ }
+}
+
+.ssl-cert-item-status {
+ flex-shrink: 0;
+}
+
+.ssl-cert-item-actions {
+ display: flex;
+ gap: @space-2;
+ flex-shrink: 0;
+}
+
+// Warning banner for expiring certs
+.ssl-warning-banner {
+ .flex-start();
+ gap: @space-3;
+ padding: @space-4 @space-5;
+ background: @warning-bg;
+ border: 1px solid @warning-border;
+ border-radius: @radius-xl;
+ margin-top: @space-6;
+ color: @warning;
+
+ div {
+ flex: 1;
+ font-size: @font-size-sm;
+ color: @text-secondary;
+
+ strong {
+ color: @warning;
+ }
+ }
+
+ .btn {
+ flex-shrink: 0;
+ }
+}
+
+// Spinning icon for renewal
+.spin {
+ animation: ssl-spin 1s linear infinite;
+}
+
+@keyframes ssl-spin {
+ from { transform: rotate(0deg); }
+ to { transform: rotate(360deg); }
+}
+
+// Skeleton loading
+.skeleton-box {
+ background: @bg-hover;
+ border-radius: @radius-md;
+ animation: ssl-skeleton-pulse 1.5s ease-in-out infinite;
+}
+
+@keyframes ssl-skeleton-pulse {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.4; }
+}
diff --git a/frontend/src/styles/pages/_wordpress.less b/frontend/src/styles/pages/_wordpress.less
index 01cc9d1d..6ea0cf28 100644
--- a/frontend/src/styles/pages/_wordpress.less
+++ b/frontend/src/styles/pages/_wordpress.less
@@ -2,6 +2,33 @@
// WORDPRESS PAGE STYLES
// ============================================
+// WordPress Standalone Page (Docker-based, mirrors Git page layout)
+.wordpress-standalone-page {
+ // Inherits .git-page styles for layout, status cards, overview tab, etc.
+
+ .empty-state-large {
+ .empty-icon svg {
+ stroke: #21759b;
+ }
+ }
+
+ .status-card.success {
+ border-left-color: @color-success;
+
+ .status-icon {
+ color: @color-success;
+ }
+ }
+
+ .status-card.danger {
+ border-left-color: @color-danger;
+
+ .status-icon {
+ color: @color-danger;
+ }
+ }
+}
+
// WordPress Page Layout (extends Docker page styles)
.wordpress-page {
.docker-empty {
diff --git a/install.sh b/install.sh
index d1683f82..ce21d02c 100644
--- a/install.sh
+++ b/install.sh
@@ -6,7 +6,7 @@
# - Backend: Runs directly on host (for full system access)
# - Frontend: Runs in Docker (nginx serving static files)
#
-# Usage: curl -fsSL https://raw.githubusercontent.com/jhd3197/serverkit/main/install.sh | bash
+# Usage: curl -fsSL https://serverkit.ai/install.sh | bash
#
set -e
diff --git a/serverkit b/serverkit
index 5b3a76d7..aa506667 100644
--- a/serverkit
+++ b/serverkit
@@ -516,7 +516,7 @@ cmd_uninstall() {
print_success "ServerKit uninstalled"
echo ""
echo "To reinstall, run:"
- echo " cd ~ && curl -fsSL https://raw.githubusercontent.com/jhd3197/ServerKit/main/install.sh | sudo bash"
+ echo " cd ~ && curl -fsSL https://serverkit.ai/install.sh | sudo bash"
fi
}