-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-drupal.sh
More file actions
65 lines (50 loc) · 1.57 KB
/
setup-drupal.sh
File metadata and controls
65 lines (50 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
echo "📦 Setting up Drupal from RSVP Composer project..."
DRUPAL_DIR="/var/www/html/gluebox"
COMPOSER_REPO="https://github.com/slackstone/rsvp_composer.git"
if [ ! -d "$DRUPAL_DIR" ]; then
echo "📁 Cloning RSVP Composer project..."
git clone "$COMPOSER_REPO" "$DRUPAL_DIR"
else
echo "📥 Updating existing Drupal project..."
cd "$DRUPAL_DIR" || exit 1
# Ensure safe Git usage
git config --global --add safe.directory "$DRUPAL_DIR"
git config --global --add safe.directory /var/www/html
# Pull latest changes
git pull origin main
echo "📥 Updating existing Drupal project..."
cd "$DRUPAL_DIR" || exit 1
git config --global --add safe.directory "$DRUPAL_DIR"
git fetch origin
git reset --hard origin/main
git clean -fd
fi
cd "$DRUPAL_DIR" || exit 1
echo "📦 Running composer install..."
COMPOSER_ALLOW_SUPERUSER=1 composer install
# Set permissions
echo "🔧 Fixing permissions..."
chown -R www-data:www-data "$DRUPAL_DIR"
chmod -R 755 "$DRUPAL_DIR"
# Apache setup
echo "🔄 Enabling Apache rewrite module..."
a2enmod rewrite || true
VHOST="/etc/apache2/sites-available/gluebox.conf"
if [ ! -f "$VHOST" ]; then
echo "📝 Creating Apache vhost..."
cat <<EOF > "$VHOST"
<VirtualHost *:80>
DocumentRoot $DRUPAL_DIR/web
<Directory $DRUPAL_DIR/web>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
EOF
a2ensite gluebox.conf
a2dissite 000-default.conf
fi
echo "🔁 Restarting Apache..."
service apache2 restart || echo "⚠️ Apache restart failed (OK in Cubic chroot)"
echo "✅ Drupal is now ready at: http://localhost"