Skip to content

Commit

Permalink
Update Forge deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
screenfluent committed Nov 17, 2024
1 parent 7ef0e8d commit 1f0bf61
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 51 deletions.
33 changes: 8 additions & 25 deletions forge/deploy.production.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
cd /home/llmstxtdirectory/llmstxt.directory

# Exit on error
set -e

echo "🚀 Starting production deployment..."

# Pull the latest changes from the git repository
echo "📥 Pulling latest changes..."
git pull origin $FORGE_SITE_BRANCH

# Install/update composer dependencies
echo "📦 Installing dependencies..."
chown -R llmstxtdirectory:llmstxtdirectory .
chmod -R 775 .
git config --global --add safe.directory /home/llmstxtdirectory/llmstxt.directory
git fetch origin $FORGE_SITE_BRANCH
git reset --hard origin/$FORGE_SITE_BRANCH
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader --no-dev

# Create necessary directories
echo "📁 Setting up directories..."
mkdir -p storage/logs
mkdir -p public/logos

# Set permissions
echo "🔒 Setting permissions..."
chmod -R 775 storage
chmod -R 775 public/logos
chmod -R 775 db
chmod 775 .

# Ensure database exists
echo "🗄️ Checking database..."
if [ ! -f "db/votes.db" ]; then
echo "⚠️ Database not found, initializing..."
php db/init.php
chmod 664 db/votes.db
fi

# Clear caches
echo "🧹 Clearing caches..."
php -r "if(function_exists('opcache_reset')) { opcache_reset(); }"

echo "🔄 Restarting PHP..."
( flock -w 10 9 || exit 1
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock
echo "✅ Deployment complete!"
35 changes: 9 additions & 26 deletions forge/deploy.staging.sh
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
cd /home/stagingllmstxtdirectory/staging.llmstxt.directory

# Exit on error
set -e

echo "🚀 Starting staging deployment..."

# Pull the latest changes from the git repository
echo "📥 Pulling latest changes..."
git pull origin $FORGE_SITE_BRANCH

# Install/update composer dependencies
echo "📦 Installing dependencies..."
chown -R stagingllmstxtdirectory:stagingllmstxtdirectory .
chmod -R 775 .
git config --global --add safe.directory /home/stagingllmstxtdirectory/staging.llmstxt.directory
git fetch origin $FORGE_SITE_BRANCH
git reset --hard origin/$FORGE_SITE_BRANCH
$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader

# Create necessary directories
echo "📁 Setting up directories..."
mkdir -p storage/logs
mkdir -p public/logos

# Set permissions
echo "🔒 Setting permissions..."
chmod -R 775 storage
chmod -R 775 public/logos
chmod -R 775 db
chmod 775 .

# Ensure database exists
echo "🗄️ Checking database..."
if [ ! -f "db/votes.db" ]; then
echo "⚠️ Database not found, initializing..."
php db/init.php
chmod 664 db/votes.db
fi

# Clear caches
echo "🧹 Clearing caches..."
php -r "if(function_exists('opcache_reset')) { opcache_reset(); }"

echo "✅ Staging deployment complete!"
echo "🔄 Restarting PHP..."
( flock -w 10 9 || exit 1
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock
echo "✅ Deployment complete!"

0 comments on commit 1f0bf61

Please sign in to comment.