#!/bin/bash
-# import dump functions of the database (postgres or mysql)
-# export POSTGRES="$(dpkg --get-selections | grep postgres 2>&1)"
-# export MYSQL="$(dpkg --get-selections | grep mysql 2>&1)"
+set -e
-# wait for db
-# /srv/bin/misc/wait.sh
+echo "Restoring..."
# import database functions of type
if [ ! -z "$MYSQL_ROOT_PASSWORD" ]; then
#!/bin/sh
-docker-compose run db /srv/bin/dev/local/restore_db.sh
+docker-compose up -d db
+docker-compose run db bash -c "/srv/bin/misc/wait.sh; /srv/bin/dev/local/restore_db.sh; /srv/bin/dev/local/restore_db.sh"
+docker-compose stop db
-#!/bin/sh
+#!/bin/bash
set -e
-host=$(env | grep _TCP_ADDR | cut -d = -f 2)
-port=$(env | grep _TCP_PORT | cut -d = -f 2)
+apt update
+apt install -y netcat
-echo -n "waiting for TCP connection to $host:$port..."
+HOST=db
+PORT=5432
-while ! nc -w 1 $host $port 2>/dev/null
+echo -n "waiting for TCP connection to $HOST:$PORT..."
+
+while ! nc -w 1 $HOST $PORT 2>/dev/null
do
echo -n .
sleep 1