-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathdev_run.sh
executable file
·28 lines (23 loc) · 906 Bytes
/
dev_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# export local environment
export AMQP_URI=amqp://guest:guest@localhost:5672
export POSTGRES_URI=postgres://postgres:postgres@localhost:5432/orders
export REDIS_URI=redis://localhost:6379/dev
# Check if rabbit is up and running before starting the service.
until nc -z localhost 5672; do
echo "$(date) - waiting for rabbitmq..."
sleep 2
done
# Check if redis is up and running before starting the service.
until nc -z localhost 6379; do
echo "$(date) - waiting for redis..."
sleep 2
done
# Check if postgres is up and running before starting the service.
until nc -z localhost 5432; do
echo "$(date) - waiting for postgres..."
sleep 2
done
# create database orders locally
python -c """import psycopg2 as db;p='postgres';con=db.connect(dbname=p,host='localhost',user=p,password=p);
con.autocommit=True;con.cursor().execute('CREATE DATABASE orders')""" 2> /dev/null
./run.sh $@