-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade #3
base: master
Are you sure you want to change the base?
upgrade #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
FROM phusion/baseimage | ||
FROM python:3.7.1-alpine3.8 | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y git | ||
RUN apt-get install -y python3 python-pip python3-dev libpq-dev postgresql-client | ||
RUN apt-get install -y libssl-dev | ||
RUN apt-get install build-essential | ||
RUN apk update && apk add postgresql-dev gcc musl-dev | ||
COPY requirements.txt /app/ | ||
RUN pip install --no-cache-dir -r /app/requirements.txt | ||
|
||
ADD ./ /app/ | ||
|
||
WORKDIR /app/ | ||
|
||
RUN pip install -r requirements.txt | ||
WORKDIR /app |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,11 @@ | |
|
||
set -e | ||
|
||
until psql -h "postgres_db" -U "postgres" -c '\l'; do | ||
>&2 echo "Postgres is unavailable - sleeping" | ||
sleep 1 | ||
done | ||
# until psql -h "postgres_db" -U "postgres" -c '\l'; do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gogobook What is the reason for removing this ? This makes sure that postgres is up and running before we run any migrations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got an error in my trying, it raise 'Postgres is unavailable - sleeping', when comment these code, it will be fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this and I am getting the error that postgres is not available. The Postgres check is required. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Run 'docker-compose restart web'. And 'web' container will start normally. The error message is 'Is the server running on host "postgres_db" (172.19.0.3) and accepting TCP/IP connections on port 5432?', and add "sleep 3" to entrypoint.sh can solve it. The 'psql' is not exist in 'web' container. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If Docker docs themselves suggest to use this method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we need psql, we have to install postgresql to web container, and I don't like this way. If we don't like 'sleep 3', maybe the better solution is 'wait-for' script, action like the example. |
||
# >&2 echo "Postgres is unavailable - sleeping" | ||
# sleep 1 | ||
# done | ||
|
||
|
||
# Run python migrations | ||
python blog/manage.py migrate | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
argcomplete==1.0.0 | ||
argcomplete | ||
asd==1.3.2 | ||
Django==1.10 | ||
mongoengine==0.10.6 | ||
psycopg2==2.6.2 | ||
pymongo==3.3.0 | ||
voidpp-tools==1.8.1 | ||
Django==2.1.3 | ||
mongoengine==0.16.2 | ||
psycopg2-binary==2.7.6 | ||
pymongo==3.7.2 | ||
voidpp-tools==1.11.0 | ||
docker-compose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gogobook I am curious as to what this change achieves. In command you are executing the same file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it raise an error when I using "entrypoint" way, so I changed it to command.