Skip to content

Commit

Permalink
Continue script execution even if /etc/cnaas-nms/repository.yml is a
Browse files Browse the repository at this point in the history
readonly file
Check db hostname before doing connection check
  • Loading branch information
indy-independence committed Sep 26, 2024
1 parent 53b1189 commit 9eb18d7
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions docker/api/exec-pre-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,19 @@ else
touch "/tmp/pre-exec.lock"
fi

set -e

cp /etc/cnaas-nms/repository.yml /tmp/repository.yml.original
sed -e "s|^\(templates_remote: \).\+$|\1 $GITREPO_TEMPLATES|" \
-e "s|^\(settings_remote: \).\+$|\1 $GITREPO_SETTINGS|" \
< /tmp/repository.yml.original > /tmp/repository.yml.new \
&& cat /tmp/repository.yml.new > /etc/cnaas-nms/repository.yml

#if [ -e "/opt/cnaas/settings" ]; then
# rm -rf /opt/cnaas/settings
#fi
#if [ -e "/opt/cnaas/templates" ]; then
# rm -rf /opt/cnaas/templates
#fi
#git clone $GITREPO_SETTINGS /opt/cnaas/settings
#git clone $GITREPO_TEMPLATES /opt/cnaas/templates
set -e

# Wait for postgres to start
echo ">> Waiting for postgres to start"
WAIT=0
while ! nc -z cnaas_postgres 5432; do
DB_HOSTNAME=`cat /etc/cnaas-nms/db_config.yml | awk '/^hostname/ {print $2}'`
while ! nc -z $DB_HOSTNAME 5432; do
sleep 1
WAIT=$(($WAIT + 1))
if [ "$WAIT" -gt 15 ]; then
Expand Down

0 comments on commit 9eb18d7

Please sign in to comment.