1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

Merge branch 'dev' for release 4.2.2

This commit is contained in:
Sylvain 2019-10-22 12:52:02 +02:00
commit c28d75f59e
3 changed files with 45 additions and 30 deletions

View File

@ -1,5 +1,9 @@
# Changelog Fab Manager
## v4.2.2 2019 October 22
- Fix a bug: PostgreSQL upgrade script won't run on some systems
## v4.2.1 2019 October 21
- Updated axlsx gem to caxlsx 3.0
@ -34,16 +38,16 @@
- Fix a bug: unauthorized user can see the edit project form
- Fix a bug: do not display each days in invoices for multiple days event reservation
- 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)
- [TODO DEPLOY] add the `RECAPTCHA_SITE_KEY` and `RECAPTCHA_SECRET_KEY` environment variables (see [doc/environment.md](doc/environment.md) for configuration details)
- [TODO DEPLOY] add the `MAX_CAO_SIZE` environment variable (see [doc/environment.md](doc/environment.md) for configuration details)
- [TODO DEPLOY] add the `MAX_IMPORT_SIZE` environment variable (see [doc/environment.md](doc/environment.md) for configuration details)
- [TODO DEPLOY] `rake db:migrate`
- [TODO DEPLOY] add `- ${PWD}/imports:/usr/src/app/imports` in the volumes list of your fabmanager service in [docker-compose.yml](docker/docker-compose.yml)
- [TODO DEPLOY] add the `FABLAB_WITHOUT_INVOICES` environment variable (see [doc/environment.md](doc/environment.md) for configuration details)
- [TODO DEPLOY] add the following `SMTP_TLS` environment variables (see [doc/environment.md](doc/environment.md) for configuration details)
- [TODO DEPLOY] add the `RECAPTCHA_SITE_KEY` and `RECAPTCHA_SECRET_KEY` environment variables (see [doc/environment.md](doc/environment.md#RECAPTCHA_SITE_KEY) for configuration details)
- [TODO DEPLOY] add the `MAX_CAO_SIZE` environment variable (see [doc/environment.md](doc/environment.md#MAX_CAO_SIZE) for configuration details)
- [TODO DEPLOY] add the `MAX_IMPORT_SIZE` environment variable (see [doc/environment.md](doc/environment.md#MAX_IMPORT_SIZE) for configuration details)
- [TODO DEPLOY] add the `FABLAB_WITHOUT_INVOICES` environment variable (see [doc/environment.md](doc/environment.md#FABLAB_WITHOUT_INVOICES) for configuration details)
- [TODO DEPLOY] add the `SMTP_TLS` environment variable (see [doc/environment.md](doc/environment.md#SMTP_TLS) for configuration details)
- [TODO DEPLOY] **IMPORTANT** Please read [postgres_upgrade.md](doc/postgres_upgrade.md) for instructions on upgrading PostgreSQL.
## v4.1.1 2019 September 20

View File

@ -1,6 +1,6 @@
{
"name": "fab-manager",
"version": "4.2.1",
"version": "4.2.2",
"description": "FabManager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [
"fablab",

55
scripts/postgre-upgrade.sh Normal file → Executable file
View File

@ -35,19 +35,7 @@ config()
FM_PATH=$(pwd)
TYPE="NOT-FOUND"
read -rp "Is fab-manager installed at \"$FM_PATH\"? (y/N) " confirm </dev/tty
if [ "$confirm" = "y" ]
then
if [ -f "$FM_PATH/config/application.yml" ]
then
PG_HOST=$(cat "$FM_PATH/config/application.yml" | grep POSTGRES_HOST | awk '{print $2}')
elif [ -f "$FM_PATH/config/env" ]
then
PG_HOST=$(cat "$FM_PATH/config/env" | grep POSTGRES_HOST | awk '{split($0,a,"="); print a[2]}')
else
echo "Fab-manager's environment file not found, please run this script from the installation folder"
exit 1
fi
PG_IP=$(getent ahostsv4 "$PG_HOST" | awk '{ print $1 }' | uniq)
if [ "$confirm" = "y" ]; then
test_docker_compose
if [[ "$TYPE" = "NOT-FOUND" ]]
then
@ -64,11 +52,11 @@ 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)}')
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
df -h "$FM_PATH"
exit 7
fi
}
@ -81,8 +69,6 @@ test_docker_compose()
if [[ $? = 0 ]]
then
TYPE="DOCKER-COMPOSE"
local container_id=$(docker-compose ps | grep postgre | awk '{print $1}')
PG_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$container_id")
fi
fi
}
@ -90,7 +76,8 @@ test_docker_compose()
read_path()
{
PG_PATH=$(awk "BEGIN { FS=\"\n\"; RS=\"\"; } { match(\$0, /image: postgres:$OLD(\n|.)+volumes:(\n|.)+(-.*postgresql\/data)/, lines); FS=\"[ :]+\"; RS=\"\r\n\"; split(lines[3], line); print line[2] }" "$FM_PATH/docker-compose.yml")
PG_PATH="${PG_PATH/\$\{PWD\}/$(pwd)}"
PG_PATH="${PG_PATH/\$\{PWD\}/$FM_PATH}"
PG_PATH="${PG_PATH/\./$FM_PATH}"
PG_PATH="${PG_PATH/[[:space:]]/}"
}
@ -110,10 +97,32 @@ prepare_path()
docker_down()
{
docker-compose down
ensure_pg_down
}
ensure_pg_down()
{
if [ -f "$PG_PATH/postmaster.pid" ]; then
echo 'ERROR: lock file "postmaster.pid" exists'
docker-compose ps | grep postgres
if [[ $? = 1 ]]; then
read -rp 'docker-compose container is not running. Confirm delete the lock file? (y/N) ' confirm </dev/tty
if [ "$confirm" = "y" ]; then
if [ "$(whoami)" = "root" ]; then COMMAND="rm"
else COMMAND="sudo rm"; fi
"$COMMAND" -f "$PG_PATH/postmaster.pid"
fi
else
echo 'docker-compose container is still running, retrying to stop...'
sleep 2
docker_down
fi
fi
}
pg_upgrade()
{
echo "docker run --rm -v $PG_PATH:/var/lib/postgresql/$OLD/data -v $NEW_PATH:/var/lib/postgresql/$NEW/data tianon/postgres-upgrade:$OLD-to-$NEW"
docker run --rm \
-v "$PG_PATH:/var/lib/postgresql/$OLD/data" \
-v "$NEW_PATH:/var/lib/postgresql/$NEW/data" \
@ -148,10 +157,12 @@ docker_up()
clean()
{
read -rp "Remove the previous PostgreSQL data folder? (y/N) " confirm </dev/tty
if [[ "$confirm" = "y" ]]
then
echo "Deleting $PG_PATH..."
rm -rf "$PG_PATH"
if [[ "$confirm" = "y" ]]; then
read -rp "WARNING: This cannot be undone! If something went wrong during the upgrade, you'll lost all your data. Are you really sure? (y/N) " confirm </dev/tty
if [[ "$confirm" = "y" ]]; then
echo "Deleting $PG_PATH..."
rm -rf "$PG_PATH"
fi
fi
}