1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-21 15:54:22 +01:00

[bug] script to mount payment-schedules volume results in invalid yml file

+ improved scripts for mounting volumes
+ increased verbosity of upgrade script
This commit is contained in:
Sylvain 2021-03-08 12:08:17 +01:00
parent 021c019ba4
commit 303c0a0ba8
4 changed files with 15 additions and 5 deletions

View File

@ -2,6 +2,9 @@
## Next release ## Next release
- Allow inserting hyperlinks in customized info messages - Allow inserting hyperlinks in customized info messages
- Improved scripts for mounting volumes
- Increased verbosity of upgrade script
- Fix a bug: mounting the payment-schedules volume in the docker-compose file results in an invalid file
## v4.7.3 2021 March 03 ## v4.7.3 2021 March 03
- Improved the setup script - Improved the setup script

View File

@ -18,9 +18,11 @@ config()
add_mount() add_mount()
{ {
# shellcheck disable=SC2016 if [[ ! $(yq eval ".services.$SERVICE.volumes.[] | select (. == \"*payment_schedules\")" docker-compose.yml) ]]; then
# we don't want to expand ${PWD} # shellcheck disable=SC2016
yq -i eval ".services.$SERVICE.volumes += [\"\${PWD}/payment_schedules:/usr/src/app/payment_schedules\"]" docker-compose.yml # we don't want to expand ${PWD}
yq -i eval ".services.$SERVICE.volumes += [\"\${PWD}/payment_schedules:/usr/src/app/payment_schedules\"]" docker-compose.yml
fi
} }
proceed() proceed()

View File

@ -18,8 +18,10 @@ config()
change_mount() change_mount()
{ {
yq -i eval ".services.$SERVICE.volumes.[] | select(. == \"*assets\") |= \"\${PWD}/public/packs:/usr/src/app/public/packs\"" docker-compose.yml if [[ $(yq eval ".services.$SERVICE.volumes.[] | select (. == \"*assets\")" docker-compose.yml) ]]; then
echo "Service volume was replaced for $SERVICE: /assets changed to /packs" yq -i eval ".services.$SERVICE.volumes.[] |= select(. == \"*assets\") |= \"\${PWD}/public/packs:/usr/src/app/public/packs\"" docker-compose.yml
echo "Service volume was replaced for $SERVICE: /assets changed to /packs"
fi
} }
proceed() proceed()

View File

@ -87,6 +87,7 @@ add_environments()
{ {
for ENV in "${ENVIRONMENTS[@]}"; do for ENV in "${ENVIRONMENTS[@]}"; do
if [[ "$ENV" =~ ^[A-Z0-9_]+=.*$ ]]; then if [[ "$ENV" =~ ^[A-Z0-9_]+=.*$ ]]; then
printf "Inserting variable %s...\n" "$ENV"
printf "# added on %s\n%s\n" "$(date +%Y-%m-%d\ %R)" "$ENV" >> "config/env" printf "# added on %s\n%s\n" "$(date +%Y-%m-%d\ %R)" "$ENV" >> "config/env"
else else
echo "Ignoring invalid option: -e $ENV. Given value is not valid environment variable, please see https://huit.re/environment-doc" echo "Ignoring invalid option: -e $ENV. Given value is not valid environment variable, please see https://huit.re/environment-doc"
@ -125,6 +126,7 @@ upgrade()
BRANCH='master' BRANCH='master'
if yq eval '.services.*.image | select(. == "sleede/fab-manager*")' docker-compose.yml | grep -q ':dev'; then BRANCH='dev'; fi if yq eval '.services.*.image | select(. == "sleede/fab-manager*")' docker-compose.yml | grep -q ':dev'; then BRANCH='dev'; fi
for SCRIPT in "${SCRIPTS[@]}"; do for SCRIPT in "${SCRIPTS[@]}"; do
printf "Running script %s from branch %s...\n" "$SCRIPT" "$BRANCH"
if [[ "$YES_ALL" = "true" ]]; then if [[ "$YES_ALL" = "true" ]]; then
\curl -sSL "https://raw.githubusercontent.com/sleede/fab-manager/$BRANCH/scripts/$SCRIPT.sh" | bash -s -- -y \curl -sSL "https://raw.githubusercontent.com/sleede/fab-manager/$BRANCH/scripts/$SCRIPT.sh" | bash -s -- -y
else else
@ -134,6 +136,7 @@ upgrade()
compile_assets compile_assets
docker-compose run --rm "$SERVICE" bundle exec rake db:migrate docker-compose run --rm "$SERVICE" bundle exec rake db:migrate
for COMMAND in "${COMMANDS[@]}"; do for COMMAND in "${COMMANDS[@]}"; do
printf "Running command %s...\n" "$COMMAND"
docker-compose run --rm "$SERVICE" bundle exec "$COMMAND" docker-compose run --rm "$SERVICE" bundle exec "$COMMAND"
done done
docker-compose up -d docker-compose up -d