<commit_before>#!/usr/bin/env bash

export GEOTREK_VERSION=$(docker-compose run web cat VERSION | tr -d '\r')
echo $GEOTREK_VERSION
source .env

sudo systemctl stop geotrek

export PGPASSWORD=$(echo $POSTGRES_PASSWORD)
docker-compose run web bash -c "PGPASSWORD=$POSTGRES_PASSWORD pg_dump -Fc --no-acl --no-owner -h postgres -w -U $POSTGRES_USER $POSTGRES_DB > /app/src/var/geotrek_$GEOTREK_VERSION.dump"

docker pull geotrekce/admin:latest
docker tag geotrekce/admin:latest geotrekce/admin:$GEOTREK_VERSION

if ! docker-compose run web update.sh; then
    docker rmi geotrekce/admin:latest
    docker tag geotrekce/admin:$GEOTREK_VERSION geotrekce/admin:latest
    docker-compose run web bash -c "PGPASSWORD=$POSTGRES_PASSWORD pg_restore -c -Fc --no-owner -h postgres -w -U $POSTGRES_USER --dbname=$POSTGRES_DB /app/src/var/geotrek_$GEOTREK_VERSION.dump"
fi

sudo systemctl start geotrek<commit_msg>fix software upgrade integration<commit_after>#!/usr/bin/env bash

export GEOTREK_VERSION=$(docker-compose run web cat VERSION | tr -d '\r')
echo $GEOTREK_VERSION
source .env

echo "stopping geotrek service"
sudo systemctl stop geotrek

echo "backup your database"
export PGPASSWORD=$(echo $POSTGRES_PASSWORD)
docker-compose run web bash -c "PGPASSWORD=$POSTGRES_PASSWORD pg_dump -Fc --no-acl --no-owner -h postgres -w -U $POSTGRES_USER $POSTGRES_DB > /app/src/var/geotrek_$GEOTREK_VERSION.dump"

echo "pulling new geotrek docker image"
docker pull geotrekce/admin:latest
docker tag geotrekce/admin:latest geotrekce/admin:$GEOTREK_VERSION

if ! docker-compose run web update.sh; then
    echo "an error occured. try to restore old configuration and version"
    docker rmi geotrekce/admin:latest
    docker tag geotrekce/admin:$GEOTREK_VERSION geotrekce/admin:latest
    docker-compose run web bash -c "PGPASSWORD=$POSTGRES_PASSWORD pg_restore -c -Fc --no-owner -h postgres -w -U $POSTGRES_USER --dbname=$POSTGRES_DB /app/src/var/geotrek_$GEOTREK_VERSION.dump"
    echo "restore is ok. Please run docker-compose run web update.sh in order to make available again"
fi

sudo systemctl start geotrek
{'fraction_non_alphanumeric': 0.09541984732824428, 'fraction_numerical': 0.0, 'mean_word_length': 4.873949579831932, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5678570', 'n_tokens_mistral': 784, 'n_tokens_neox': 745, 'n_words': 205}