Comments (10)
Docker Compose doesn't have great built-in mechanisms for actually waiting for containers to completely start. The docs recommend using a wrapper like wait-for-it.sh
or dockerize
to wait on a port opening up, or you could probably use the example wait-for-postgres.sh
script there: https://docs.docker.com/compose/startup-order/
from docnow.
Interesting! It looks like a timing issue -- docker-compose expresses the dependency that the django has on the db, but I think the container could be running without the db being fully up. I'm curious though, is the app running ok on http:/localhost:8000/ or did the django container quit? You can see if you do a:
docker ps -a
I did put a sleep in the django startup to try to accommodate for this, but maybe 5 seconds isn't enough ... and maybe there's a better way to do it...
from docnow.
I get this list:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c9357c0d7b7d docnow_trends "/bin/bash -c 'sle..." About a minute ago Up About a minute docnow_trends_1
25f4ec315712 docnow_django "/bin/bash -c 'sle..." About a minute ago Up About a minute 0.0.0.0:8000->8000/tcp docnow_django_1
36f7bbe006e3 postgres "docker-entrypoint..." About a minute ago Up About a minute 5432/tcp docnow_db_1
dcb21e9cd135 docnow_webpack "npm run start" About a minute ago Up About a minute 0.0.0.0:3000->3000/tcp docnow_webpack_1
a708b7a58dc3 redis "docker-entrypoint..." About a minute ago Up About a minute 6379/tcp docnow_redis_1
5d18d6b298b2 catatnight/postfix "/bin/sh -c '/opt/..." About a minute ago Up About a minute docnow_mail_1
I had already shut it down, so I deleted all the containers and images and restarted from scratch. This time the http server is responding at localhost:8000, and I get this error:
ProgrammingError at /
relation "docnow_user" does not exist
LINE 1: SELECT COUNT(*) AS "__count" FROM "docnow_user"
^
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.10.6
Exception Type: ProgrammingError
Exception Value:
relation "docnow_user" does not exist
LINE 1: SELECT COUNT(*) AS "__count" FROM "docnow_user"
^
Exception Location: /usr/local/lib/python3.6/site-packages/django/db/backends/utils.py in execute, line 64
Python Executable: /usr/local/bin/python3.6
Python Version: 3.6.1
Python Path:
['/usr/local/bin',
'/code',
'/usr/local/lib/python36.zip',
'/usr/local/lib/python3.6',
'/usr/local/lib/python3.6/lib-dynload',
'/usr/local/lib/python3.6/site-packages']
Server time: Fri, 24 Mar 2017 19:53:18 +0000
from docnow.
Oh my bad, that is an error you are seeing in your web browser?
from docnow.
I'm not sure how you deleted all the containers and images, but it looks like the database hasn't been completely set up, which can happen if the django isn't able to synchronize the models to the database when it is starting.
Can you do this:
% git pull
% docker-compose down
% docker-compose build
% docker-compose up
and see if it works any better?
from docnow.
Yeah, that was an error served to the browser. And I destroyed the images and containers with these steps: https://gist.github.com/JeffBelback/5687bb02f3618965ca8f . I've pulled (now on 66c346f), and it works! I'm able to create an account and get the email confirmation etc. Thanks for the fix!
from docnow.
oh great! thanks for testing and working the kinks out
from docnow.
@ryanfb thanks for the pointers to solving this timing issue better than sleeping for longer and longer periods of time -- reopening this so that it can be fixed.
from docnow.
@edsu For SFM, we use appdeps.py (https://github.com/gwu-libraries/appdeps). For example, https://github.com/gwu-libraries/sfm-ui/blob/master/Dockerfile#L43.
from docnow.
Hey, thanks @justinlittman! Also, thanks for doing the work to share it as a reusable utility.
from docnow.
Related Issues (20)
- create introductory paragraph
- make locally look like cloud
- Troubleshooting page
- restructure directory
- No login button on mobile HOT 1
- stream-loader and url-fetcher can become unresponsive HOT 3
- Ignoring retweets in data collection
- Add #docnow hashtag to collection tweet
- Searching fails for non-academic keys HOT 1
- Delete of Search with consent actions fails
- View counts (images & video)
- No tracking JavaScript
- Tweet out message not including all terms
- Remove action card on Insights view HOT 1
- Public Collection - Find Me messaging incorrect
- 404 page
- Callback URL error HOT 5
- Explore page - explain that 1000 only goes back 7 days
- @users search not working, and #hashtag search only works sometimes HOT 1
- administrators should not see "account awaiting activation" message
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docnow.