GithubHelp home page GithubHelp logo

Comments (10)

ryanfb avatar ryanfb commented on July 24, 2024 9

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.

edsu avatar edsu commented on July 24, 2024

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.

pbinkley avatar pbinkley commented on July 24, 2024

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.

edsu avatar edsu commented on July 24, 2024

Oh my bad, that is an error you are seeing in your web browser?

from docnow.

edsu avatar edsu commented on July 24, 2024

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.

pbinkley avatar pbinkley commented on July 24, 2024

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.

edsu avatar edsu commented on July 24, 2024

oh great! thanks for testing and working the kinks out

from docnow.

edsu avatar edsu commented on July 24, 2024

@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.

justinlittman avatar justinlittman commented on July 24, 2024

@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.

edsu avatar edsu commented on July 24, 2024

Hey, thanks @justinlittman! Also, thanks for doing the work to share it as a reusable utility.

from docnow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.