68 lines
2.0 KiB
Bash
Executable File
68 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
###############################################
|
|
# Intaleq V2 — Server Setup Script (CloudPanel Optimized)
|
|
###############################################
|
|
|
|
set -e
|
|
|
|
# Colors for output
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${GREEN}=== Intaleq V2 Setup ===${NC}"
|
|
|
|
# 1. Detect User
|
|
CURRENT_USER=$(whoami)
|
|
echo -e "Detected user: ${YELLOW}$CURRENT_USER${NC}"
|
|
|
|
# 2. Install dependencies
|
|
echo -e "[1/6] ${GREEN}Installing Composer dependencies...${NC}"
|
|
composer install --no-dev --optimize-autoloader
|
|
|
|
# 3. Copy environment file
|
|
if [ ! -f .env ]; then
|
|
echo -e "[2/6] ${YELLOW}Creating .env from template...${NC}"
|
|
cp .env.example .env
|
|
echo -e "${RED}⚠️ IMPORTANT: Edit .env with your actual credentials!${NC}"
|
|
else
|
|
echo -e "[2/6] .env already exists, skipping..."
|
|
fi
|
|
|
|
# 4. Generate app key
|
|
echo -e "[3/6] ${GREEN}Generating application key...${NC}"
|
|
php artisan key:generate
|
|
|
|
# 5. Cache config for performance
|
|
echo -e "[4/6] ${GREEN}Caching configuration...${NC}"
|
|
php artisan config:cache
|
|
php artisan route:cache
|
|
php artisan view:cache
|
|
|
|
# 6. Set permissions
|
|
echo -e "[5/6] ${GREEN}Setting permissions...${NC}"
|
|
# For CloudPanel, the web user is usually the SSH user
|
|
chmod -R 775 storage bootstrap/cache
|
|
# Attempt to set ownership if running as root or sudo
|
|
if [ "$EUID" -eq 0 ]; then
|
|
chown -R www-data:www-data storage bootstrap/cache
|
|
else
|
|
echo -e "${YELLOW}Skipping chown as non-root user. Ensure storage is writable.${NC}"
|
|
fi
|
|
|
|
# 7. Run migrations
|
|
echo -e "[6/6] ${GREEN}Running database migrations...${NC}"
|
|
# Use --force for production
|
|
php artisan migrate --force
|
|
|
|
echo ""
|
|
echo -e "${GREEN}=== Setup Complete ===${NC}"
|
|
echo ""
|
|
echo "Next steps for CloudPanel:"
|
|
echo "1. In CloudPanel, set the 'Root Directory' to: ${YELLOW}/public${NC}"
|
|
echo "2. Update the VHost Nginx configuration (see nginx-vhost.conf)"
|
|
echo "3. Ensure PHP version is 8.2 or 8.3"
|
|
echo "4. Test: curl https://your-domain/v2/auth/passenger/login"
|