

# if no Host match, close the connection to prevent host spoofing Server unix:/tmp/gunicorn.sock fail_timeout=0 # fail_timeout=0 means we always retry an upstream even if it failed # fallback in case we can't determine a typeĪccess_log /var/log/nginx/access.log combined # 'use kqueue ' to enable for FreeBSD, OSX Worker_connections 1024 # increase if you have lots of clientsĪccept_mutex off # set to 'on' if nginx worker_processes > 1 # 'user nobody nobody ' for systems with 'nobody' as a group instead I have also changed the nf with the example on gunicorn docs.

services:Ĭommand: gunicorn wsgi:app -worker-class eventlet -w 1 -bind 0.0.0.0:5000 -reload To fix the host name issue, I had to remove all the network directives in docker-compose.yml and change the gunicorn command to use eventlet worker class and point to app not socket_. If I go to to VPS IP I get the default nginx page where it tells me further configuration is required. Web_1 | warnings.warn(FSADeprecationWarning( Set it to True or False to suppress this warning. Web_1 | /usr/local/lib/python3.8/site-packages/flask_sqlalchemy/_init_.py:872: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Nginx_1 | /docker-entrypoint.sh: Configuration complete ready for start up Nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh Nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh Nginx_1 | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/nf Nginx_1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/nf Postgres_1 | 09:06:25.073 UTC LOG: database system is ready to accept connections Postgres_1 | 09:06:25.058 UTC LOG: database system was shut down at 09:05:55 UTC Postgres_1 | 09:06:25.049 UTC LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" Postgres_1 | PostgreSQL Database directory appears to contain a database Skipping initialization Nginx_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh Nginx_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ Nginx_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration This is what I see in the console: Attaching to test_postgres_1, test_pgadmin_1, test_web_1, test_nginx_1 Sess: Session = db.session # type: methods=) Name = db.Column(db.Text, unique=True, nullable=False)įrom import SessionĪpp.config = os.getenv("URI", None) Id = db.Column(db.Integer, primary_key=True) Models.py: from flask_sqlalchemy import SQLAlchemy Web_1 | Application object must be callable. I get this error when I run docker-compose up -build env: set the app config for URI like: app.config = os.getenv("URI", None) flask_polls_data:/var/lib/postgresql/data
#POSTGRES APP INSTALL#
RUN pip install -no-cache-dir -r requirements.txtĬommand: gunicorn -bind 0.0.0.0:5000 -k gevent -w 1 wsgi:socket_ Proxy_set_header X-Forwarded-Proto $scheme Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for My project structure is like this: +-nginx I already have a domain name that is pointed to the VPS's IP. I have a flask application that I want to host on my VPS.
