Skip to content
Merged

EspoCRM #2347

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(espocrm): add install script (MariaDB, PHP 8.4-FPM, nginx, cron)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
  • Loading branch information
Masked-Kunsiquat and claude committed Oct 3, 2026
commit 252a3bde18bad09b6f4d3e183db5122181995eab
136 changes: 136 additions & 0 deletions install/espocrm-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/usr/bin/env bash

# Copyright (c) 2021-2026 community-scripts ORG
# Author: Masked-Kunsiquat
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://www.espocrm.com/ | Github: https://github.com/espocrm/espocrm

source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os

if [[ -z "${var_admin_user:-}" ]]; then
var_admin_user=$(prompt_input "EspoCRM admin username:" "admin" 60)
fi
var_admin_user="${var_admin_user:-admin}"
if [[ -z "${var_admin_pass:-}" ]]; then
var_admin_pass=$(random_password 16)
fi

msg_info "Installing Dependencies"
$STD apt install -y \
cron \
Comment thread
CrazyWolf13 marked this conversation as resolved.
Outdated
nginx
msg_ok "Installed Dependencies"

setup_mariadb
MARIADB_DB_NAME="espocrm" MARIADB_DB_USER="espocrm" setup_mariadb_db
PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="ldap" setup_php
fetch_and_deploy_gh_release "espocrm" "espocrm/espocrm" "prebuild" "latest" "/opt/espocrm" "EspoCRM-*.zip"

msg_info "Configuring EspoCRM"
cd /opt/espocrm
$STD php bin/command config:populate
$STD php bin/command config:set defaultPermissions.user www-data
$STD php bin/command config:set defaultPermissions.group www-data
$STD php bin/command config:set database.platform Mysql
$STD php bin/command config:set database.host localhost
$STD php bin/command config:set database.dbname "$MARIADB_DB_NAME"
$STD php bin/command config:set database.user "$MARIADB_DB_USER"
$STD php bin/command config:set database.password "$MARIADB_DB_PASS"
$STD php bin/command rebuild
$STD php bin/command create-admin-user "$var_admin_user"
# set-password only reads from stdin; stty fails harmlessly without a TTY.
Comment thread
CrazyWolf13 marked this conversation as resolved.
Outdated
printf '%s\n' "$var_admin_pass" | $STD php bin/command set-password "$var_admin_user"
$STD php bin/command config:set siteUrl "http://${LOCAL_IP}"
$STD php bin/command populate-scheduled-jobs
$STD php bin/command config:set jobRunInParallel true --type=bool
$STD php bin/command app-check
$STD php bin/command config:set isInstalled true --type=bool
chown -R www-data:www-data /opt/espocrm
msg_ok "Configured EspoCRM"

msg_info "Creating Nginx Site"
PHP_SOCK=$(get_php_fpm_socket)
cat <<EOF >/etc/nginx/sites-available/espocrm
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;

charset utf-8;
index index.html index.php;

client_max_body_size 128M;
keepalive_timeout 300;
server_tokens off;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;

gzip on;
gzip_types text/plain text/css text/javascript application/javascript application/json;
gzip_min_length 1000;

root /opt/espocrm/public;

location /client {
root /opt/espocrm;
autoindex off;

location ~* ^.+\.(js|css|png|jpg|svg|svgz|jpeg|gif|ico|tpl)\$ {
access_log off;
expires max;
}
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

location ~ \.php\$ {
fastcgi_pass unix:${PHP_SOCK};
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
fastcgi_param QUERY_STRING \$query_string;
}

location /api/v1/ {
if (!-e \$request_filename) {
rewrite ^/api/v1/(.*)\$ /api/v1/index.php last;
}
}

location /portal/ {
try_files \$uri \$uri/ /portal/index.php?\$query_string;
}

location /api/v1/portal-access {
if (!-e \$request_filename) {
rewrite ^/api/v1/(.*)\$ /api/v1/portal-access/index.php last;
}
}

location ~ /(\.htaccess|\.git) {
deny all;
}
}
EOF
msg_ok "Created Nginx Site"
nginx_enable_site "espocrm"

msg_info "Setting up Cron"
cat <<EOF >/etc/cron.d/espocrm
* * * * * www-data cd /opt/espocrm && php -f cron.php >/dev/null 2>&1
EOF
systemctl enable -q --now cron
msg_ok "Set up Cron"

echo -e "${INFO}${YW}EspoCRM admin login:${CL} ${BGN}${var_admin_user}${CL} / ${BGN}${var_admin_pass}${CL}"

motd_ssh
customize
cleanup_lxc