Code Monkey home page Code Monkey logo

docker-gunicorn's People

Contributors

karbuzov avatar tbeadle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docker-gunicorn's Issues

Gunicorn exits with error

Hi,

I'm trying to run my WSGI (Flask) app inside your docker image gunicorn-nginx:3.5-onbuild. However, I'm seeing gunicorn exit with an error but it doesn't say much about what it is. I'm fairly new to docker. I'll demonstrate the problem:

From a fresh virtualenv (python3), this is how I would normally run my app:

$ pip install -r docker/requirements.txt
...
$ gunicorn "my_module:get_configured_app(\"my_module/somefile\")"
[2017-06-17 15:22:42 -0700] [7799] [INFO] Starting gunicorn 19.4.5
[2017-06-17 15:22:42 -0700] [7799] [INFO] Listening at: http://127.0.0.1:8000 (7799)
[2017-06-17 15:22:42 -0700] [7799] [INFO] Using worker: sync
[2017-06-17 15:22:42 -0700] [7802] [INFO] Booting worker with pid: 7802

Where get_configured_app() is a function defined inside my_module/__init__.py. Then I can access my API on port 8000 with no problems.

Now when I try to run it inside a container, I use this Dockerfile:

$ cat Dockerfile 
FROM tbeadle/gunicorn-nginx:3.5-onbuild
ENV APP_MODULE my_module:get_configured_app(\"my_module/somefile\")

After building the image, I run it (binding port 80 because that's where nginx is listening inside the container):

$ docker run -d -p 8001:80 my_app:v0

I can see the container is running using docker ps, but my API is unaccessible (502 Bad Gateway). When I try to investigate the problem, this is all I see:

$ docker logs -f inspiring_colden
Saving environment to be available for cron jobs in /etc/cron.env.
2017-06-17 22:18:00,851 CRIT Supervisor running as root (no user in config file)
2017-06-17 22:18:00,860 INFO RPC interface 'supervisor' initialized
2017-06-17 22:18:00,860 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-06-17 22:18:00,860 INFO supervisord started with pid 1
2017-06-17 22:18:01,867 INFO spawned: 'cron' with pid 13
2017-06-17 22:18:01,869 INFO spawned: 'nginx' with pid 14
2017-06-17 22:18:01,870 INFO spawned: 'gunicorn' with pid 15
2017-06-17 22:18:02,294 INFO exited: gunicorn (exit status 1; not expected)
2017-06-17 22:18:02,341 INFO reaped unknown pid 23
2017-06-17 22:18:03,346 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-17 22:18:03,346 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2017-06-17 22:18:03,347 INFO spawned: 'gunicorn' with pid 25
2017-06-17 22:18:03,785 INFO exited: gunicorn (exit status 1; not expected)
2017-06-17 22:18:03,801 INFO reaped unknown pid 31
2017-06-17 22:18:05,809 INFO spawned: 'gunicorn' with pid 34
2017-06-17 22:18:06,231 INFO exited: gunicorn (exit status 1; not expected)
2017-06-17 22:18:06,255 INFO reaped unknown pid 40
2017-06-17 22:18:09,270 INFO spawned: 'gunicorn' with pid 43
2017-06-17 22:18:09,749 INFO exited: gunicorn (exit status 1; not expected)
2017-06-17 22:18:10,756 INFO gave up: gunicorn entered FATAL state, too many start retries too quickly

Obviously something is causing gunicorn to crash but there's no information on what. Do you have any idea what's going on or any idea how I can get more information? I imagine it's probably some sort of import/path issue since (I assume) supervisord does not run from /app as the working directory.

error buld example django-app

db uses an image, skipping
Building ui
Step 1/1 : FROM tbeadle/gunicorn-nginx:3.6-onbuild

Executing 4 build triggers

---> Using cache
---> Running in 6fee375103a1
----> Running /app/docker/pre-build.d/01_build_time_deps.sh
Installing build time dependencies.
Get:1 http://security.debian.org stretch/updates InRelease [94.3 kB]
Ign:2 http://deb.debian.org/debian stretch InRelease
Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 http://deb.debian.org/debian stretch Release [118 kB]
Get:5 http://security.debian.org stretch/updates/main amd64 Packages [481 kB]
Get:6 http://deb.debian.org/debian stretch Release.gpg [2,434 B]
Get:7 http://deb.debian.org/debian stretch-updates/main amd64 Packages [5,476 B]
Get:8 http://deb.debian.org/debian stretch/main amd64 Packages [9,500 kB]
Fetched 10.3 MB in 3s (3,105 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Package postgresql-client-9.4 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'postgresql-client-9.4' has no installation candidate
ERROR: Service 'ui' failed to build: The command '/bin/sh -c build_app.sh' returned a non-zero code: 100

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.