feat: initial commit
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
123
scripts/health-check.sh
Normal file
123
scripts/health-check.sh
Normal file
@@ -0,0 +1,123 @@
|
||||
#!/bin/bash
|
||||
# Health check script
|
||||
# Verifies that the server installation is successful
|
||||
|
||||
set -e
|
||||
|
||||
SERVER_PATH="${1:-.}"
|
||||
CHECK_NODE="${2:-false}"
|
||||
CHECK_PHP="${3:-false}"
|
||||
CHECK_NGINX="${4:-false}"
|
||||
|
||||
echo "Running health check for server at: $SERVER_PATH"
|
||||
|
||||
cd "$SERVER_PATH"
|
||||
|
||||
# Check if server directory exists
|
||||
if [ ! -d "." ]; then
|
||||
echo "✗ Server directory not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Server directory exists"
|
||||
|
||||
# Check Node.js installation
|
||||
if [ "$CHECK_NODE" == "true" ]; then
|
||||
echo ""
|
||||
echo "Checking Node.js installation..."
|
||||
|
||||
if command -v node &> /dev/null; then
|
||||
NODE_VERSION=$(node --version)
|
||||
echo "✓ Node.js installed: $NODE_VERSION"
|
||||
else
|
||||
echo "✗ Node.js not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v npm &> /dev/null; then
|
||||
NPM_VERSION=$(npm --version)
|
||||
echo "✓ npm installed: $NPM_VERSION"
|
||||
else
|
||||
echo "✗ npm not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if package.json exists
|
||||
if [ -f "package.json" ]; then
|
||||
echo "✓ package.json found"
|
||||
|
||||
# Check if node_modules exists
|
||||
if [ -d "node_modules" ]; then
|
||||
echo "✓ Node.js dependencies installed"
|
||||
else
|
||||
echo "✗ Node.js dependencies not installed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check PHP installation
|
||||
if [ "$CHECK_PHP" == "true" ]; then
|
||||
echo ""
|
||||
echo "Checking PHP installation..."
|
||||
|
||||
if command -v php &> /dev/null; then
|
||||
PHP_VERSION=$(php --version | head -n 1)
|
||||
echo "✓ PHP installed: $PHP_VERSION"
|
||||
else
|
||||
echo "✗ PHP not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v composer &> /dev/null; then
|
||||
COMPOSER_VERSION=$(composer --version | head -n 1)
|
||||
echo "✓ Composer installed: $COMPOSER_VERSION"
|
||||
else
|
||||
echo "✗ Composer not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if composer.json exists
|
||||
if [ -f "composer.json" ]; then
|
||||
echo "✓ composer.json found"
|
||||
|
||||
# Check if vendor directory exists
|
||||
if [ -d "vendor" ]; then
|
||||
echo "✓ PHP dependencies installed"
|
||||
else
|
||||
echo "✗ PHP dependencies not installed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check nginx installation
|
||||
if [ "$CHECK_NGINX" == "true" ]; then
|
||||
echo ""
|
||||
echo "Checking nginx installation..."
|
||||
|
||||
if command -v nginx &> /dev/null; then
|
||||
NGINX_VERSION=$(nginx -version 2>&1)
|
||||
echo "✓ nginx installed: $NGINX_VERSION"
|
||||
else
|
||||
echo "✗ nginx not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if nginx is running
|
||||
if systemctl is-active --quiet nginx 2>/dev/null || pgrep nginx > /dev/null 2>&1; then
|
||||
echo "✓ nginx is running"
|
||||
else
|
||||
echo "⚠ nginx is installed but not running"
|
||||
fi
|
||||
|
||||
# Check nginx configuration
|
||||
if sudo nginx -t &> /dev/null; then
|
||||
echo "✓ nginx configuration is valid"
|
||||
else
|
||||
echo "⚠ nginx configuration may have issues"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✓ Health check passed!"
|
||||
exit 0
|
||||
22
scripts/post-install.sh
Normal file
22
scripts/post-install.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Example post-install script
|
||||
# This script runs after dependencies are installed
|
||||
|
||||
set -e
|
||||
|
||||
echo "Running post-installation tasks..."
|
||||
|
||||
# Example: Set permissions
|
||||
# chmod +x ./server/bin/*
|
||||
|
||||
# Example: Create necessary directories
|
||||
# mkdir -p ./server/logs
|
||||
# mkdir -p ./server/tmp
|
||||
|
||||
# Example: Run database migrations
|
||||
# npm run migrate
|
||||
|
||||
# Example: Clear cache
|
||||
# npm run cache:clear
|
||||
|
||||
echo "Post-installation completed successfully!"
|
||||
Reference in New Issue
Block a user