Code Monkey home page Code Monkey logo

docker_flask_mongodb_gunicorn_nginx's People

Contributors

laztoum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

thkarag

docker_flask_mongodb_gunicorn_nginx's Issues

multiple sites on port 80

I have an app and an api. I was thinking of making a copy of flask-app and making a new folder called flask-api.

screen shot 2016-10-11 at 6 35 18 am

Then changing the Dockerfile in flask-gunicorn-nginx to add this new app folder.

I did some research and adding multiple sites that need to access port 80 can only be done with an nginx reverse proxy. https://www.digitalocean.com/community/questions/how-to-bind-multiple-domains-ports-80-and-443-to-docker-contained-applications

So in the site.conf I do:

upstream app-a {
    server 127.0.0.1:3000;
}

upstream app-b {
    server 127.0.0.1:5000;
}

server {
        listen 80;
        server_name example.com www.example.com;

        location / {
            proxy_pass         http://app-a;
            proxy_redirect     off;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;

        }
}

server {
        listen 80;
        server_name example.com api.example.com;

        location / {
            proxy_pass         http://app-b;
            proxy_redirect     off;
            proxy_set_header   Host $host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host $server_name;

        }
}

And of course I would need to change the nginflask.conf

[supervisord]
nodaemon=true

[program:gunicorn]
command=gunicorn --workers 5 --reload --bind 127.0.0.1:3000 -m 007 wsgi:app
directory = /flaskApp
user = www-data

[program:gunicorn]
command=gunicorn --workers 5 --reload --bind 127.0.0.1:5000 -m 007 wsgi:app
directory = /flaskApi
user = www-data

[program:nginx]
command = service nginx restart

Would this work? Are there better ways to do this?

Disable nginx cache

How can I disable nginx cache? I am styling a web page and the site still shows an older version of the css. However, when I change text it reflect the change immediately.

HTTP request took too long to complete

Hi,

I just cloned your repo and executed docker-compose up. Then I get the following error:

ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60)

I tried to increased the timeout (COMPOSE_HTTP_TIMEOUT=200 docker-compose up), but I still get the error.

What I am doing wrong? Thanks

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.