Skip to content

Commit

Permalink
adjust templates to GNU gettext envsubst
Browse files Browse the repository at this point in the history
  • Loading branch information
yardenasadosa committed Apr 5, 2024
1 parent 8228baa commit ddd8320
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
24 changes: 12 additions & 12 deletions pre_install_gh.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,38 @@ S3_BUCKET="$S3_BUCKET_ENVSUBST"

set -e

echo "RC_DIR: $$RC_DIR"
echo "RC_FILE: $$RC_FILE"
echo "S3_BUCKET: $$S3_BUCKET"
echo "RC_DIR: $RC_DIR"
echo "RC_FILE: $RC_FILE"
echo "S3_BUCKET: $S3_BUCKET"

# Clean old RC dirs and create new
prepare_directories () {
echo "Removing previous release's directories..."
ls
sudo rm -rf $$RC_DIR-{new,old}
sudo mkdir -p $$RC_DIR-new
sudo rm -rf $RC_DIR-{new,old}
sudo mkdir -p $RC_DIR-new
}

# Download given RocketChat build
build_rc () {
local s3_path
s3_path="s3://$$S3_BUCKET/$$RC_FILE"
s3_path="s3://$S3_BUCKET/$RC_FILE"
tmprcdir=$(mktemp -d)
cd $$tmprcdir
cd $tmprcdir
echo "Downloading Rocket.Chat installation files.."
$$AWS s3 cp --quiet "$$s3_path" .
$AWS s3 cp --quiet "$s3_path" .
echo "Unpacking Rocket.Chat files..."
tar zxf "$$RC_FILE"
rm -f "$$RC_FILE"
tar zxf "$RC_FILE"
rm -f "$RC_FILE"
echo "Installing modules..."
# loglevels (high to low): error, warn, notice, http, timing, info, verbose, silly
# default = notice
# To disable logging, set loglevel to `silent`
# However, even with `silent` the "package_name@version install_folder" lines are still shown
npm_config_loglevel=warn npm install --production --prefix ./bundle/programs/server
echo "Copying to the new location..."
sudo mv ./bundle $$RC_DIR-new/
rm -rf $$tmprcdir
sudo mv ./bundle $RC_DIR-new/
rm -rf $tmprcdir
}

prepare_directories
Expand Down
10 changes: 5 additions & 5 deletions rotate_version_gh.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ stop_rc () {
echo "Waiting for service to stop..."
for service in $(find_rocket)
do
until [ "$(systemctl show $$service -p ActiveState)" = "ActiveState=inactive" ]
until [ "$(systemctl show $service -p ActiveState)" = "ActiveState=inactive" ]
do
printf '.'
sleep 2
Expand All @@ -35,7 +35,7 @@ start_rocket_and_wait_for_response () {
timeout=60
until $(curl --output /dev/null --silent --head --fail http://localhost)
do
if [ "$$timeout" = "0" ]
if [ "$timeout" = "0" ]
then
echo -e "\nWaiting timed out - Rocket.Chat not responding yet"
exit 1
Expand All @@ -50,15 +50,15 @@ start_rocket_and_wait_for_response () {
update_rc () {
stop_rc
echo "Switching versions..."
sudo mv $$RC_DIR{,-old}
sudo mv $$RC_DIR{-new,}
sudo mv $RC_DIR{,-old}
sudo mv $RC_DIR{-new,}
start_rocket_and_wait_for_response
}

# Delete previous version
cleanup () {
echo "Cleaning up old directories..."
sudo rm -rf $$RC_DIR-old
sudo rm -rf $RC_DIR-old
}

update_rc
Expand Down

0 comments on commit ddd8320

Please sign in to comment.