mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
PG upgrade procedure + test disk space
This commit is contained in:
parent
a9a89e8ba3
commit
ae368cb496
@ -1,5 +1,6 @@
|
||||
# Changelog Fab Manager
|
||||
|
||||
- Upgraded PostgreSQL from 9.4 to 11
|
||||
- Optional reCaptcha checkbox in sign-up form
|
||||
- Ability to configure and export the accounting data to the ACD accounting software
|
||||
- Compute the VAT per item in each invoices, instead of globally
|
||||
@ -14,6 +15,7 @@
|
||||
- Fix a bug: create a plan does not set its name
|
||||
- Fix a bug: unable to dissociate the last machine from a formation
|
||||
- Fix a security issue: fixed [CVE-2015-9284](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-9284)
|
||||
- [TODO DEPLOY] **IMPORTANT** Please read [postgres_upgrade.md](doc/postgres_upgrade.md) for instructions on upgrading PostgreSQL.
|
||||
- [TODO DEPLOY] `rake db:migrate`
|
||||
- [TODO DEPLOY] -> (only dev) `yarn install` and `bundle install`
|
||||
- [TODO DEPLOY] -> (only dev) configure `DEFAULT_HOST: 'localhost:5000'` and `DEFAULT_PROTOCOL: http` in [application.yml](config/application.yml.default)
|
||||
|
@ -10,7 +10,7 @@ We've wrote a script to automate the process while keeping your data integrity,
|
||||
Usually, `apt update && apt install curl jq sudo gawk`, ran as root, will do the trick but this may change, depending upon your system.
|
||||
- You'll need at least 4GB of RAM for the data migration to complete successfully.
|
||||
The script will try to add 4GB of swap memory if this requirement is detected as missing but this will consume you hard disk space (see below).
|
||||
- 1,17GB of free disk space are also required to perform the data migration.
|
||||
- 1,2GB of free disk space are also required to perform the data migration.
|
||||
Please ensure that you'll have enough space, considering the point above. The script won't run otherwise.
|
||||
- This script will run on any Linux or Macintoch systems if you installed ElasticSearch using docker or docker-compose.
|
||||
Otherwise, only Debian compatible OS (like Ubuntu) and MacOS X are supported for classical installations. On any other cases you'll need to perform the upgrade yourself manually.
|
||||
|
28
doc/postgres_upgrade.md
Normal file
28
doc/postgres_upgrade.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Instructions for upgrading PostgreSQL
|
||||
|
||||
## Automatic upgrade
|
||||
|
||||
Fab-manager release 4.2.0 has upgraded its dependency to PostgreSQL from version 9.4 to version 11 as the previous won't be maintained from from february 2020.
|
||||
To keep using fab-manager you need to upgrade your installation with the new version.
|
||||
We've wrote a script to automate the process while keeping your data integrity, but there's some requirements to understand before running it.
|
||||
|
||||
- You need to install *curl* and *GNU awk* on your system before running the script.
|
||||
Usually, `apt update && apt install curl gawk`, ran as root, will do the trick but this may change, depending upon your system.
|
||||
- A bit of free disk space is also required to perform the data migration.
|
||||
The amount needed depends on your current database size, the script will check it and tell you if there's not enough available space.
|
||||
- This script should run on any Linux or MacOS systems if you installed ElasticSearch using docker-compose.
|
||||
Otherwise, you must perform the upgrade yourself manually.
|
||||
|
||||
Once you've understood all the points above, you can run the migration script with the following:
|
||||
|
||||
```bash
|
||||
cd /apps/fabmanager
|
||||
# do not run as root, elevation will be prompted if needed
|
||||
\curl \sSL https://raw.githubusercontent.com/sleede/fab-manager/master/scripts/postgre-upgrade.sh | bash
|
||||
```
|
||||
|
||||
## Manual upgrade
|
||||
|
||||
For instructions regarding a manual upgrade, please refer to the official documentation:
|
||||
|
||||
- https://www.postgresql.org/docs/11/upgrading.html
|
@ -19,14 +19,6 @@ config()
|
||||
read -rp "Is fab-manager installed at \"$FM_PATH\"? (y/N) " confirm </dev/tty
|
||||
if [ "$confirm" = "y" ]
|
||||
then
|
||||
# checking disk space (minimum required = 1168323KB)
|
||||
space=$(df $FM_PATH | awk '/[0-9]%/{print $(NF-2)}')
|
||||
if [ "$space" -lt 1258291 ]
|
||||
then
|
||||
echo "Not enough free disk space to perform upgrade. Please free at least 1,2GB of disk space and try again"
|
||||
df -h $FM_PATH
|
||||
exit 7
|
||||
fi
|
||||
if [ -f "$FM_PATH/config/application.yml" ]
|
||||
then
|
||||
PG_HOST=$(cat "$FM_PATH/config/application.yml" | grep POSTGRES_HOST | awk '{print $2}')
|
||||
@ -50,6 +42,19 @@ config()
|
||||
fi
|
||||
}
|
||||
|
||||
test_free_space()
|
||||
{
|
||||
# checking disk space (minimum required = 1.2GB)
|
||||
required=$(du -d 0 "$PG_PATH" | awk '{ print $1 }')
|
||||
space=$(df $FM_PATH | awk '/[0-9]%/{print $(NF-2)}')
|
||||
if [ "$space" -lt "$required" ]
|
||||
then
|
||||
echo "Not enough free disk space to perform upgrade. Please free at least $required bytes of disk space and try again"
|
||||
df -h $FM_PATH
|
||||
exit 7
|
||||
fi
|
||||
}
|
||||
|
||||
test_docker_compose()
|
||||
{
|
||||
if [[ -f "$FM_PATH/docker-compose.yml" ]]
|
||||
@ -126,6 +131,7 @@ upgrade_postgres()
|
||||
OLD='9.4'
|
||||
NEW='11'
|
||||
read_path
|
||||
test_free_space
|
||||
prepare_path
|
||||
pg_upgrade
|
||||
upgrade_compose
|
||||
|
Loading…
x
Reference in New Issue
Block a user