initial COM2 system snapshot
This commit is contained in:
134
repos/hxki-inventory/chaos/install_mautic.sh
Executable file
134
repos/hxki-inventory/chaos/install_mautic.sh
Executable file
@@ -0,0 +1,134 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "============================================"
|
||||
echo " MAUTIC INSTALLER – FERRARI EDITION "
|
||||
echo "============================================"
|
||||
|
||||
###############################################
|
||||
# 1) Update System
|
||||
###############################################
|
||||
apt update && apt upgrade -y
|
||||
|
||||
###############################################
|
||||
# 2) Install Required Packages
|
||||
###############################################
|
||||
apt install -y software-properties-common gnupg2 unzip curl supervisor
|
||||
|
||||
###############################################
|
||||
# 3) Install PHP 8.2 + Extensions
|
||||
###############################################
|
||||
add-apt-repository ppa:ondrej/php -y
|
||||
apt update
|
||||
|
||||
apt install -y \
|
||||
php8.2 php8.2-cli php8.2-fpm php8.2-common \
|
||||
php8.2-mysql php8.2-xml php8.2-zip php8.2-mbstring php8.2-curl \
|
||||
php8.2-intl php8.2-gd php8.2-imap php8.2-bcmath php8.2-opcache
|
||||
|
||||
###############################################
|
||||
# 4) MariaDB installieren
|
||||
###############################################
|
||||
apt install -y mariadb-server mariadb-client
|
||||
|
||||
###############################################
|
||||
# 5) MariaDB initial konfigurieren
|
||||
###############################################
|
||||
mysql -e "CREATE DATABASE mautic CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
|
||||
mysql -e "CREATE USER 'mautic'@'localhost' IDENTIFIED BY 'Mautic123!';"
|
||||
mysql -e "GRANT ALL PRIVILEGES ON mautic.* TO 'mautic'@'localhost';"
|
||||
mysql -e "FLUSH PRIVILEGES;"
|
||||
|
||||
###############################################
|
||||
# 6) Nginx installieren
|
||||
###############################################
|
||||
apt install -y nginx
|
||||
|
||||
###############################################
|
||||
# 7) Mautic herunterladen
|
||||
###############################################
|
||||
cd /var/www
|
||||
curl -L https://github.com/mautic/mautic/releases/latest/download/mautic.zip -o mautic.zip
|
||||
unzip mautic.zip -d mautic
|
||||
rm mautic.zip
|
||||
|
||||
###############################################
|
||||
# 8) Berechtigungen setzen
|
||||
###############################################
|
||||
chown -R www-data:www-data /var/www/mautic
|
||||
chmod -R 755 /var/www/mautic
|
||||
|
||||
###############################################
|
||||
# 9) Nginx Virtual Host anlegen
|
||||
###############################################
|
||||
cat <<'EOF' >/etc/nginx/sites-available/mautic.conf
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /var/www/mautic;
|
||||
|
||||
index index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.php?$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
|
||||
expires max;
|
||||
log_not_found off;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
ln -sf /etc/nginx/sites-available/mautic.conf /etc/nginx/sites-enabled/mautic.conf
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
nginx -t && systemctl restart nginx
|
||||
|
||||
###############################################
|
||||
# 10) Supervisor – Mautic Queue Worker
|
||||
###############################################
|
||||
cat <<'EOF' >/etc/supervisor/conf.d/mautic-worker.conf
|
||||
[program:mautic-worker]
|
||||
command=/usr/bin/php /var/www/mautic/bin/console mautic:messages:consume
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=www-data
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/var/log/supervisor/mautic-worker.log
|
||||
EOF
|
||||
|
||||
supervisorctl reread
|
||||
supervisorctl update
|
||||
|
||||
###############################################
|
||||
# 11) PHP Tuning
|
||||
###############################################
|
||||
sed -i "s/memory_limit = .*/memory_limit = 1024M/" /etc/php/8.2/fpm/php.ini
|
||||
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 64M/" /etc/php/8.2/fpm/php.ini
|
||||
sed -i "s/post_max_size = .*/post_max_size = 64M/" /etc/php/8.2/fpm/php.ini
|
||||
|
||||
systemctl restart php8.2-fpm
|
||||
|
||||
###############################################
|
||||
# 12) CRONJOBS hinzufügen
|
||||
###############################################
|
||||
cat <<'EOF' >/etc/cron.d/mautic
|
||||
* * * * * www-data php /var/www/mautic/bin/console mautic:segments:update > /dev/null 2>&1
|
||||
* * * * * www-data php /var/www/mautic/bin/console mautic:campaigns:trigger > /dev/null 2>&1
|
||||
*/5 * * * * www-data php /var/www/mautic/bin/console mautic:emails:send > /dev/null 2>&1
|
||||
EOF
|
||||
|
||||
###############################################
|
||||
# READY
|
||||
###############################################
|
||||
echo ""
|
||||
echo "============================================"
|
||||
echo " MAUTIC INSTALLATION FERTIG – FERRARI STYLE"
|
||||
echo " URL: http://<dein-server>:80"
|
||||
echo "============================================"
|
||||
Reference in New Issue
Block a user