Skip to content

feat: add option to install a specific EspoCRM version #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ wget https://github.com/espocrm/espocrm-installer/releases/latest/download/insta
sudo bash install.sh -y --ssl --letsencrypt --domain=my-espocrm.com --email=email@my-domain.com
```

You can also specify a particular EspoCRM version to install:

```
sudo bash install.sh --version=8.4.2
```

If no version is specified, the latest version will be installed.

## Run (only for development)

```
Expand Down
22 changes: 22 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ declare -A data=(
[homeDirectory]="/var/www/espocrm"
[action]="main"
[backupPath]="SCRIPT_DIRECTORY/espocrm-backup"
[version]="fpm"
)

declare -A modes=(
Expand Down Expand Up @@ -112,6 +113,10 @@ function handleArguments() {
data[email]="${value}"
;;

--version)
data[version]="${value}"
;;

--db-root-password | --dbRootPassword)
data[dbRootPassword]="${value}"
;;
Expand Down Expand Up @@ -827,6 +832,9 @@ function prepareDocker() {
mv "./installation-modes/$mode/${data[server]}/docker-compose.yml" "${data[homeDirectory]}/docker-compose.yml"
mv "./installation-modes/$mode/${data[server]}"/* "${data[homeDirectory]}/data/${data[server]}"

# Update EspoCRM version in docker-compose.yml
updateEspoCrmVersion

# Copy helper commands
find "./commands" -type f | while read file; do
fileName=$(basename "$file")
Expand All @@ -842,6 +850,20 @@ function prepareDocker() {
fi
}

function updateEspoCrmVersion() {
local dockerComposeFile="${data[homeDirectory]}/docker-compose.yml"
if [ -f "$dockerComposeFile" ]; then
# If version is "fpm" (default), use it as is
# Otherwise append "-fpm" to the version number
if [ "${data[version]}" = "fpm" ]; then
local imageVersion="fpm"
else
local imageVersion="${data[version]}-fpm"
fi
sed -i "s|espocrm/espocrm:fpm|espocrm/espocrm:${imageVersion}|g" "$dockerComposeFile"
fi
}

runDockerDatabase() {
docker compose -f "${data[homeDirectory]}/docker-compose.yml" up -d espocrm-db || {
restoreBackup
Expand Down