v0.1.19 - Lots of remote hosting fixes
This commit is contained in:
495
deploy_lt.sh
495
deploy_lt.sh
@@ -22,278 +22,226 @@ fi
|
||||
# Configuration
|
||||
REMOTE_HOST="laantungir.net"
|
||||
REMOTE_USER="ubuntu"
|
||||
REMOTE_DIR="/home/ubuntu/ginxsom"
|
||||
REMOTE_DB_PATH="/home/ubuntu/ginxsom/db/ginxsom.db"
|
||||
REMOTE_NGINX_CONFIG="/etc/nginx/conf.d/default.conf"
|
||||
REMOTE_BINARY_PATH="/home/ubuntu/ginxsom/ginxsom.fcgi"
|
||||
|
||||
# Deployment paths
|
||||
REMOTE_BINARY_DIR="/usr/local/bin/ginxsom"
|
||||
REMOTE_BINARY_PATH="$REMOTE_BINARY_DIR/ginxsom-fcgi"
|
||||
REMOTE_DB_PATH="$REMOTE_BINARY_DIR"
|
||||
REMOTE_BLOB_DIR="/var/www/blobs"
|
||||
REMOTE_SOCKET="/tmp/ginxsom-fcgi.sock"
|
||||
REMOTE_DATA_DIR="/var/www/html/blossom"
|
||||
|
||||
print_status "Starting deployment to $REMOTE_HOST..."
|
||||
# Production keys
|
||||
ADMIN_PUBKEY="1ec454734dcbf6fe54901ce25c0c7c6bca5edd89443416761fadc321d38df139"
|
||||
SERVER_PRIVKEY="90df3fe61e7d19e50f387e4c5db87eff1a7d2a1037cd55026c4b21a4fda8ecf6"
|
||||
|
||||
# Step 1: Build and prepare local binary
|
||||
print_status "Building ginxsom binary..."
|
||||
make clean && make
|
||||
if [[ ! -f "build/ginxsom-fcgi" ]]; then
|
||||
print_error "Build failed - binary not found"
|
||||
# Local paths
|
||||
LOCAL_BINARY="build/ginxsom-fcgi_static_x86_64"
|
||||
|
||||
print_status "=========================================="
|
||||
print_status "Ginxsom Static Binary Deployment"
|
||||
print_status "=========================================="
|
||||
print_status "Target: $REMOTE_HOST"
|
||||
print_status "Binary: $REMOTE_BINARY_PATH"
|
||||
print_status "Database: $REMOTE_DB_PATH"
|
||||
print_status "Blobs: $REMOTE_BLOB_DIR"
|
||||
print_status "Fresh install: $FRESH_INSTALL"
|
||||
print_status "=========================================="
|
||||
echo ""
|
||||
|
||||
# Step 1: Verify local binary exists
|
||||
print_status "Step 1: Verifying local static binary..."
|
||||
if [[ ! -f "$LOCAL_BINARY" ]]; then
|
||||
print_error "Static binary not found: $LOCAL_BINARY"
|
||||
print_status "Please run: ./build_static.sh"
|
||||
exit 1
|
||||
fi
|
||||
print_success "Binary built successfully"
|
||||
|
||||
# Step 2: Setup remote environment first (before copying files)
|
||||
print_status "Setting up remote environment..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << 'EOF'
|
||||
# Verify it's actually static
|
||||
if ldd "$LOCAL_BINARY" 2>&1 | grep -q "not a dynamic executable\|statically linked"; then
|
||||
print_success "Binary is static"
|
||||
else
|
||||
print_warning "Binary may not be fully static - proceeding anyway"
|
||||
fi
|
||||
|
||||
BINARY_SIZE=$(du -h "$LOCAL_BINARY" | cut -f1)
|
||||
print_success "Found static binary ($BINARY_SIZE)"
|
||||
echo ""
|
||||
|
||||
# Step 2: Upload binary to server
|
||||
print_status "Step 2: Uploading binary to server..."
|
||||
scp "$LOCAL_BINARY" $REMOTE_USER@$REMOTE_HOST:~/ginxsom-fcgi_new || {
|
||||
print_error "Failed to upload binary"
|
||||
exit 1
|
||||
}
|
||||
print_success "Binary uploaded to ~/ginxsom-fcgi_new"
|
||||
echo ""
|
||||
|
||||
# Step 3: Setup directories
|
||||
print_status "Step 3: Setting up directories..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << EOF
|
||||
set -e
|
||||
|
||||
# Create data directory if it doesn't exist (using existing /var/www/html/blossom)
|
||||
sudo mkdir -p /var/www/html/blossom
|
||||
sudo chown www-data:www-data /var/www/html/blossom
|
||||
sudo chmod 755 /var/www/html/blossom
|
||||
|
||||
# Ensure socket directory exists
|
||||
sudo mkdir -p /tmp
|
||||
sudo chmod 755 /tmp
|
||||
|
||||
# Install required dependencies
|
||||
echo "Installing required dependencies..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y spawn-fcgi libfcgi-dev
|
||||
|
||||
# Stop any existing ginxsom processes
|
||||
echo "Stopping existing ginxsom processes..."
|
||||
sudo pkill -f ginxsom-fcgi || true
|
||||
sudo rm -f /tmp/ginxsom-fcgi.sock || true
|
||||
|
||||
echo "Remote environment setup complete"
|
||||
EOF
|
||||
|
||||
print_success "Remote environment configured"
|
||||
|
||||
# Step 3: Copy files to remote server
|
||||
print_status "Copying files to remote server..."
|
||||
|
||||
# Copy entire project directory (excluding unnecessary files)
|
||||
# Note: We include .git and .gitmodules to allow submodule initialization on remote
|
||||
print_status "Copying entire ginxsom project..."
|
||||
rsync -avz --exclude='build' --exclude='logs' --exclude='Trash' --exclude='blobs' --exclude='db' --no-g --no-o --no-perms --omit-dir-times . $REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/
|
||||
|
||||
# Initialize git submodules on remote server
|
||||
print_status "Initializing git submodules on remote server..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << 'EOF'
|
||||
cd /home/ubuntu/ginxsom
|
||||
|
||||
# Check if .git exists
|
||||
if [ ! -d .git ]; then
|
||||
echo "ERROR: .git directory not found - git repository not copied"
|
||||
exit 1
|
||||
fi
|
||||
# Create binary/database directory
|
||||
echo "Creating application directory..."
|
||||
sudo mkdir -p $REMOTE_BINARY_DIR
|
||||
sudo chown www-data:www-data $REMOTE_BINARY_DIR
|
||||
sudo chmod 755 $REMOTE_BINARY_DIR
|
||||
|
||||
# Check if .gitmodules exists
|
||||
if [ ! -f .gitmodules ]; then
|
||||
echo "ERROR: .gitmodules file not found"
|
||||
exit 1
|
||||
fi
|
||||
# Create blob storage directory
|
||||
echo "Creating blob storage directory..."
|
||||
sudo mkdir -p $REMOTE_BLOB_DIR
|
||||
sudo chown www-data:www-data $REMOTE_BLOB_DIR
|
||||
sudo chmod 755 $REMOTE_BLOB_DIR
|
||||
|
||||
echo "Initializing git submodules..."
|
||||
git submodule update --init --recursive
|
||||
# Create logs directory
|
||||
echo "Creating logs directory..."
|
||||
sudo mkdir -p $REMOTE_BINARY_DIR/logs/app
|
||||
sudo chown -R www-data:www-data $REMOTE_BINARY_DIR/logs
|
||||
sudo chmod -R 755 $REMOTE_BINARY_DIR/logs
|
||||
|
||||
# Verify submodule was initialized
|
||||
if [ ! -f nostr_core_lib/cjson/cJSON.h ]; then
|
||||
echo "ERROR: Submodule initialization failed - cJSON.h not found"
|
||||
echo "Checking nostr_core_lib directory:"
|
||||
ls -la nostr_core_lib/ || echo "nostr_core_lib directory not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Submodules initialized successfully"
|
||||
|
||||
# Build nostr_core_lib
|
||||
echo "Building nostr_core_lib..."
|
||||
cd nostr_core_lib
|
||||
./build.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed to build nostr_core_lib"
|
||||
exit 1
|
||||
fi
|
||||
echo "nostr_core_lib built successfully"
|
||||
echo "Directories created successfully"
|
||||
EOF
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
print_error "Failed to initialize git submodules or build nostr_core_lib"
|
||||
print_error "Failed to create directories"
|
||||
exit 1
|
||||
fi
|
||||
print_success "Directories created"
|
||||
echo ""
|
||||
|
||||
# Build on remote server to ensure compatibility
|
||||
print_status "Building ginxsom on remote server..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST "cd $REMOTE_DIR && make clean && make" || {
|
||||
print_error "Build failed on remote server"
|
||||
print_status "Checking what packages are actually installed..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST "dpkg -l | grep -E '(sqlite|fcgi)'"
|
||||
# Step 4: Handle fresh install if requested
|
||||
if [ "$FRESH_INSTALL" = true ]; then
|
||||
print_status "Step 4: Fresh install - removing existing data..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << EOF
|
||||
sudo rm -f $REMOTE_DB_PATH/*.db
|
||||
sudo rm -rf $REMOTE_BLOB_DIR/*
|
||||
echo "Existing data removed"
|
||||
EOF
|
||||
print_success "Fresh install prepared"
|
||||
echo ""
|
||||
else
|
||||
print_status "Step 4: Preserving existing data"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Step 5: Install minimal dependencies
|
||||
print_status "Step 5: Installing minimal dependencies..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << 'EOF'
|
||||
set -e
|
||||
|
||||
# Check if spawn-fcgi is installed
|
||||
if ! command -v spawn-fcgi &> /dev/null; then
|
||||
echo "Installing spawn-fcgi..."
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y spawn-fcgi
|
||||
echo "spawn-fcgi installed"
|
||||
else
|
||||
echo "spawn-fcgi already installed"
|
||||
fi
|
||||
EOF
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
print_success "Dependencies verified"
|
||||
else
|
||||
print_error "Failed to install dependencies"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Step 6: Upload and install systemd service file
|
||||
print_status "Step 6: Installing systemd service file..."
|
||||
scp ginxsom.service $REMOTE_USER@$REMOTE_HOST:~/ginxsom.service || {
|
||||
print_error "Failed to upload service file"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Copy binary to application directory
|
||||
print_status "Copying ginxsom binary to application directory..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << EOF
|
||||
# Stop any running process first
|
||||
sudo pkill -f ginxsom-fcgi || true
|
||||
sleep 1
|
||||
|
||||
# Remove old binary if it exists
|
||||
rm -f $REMOTE_BINARY_PATH
|
||||
|
||||
# Copy new binary
|
||||
cp $REMOTE_DIR/build/ginxsom-fcgi $REMOTE_BINARY_PATH
|
||||
chmod +x $REMOTE_BINARY_PATH
|
||||
chown ubuntu:ubuntu $REMOTE_BINARY_PATH
|
||||
|
||||
echo "Binary copied successfully"
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << 'EOF'
|
||||
sudo cp ~/ginxsom.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
echo "Service file installed"
|
||||
EOF
|
||||
|
||||
# NOTE: Do NOT update nginx configuration automatically
|
||||
# The deployment script should only update ginxsom binaries and do nothing else with the system
|
||||
# Nginx configuration should be managed manually by the system administrator
|
||||
print_status "Skipping nginx configuration update (manual control required)"
|
||||
if [ $? -eq 0 ]; then
|
||||
print_success "Service file installed"
|
||||
else
|
||||
print_error "Failed to install service file"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
print_success "Files copied to remote server"
|
||||
|
||||
# Step 3: Setup remote environment
|
||||
print_status "Setting up remote environment..."
|
||||
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << 'EOF'
|
||||
# Step 7: Stop existing service and install new binary
|
||||
print_status "Step 7: Stopping existing service and installing new binary..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << EOF
|
||||
set -e
|
||||
|
||||
# Create data directory if it doesn't exist (using existing /var/www/html/blossom)
|
||||
sudo mkdir -p /var/www/html/blossom
|
||||
sudo chown www-data:www-data /var/www/html/blossom
|
||||
sudo chmod 755 /var/www/html/blossom
|
||||
|
||||
# Ensure socket directory exists
|
||||
sudo mkdir -p /tmp
|
||||
sudo chmod 755 /tmp
|
||||
|
||||
# Install required dependencies
|
||||
echo "Installing required dependencies..."
|
||||
sudo apt-get update 2>/dev/null || true # Continue even if apt update has issues
|
||||
sudo apt-get install -y spawn-fcgi libfcgi-dev libsqlite3-dev sqlite3 libcurl4-openssl-dev
|
||||
|
||||
# Verify installations
|
||||
echo "Verifying installations..."
|
||||
if ! dpkg -l libsqlite3-dev >/dev/null 2>&1; then
|
||||
echo "libsqlite3-dev not found, trying alternative..."
|
||||
sudo apt-get install -y libsqlite3-dev || {
|
||||
echo "Failed to install libsqlite3-dev"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
if ! dpkg -l libfcgi-dev >/dev/null 2>&1; then
|
||||
echo "libfcgi-dev not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if sqlite3.h exists
|
||||
if [ ! -f /usr/include/sqlite3.h ]; then
|
||||
echo "sqlite3.h not found in /usr/include/"
|
||||
find /usr -name "sqlite3.h" 2>/dev/null || echo "sqlite3.h not found anywhere"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Stop any existing ginxsom processes
|
||||
echo "Stopping existing ginxsom processes..."
|
||||
sudo pkill -f ginxsom-fcgi || true
|
||||
sudo rm -f /tmp/ginxsom-fcgi.sock || true
|
||||
|
||||
echo "Remote environment setup complete"
|
||||
EOF
|
||||
|
||||
print_success "Remote environment configured"
|
||||
|
||||
# Step 4: Setup database directory and migrate database
|
||||
print_status "Setting up database directory..."
|
||||
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << EOF
|
||||
# Create db directory if it doesn't exist
|
||||
mkdir -p $REMOTE_DIR/db
|
||||
|
||||
if [ "$FRESH_INSTALL" = "true" ]; then
|
||||
echo "Fresh install: removing existing database and blobs..."
|
||||
# Remove existing database
|
||||
sudo rm -f $REMOTE_DB_PATH
|
||||
sudo rm -f /var/www/html/blossom/ginxsom.db
|
||||
# Remove existing blobs
|
||||
sudo rm -rf $REMOTE_DATA_DIR/*
|
||||
echo "Existing data removed"
|
||||
else
|
||||
# Backup current database if it exists in old location
|
||||
if [ -f /var/www/html/blossom/ginxsom.db ]; then
|
||||
echo "Backing up existing database..."
|
||||
cp /var/www/html/blossom/ginxsom.db /var/www/html/blossom/ginxsom.db.backup.\$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
# Migrate database to new location if not already there
|
||||
if [ ! -f $REMOTE_DB_PATH ]; then
|
||||
echo "Migrating database to new location..."
|
||||
cp /var/www/html/blossom/ginxsom.db $REMOTE_DB_PATH
|
||||
else
|
||||
echo "Database already exists at new location"
|
||||
fi
|
||||
elif [ ! -f $REMOTE_DB_PATH ]; then
|
||||
echo "No existing database found - will be created on first run"
|
||||
else
|
||||
echo "Database already exists at $REMOTE_DB_PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set proper permissions - www-data needs write access to db directory for SQLite journal files
|
||||
sudo chown -R www-data:www-data $REMOTE_DIR/db
|
||||
sudo chmod 755 $REMOTE_DIR/db
|
||||
sudo chmod 644 $REMOTE_DB_PATH 2>/dev/null || true
|
||||
|
||||
# Allow www-data to access the application directory for spawn-fcgi chdir
|
||||
chmod 755 $REMOTE_DIR
|
||||
|
||||
echo "Database directory setup complete"
|
||||
EOF
|
||||
|
||||
print_success "Database directory configured"
|
||||
|
||||
# Step 5: Start ginxsom FastCGI process
|
||||
print_status "Starting ginxsom FastCGI process..."
|
||||
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << EOF
|
||||
# Clean up any existing socket
|
||||
sleep 2
|
||||
|
||||
# Remove old socket
|
||||
sudo rm -f $REMOTE_SOCKET
|
||||
|
||||
# Install new binary
|
||||
echo "Installing new binary..."
|
||||
sudo mv ~/ginxsom-fcgi_new $REMOTE_BINARY_PATH
|
||||
sudo chmod +x $REMOTE_BINARY_PATH
|
||||
sudo chown www-data:www-data $REMOTE_BINARY_PATH
|
||||
|
||||
echo "Binary installed successfully"
|
||||
EOF
|
||||
|
||||
# Start FastCGI process with explicit paths
|
||||
if [ $? -eq 0 ]; then
|
||||
print_success "Binary installed"
|
||||
else
|
||||
print_error "Failed to install binary"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Step 8: Start ginxsom FastCGI process
|
||||
print_status "Step 8: Starting ginxsom service..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << EOF
|
||||
set -e
|
||||
|
||||
echo "Starting ginxsom FastCGI with configuration:"
|
||||
echo " Working directory: $REMOTE_DIR"
|
||||
echo " Binary: $REMOTE_BINARY_PATH"
|
||||
echo " Database: $REMOTE_DB_PATH"
|
||||
echo " Storage: $REMOTE_DATA_DIR"
|
||||
echo " Storage: $REMOTE_BLOB_DIR"
|
||||
echo " Socket: $REMOTE_SOCKET"
|
||||
echo ""
|
||||
|
||||
sudo spawn-fcgi \
|
||||
-M 666 \
|
||||
-u www-data \
|
||||
-g www-data \
|
||||
-s $REMOTE_SOCKET \
|
||||
-U www-data \
|
||||
-G www-data \
|
||||
-d $REMOTE_BINARY_DIR \
|
||||
-- $REMOTE_BINARY_PATH \
|
||||
--admin-pubkey $ADMIN_PUBKEY \
|
||||
--server-privkey $SERVER_PRIVKEY \
|
||||
--db-path $REMOTE_DB_PATH \
|
||||
--storage-dir $REMOTE_BLOB_DIR
|
||||
|
||||
sudo spawn-fcgi -M 666 -u www-data -g www-data -s $REMOTE_SOCKET -U www-data -G www-data -d $REMOTE_DIR -- $REMOTE_BINARY_PATH --db-path "$REMOTE_DB_PATH" --storage-dir "$REMOTE_DATA_DIR"
|
||||
|
||||
# Give it a moment to start
|
||||
sleep 2
|
||||
|
||||
|
||||
# Verify process is running
|
||||
if pgrep -f "ginxsom-fcgi" > /dev/null; then
|
||||
echo "FastCGI process started successfully"
|
||||
echo "PID: \$(pgrep -f ginxsom-fcgi)"
|
||||
else
|
||||
echo "Process not found by pgrep, but socket exists - this may be normal for FastCGI"
|
||||
echo "Checking socket..."
|
||||
if [ -S $REMOTE_SOCKET ]; then
|
||||
echo "FastCGI socket created successfully"
|
||||
ls -la $REMOTE_SOCKET
|
||||
echo "Checking if binary exists and is executable..."
|
||||
ls -la $REMOTE_BINARY_PATH
|
||||
echo "Testing if we can connect to the socket..."
|
||||
# Try to test the FastCGI connection
|
||||
if command -v cgi-fcgi >/dev/null 2>&1; then
|
||||
echo "Testing FastCGI connection..."
|
||||
SCRIPT_NAME=/health SCRIPT_FILENAME=$REMOTE_BINARY_PATH REQUEST_METHOD=GET cgi-fcgi -bind -connect $REMOTE_SOCKET 2>/dev/null | head -5 || echo "Connection test failed"
|
||||
else
|
||||
echo "cgi-fcgi not available for testing"
|
||||
fi
|
||||
# Don't exit - the socket existing means spawn-fcgi worked
|
||||
else
|
||||
echo "ERROR: Socket not created"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if process is running
|
||||
if pgrep -f ginxsom-fcgi > /dev/null; then
|
||||
echo "Process is running (PID: \$(pgrep -f ginxsom-fcgi))"
|
||||
else
|
||||
echo "WARNING: Process not found by pgrep (may be normal for FastCGI)"
|
||||
fi
|
||||
EOF
|
||||
|
||||
@@ -303,51 +251,84 @@ else
|
||||
print_error "Failed to start FastCGI process"
|
||||
exit 1
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Step 6: Test nginx configuration and reload
|
||||
print_status "Testing and reloading nginx..."
|
||||
|
||||
# Step 8: Test nginx configuration and reload
|
||||
print_status "Step 8: Testing and reloading nginx..."
|
||||
ssh $REMOTE_USER@$REMOTE_HOST << 'EOF'
|
||||
# Test nginx configuration
|
||||
if sudo nginx -t; then
|
||||
if sudo nginx -t 2>&1; then
|
||||
echo "Nginx configuration test passed"
|
||||
sudo nginx -s reload
|
||||
echo "Nginx reloaded successfully"
|
||||
else
|
||||
echo "Nginx configuration test failed"
|
||||
exit 1
|
||||
echo "WARNING: Nginx configuration test failed"
|
||||
echo "You may need to update nginx configuration manually"
|
||||
echo "See docs/STATIC_DEPLOYMENT_PLAN.md for details"
|
||||
fi
|
||||
EOF
|
||||
|
||||
print_success "Nginx reloaded"
|
||||
if [ $? -eq 0 ]; then
|
||||
print_success "Nginx reloaded"
|
||||
else
|
||||
print_warning "Nginx reload had issues - check configuration"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Step 7: Test deployment
|
||||
print_status "Testing deployment..."
|
||||
# Step 9: Test deployment
|
||||
print_status "Step 9: Testing deployment..."
|
||||
echo ""
|
||||
|
||||
# Wait a moment for service to fully start
|
||||
sleep 2
|
||||
|
||||
# Test health endpoint
|
||||
echo "Testing health endpoint..."
|
||||
if curl -k -s --max-time 10 "https://blossom.laantungir.net/health" | grep -q "OK"; then
|
||||
print_success "Health check passed"
|
||||
print_success "✓ Health check passed"
|
||||
else
|
||||
print_warning "Health check failed - checking response..."
|
||||
print_warning "✗ Health check failed - checking response..."
|
||||
curl -k -v --max-time 10 "https://blossom.laantungir.net/health" 2>&1 | head -10
|
||||
fi
|
||||
|
||||
# Test basic endpoints
|
||||
# Test root endpoint
|
||||
echo ""
|
||||
echo "Testing root endpoint..."
|
||||
if curl -k -s --max-time 10 "https://blossom.laantungir.net/" | grep -q "Ginxsom"; then
|
||||
print_success "Root endpoint responding"
|
||||
print_success "✓ Root endpoint responding"
|
||||
else
|
||||
print_warning "Root endpoint not responding as expected - checking response..."
|
||||
curl -k -v --max-time 10 "https://blossom.laantungir.net/" 2>&1 | head -10
|
||||
print_warning "✗ Root endpoint not responding as expected"
|
||||
fi
|
||||
|
||||
print_success "Deployment to $REMOTE_HOST completed!"
|
||||
print_status "Ginxsom should now be available at: https://blossom.laantungir.net"
|
||||
print_status "Test endpoints:"
|
||||
echo ""
|
||||
print_status "=========================================="
|
||||
print_success "Deployment completed!"
|
||||
print_status "=========================================="
|
||||
echo ""
|
||||
print_status "Service Information:"
|
||||
echo " URL: https://blossom.laantungir.net"
|
||||
echo " Binary: $REMOTE_BINARY_PATH"
|
||||
echo " Database: $REMOTE_DB_PATH"
|
||||
echo " Blobs: $REMOTE_BLOB_DIR"
|
||||
echo " Socket: $REMOTE_SOCKET"
|
||||
echo ""
|
||||
print_status "Test Commands:"
|
||||
echo " Health: curl -k https://blossom.laantungir.net/health"
|
||||
echo " Root: curl -k https://blossom.laantungir.net/"
|
||||
echo " List: curl -k https://blossom.laantungir.net/list"
|
||||
if [ "$FRESH_INSTALL" = "true" ]; then
|
||||
echo " Info: curl -k https://blossom.laantungir.net/"
|
||||
echo " Upload: ./tests/file_put_bud02.sh"
|
||||
echo ""
|
||||
print_status "Server Commands:"
|
||||
echo " Check status: ssh $REMOTE_USER@$REMOTE_HOST 'ps aux | grep ginxsom-fcgi'"
|
||||
echo " View logs: ssh $REMOTE_USER@$REMOTE_HOST 'sudo journalctl -f | grep ginxsom'"
|
||||
echo " Restart: ssh $REMOTE_USER@$REMOTE_HOST 'sudo pkill ginxsom-fcgi && sudo spawn-fcgi ...'"
|
||||
echo ""
|
||||
|
||||
if [ "$FRESH_INSTALL" = true ]; then
|
||||
print_warning "Fresh install completed - database and blobs have been reset"
|
||||
fi
|
||||
else
|
||||
print_status "Existing data preserved - verify database and blobs"
|
||||
echo " Check blobs: ssh $REMOTE_USER@$REMOTE_HOST 'ls -la $REMOTE_BLOB_DIR | wc -l'"
|
||||
echo " Check DB: ssh $REMOTE_USER@$REMOTE_HOST 'sudo -u www-data sqlite3 $REMOTE_DB_PATH \"SELECT COUNT(*) FROM blobs;\"'"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user