Code Monkey home page Code Monkey logo

Comments (4)

bartmeuris avatar bartmeuris commented on May 25, 2024

I had this issue too. Relying on container startup order is in my experience a bad idea - it's better if the applications would just retry the connection until it succeeds.

That said, many don't, and I usually solve this by waiting for the postgres instance in a wrapper script. There are multiple options:

  • Using pg_isready (requires more packages, but is probably the safest)
  • Using netcat in a loop, but netcat is notoriously implementation-specific, this is how it works with the netcat-openbsd package (default on ubuntu/debian I think), not sure if other implementations support the -z flag:
while ! nc -z ${DATABASE_HOST} ${DATABASE_PORT:-5432}; do
    sleep .3
done
  • Use a a pure-shell approach:
while ! (echo >/dev/tcp/${DATABASE_HOST}/${DATABASE_PORT:-5432}) &>/dev/null; do
    sleep .3;
done

from awx-container.

geerlingguy avatar geerlingguy commented on May 25, 2024

Thanks for reporting this! I, luckily, haven't run into this yet... but I have heard from a few people who have seen it happen. If it becomes a regular issue, I might work to wrap things like @bartmeuris suggests, or find some other workaround.

from awx-container.

geerlingguy avatar geerlingguy commented on May 25, 2024

@echristoffersen - Hmm, is it actually this issue: #19 ?

from awx-container.

geerlingguy avatar geerlingguy commented on May 25, 2024

I'm closing all issues on this repository as it has been deprecated; please see: #49

from awx-container.

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.