Skip to content

Commit

Permalink
Lets make sure nginx runs and stays running!
Browse files Browse the repository at this point in the history
  • Loading branch information
dydx committed Oct 18, 2024
1 parent 774ea9b commit 6bc9cee
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
3 changes: 1 addition & 2 deletions deploy/Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ RUN curl -O http://nginx.org/download/nginx-1.24.0.tar.gz \
ENV PATH="/usr/local/nginx/sbin:$PATH"

# Set up Nginx and Supervisor configurations
RUN echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf
RUN rm /usr/local/nginx/conf/nginx.conf
ADD ./nginx-app.conf /usr/local/nginx/conf/
ADD ./nginx-app.conf /usr/local/nginx/conf/nginx.conf
ADD ./supervisor-app.conf /etc/supervisor/conf.d/

# Copy Python app files
Expand Down
44 changes: 25 additions & 19 deletions nginx-app.conf
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
# mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream flask {
server unix:/tmp/app.sock; # for a file socket
# server 127.0.0.1:8001; # for a web port socket (we'll use this first)
events {
worker_connections 1024;
}

# configuration of the server
server {
# the port your site will be served on, default_server indicates that this server block
# is the block to use if no blocks match the server_name
listen 80 default_server;
http {
# the upstream component nginx needs to connect to
upstream flask {
server unix:/tmp/app.sock; # for a file socket
# server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# the domain name it will serve for
server_name get.replicated.com; # substitute your machine's IP address or FQDN
charset utf-8;
# configuration of the server
server {
# the port your site will be served on, default_server indicates that this server block
# is the block to use if no blocks match the server_name
listen 80 default_server;

# max upload size
client_max_body_size 75M; # adjust to taste
# the domain name it will serve for
server_name get.replicated.com; # substitute your machine's IP address or FQDN
charset utf-8;

# Finally, send all non-media requests to the Flask server.
location / {
uwsgi_pass flask;
include /home/docker/code/uwsgi_params; # the uwsgi_params file you installed
}
# max upload size
client_max_body_size 75M; # adjust to taste

# Finally, send all non-media requests to the Flask server.
location / {
uwsgi_pass flask;
include /home/docker/code/uwsgi_params; # the uwsgi_params file you installed
}
}
}
6 changes: 5 additions & 1 deletion supervisor-app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:nginx-app]
command = /usr/sbin/nginx
command = /usr/local/nginx/sbin/nginx -g "daemon off;"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

0 comments on commit 6bc9cee

Please sign in to comment.