Browse Source

Ajusta busy-wait.sh script para sincronizar o banco(postgres) com a aplicação django no docker

pull/999/head
Matheus Veleci 9 years ago
committed by Edward Ribeiro
parent
commit
4bc0cf91e1
  1. 2
      Dockerfile
  2. 8
      busy-wait.sh
  3. 4
      docker-compose.yml
  4. 2
      sapl/.env_test

2
Dockerfile

@ -2,7 +2,7 @@ FROM alpine:3.5
ENV BUILD_PACKAGES postgresql-dev graphviz-dev graphviz build-base git pkgconfig \
python3-dev libxml2-dev jpeg-dev libressl-dev libffi-dev libxslt-dev nodejs py3-lxml \
py3-magic
py3-magic postgresql-client
RUN apk add --no-cache python3 && \
python3 -m ensurepip && \

8
busy-wait.sh

@ -1,12 +1,10 @@
#!/bin/sh
#
while true; do
COUNT_PG=`netstat -an | grep "tcp.*:5532.*LISTEN"| wc -l`
COUNT_PG=`psql --dbname=postgresql://sapl:sapl@sapldb/sapl -c '\l \q' | grep sapl | wc -l`
if ! [ "$COUNT_PG" -eq "0" ]; then
break
fi
echo "Esperando BD"
sleep 5
echo "Esperando Database Setup"
sleep 10
done

4
docker-compose.yml

@ -8,7 +8,7 @@ server:
- web
links:
- web
sapl_db:
sapldb:
image: postgres
environment:
POSTGRES_PASSWORD: sapl
@ -25,4 +25,4 @@ web:
volumes:
- .:/sapl
links:
- sapl_db
- sapldb

2
sapl/.env_test

@ -1,4 +1,4 @@
DATABASE_URL = postgresql://postgres:@localhost:/sapl
DATABASE_URL = postgresql://postgres:@sapldb:/sapl
SECRET_KEY=TravisTest
DEBUG=False
EMAIL_USE_TLS = True

Loading…
Cancel
Save