-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathinit.sh
More file actions
39 lines (31 loc) · 1.26 KB
/
init.sh
File metadata and controls
39 lines (31 loc) · 1.26 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
#!/bin/bash
set -e
echo "=== Pimcore Initialization ==="
# Check if Pimcore is already installed
if [ -f /var/www/html/.installed ]; then
echo "Pimcore already initialized, skipping..."
exit 0
fi
cd /var/www/html
# Install Pimcore skeleton if composer.json is missing
if [ ! -f /var/www/html/composer.json ]; then
echo "Creating Pimcore project via composer..."
composer create-project pimcore/skeleton /tmp/pimcore-install --no-interaction
cp -rf /tmp/pimcore-install/. /var/www/html/
rm -rf /tmp/pimcore-install
fi
# Install Pimcore (creates database tables and admin user)
echo "Running pimcore-install..."
php vendor/bin/pimcore-install \
--admin-username="${W9_LOGIN_USER}" \
--admin-password="${W9_LOGIN_PASSWORD}" \
--mysql-host-socket="${PIMCORE_DB_HOST}" \
--mysql-username="${PIMCORE_DB_USER}" \
--mysql-password="${PIMCORE_DB_PASSWORD}" \
--mysql-database="${PIMCORE_DB_NAME}" \
--no-interaction
# Fix file permissions for web server
chown -R www-data:www-data /var/www/html/var /var/www/html/public 2>/dev/null || echo "Warning: Could not set permissions on var/public directories (non-fatal)"
# Mark as installed to skip on subsequent startups
touch /var/www/html/.installed
echo "=== Pimcore Initialization Complete ==="