Skip to content

Commit 0e4a800

Browse files
committed
Update to base-flask v3.19.3
1 parent e791ded commit 0e4a800

10 files changed

+46
-112
lines changed

.drone.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ volumes:
99

1010
steps:
1111
- name: Test Python
12-
image: python:3.11
12+
image: python:3.11-slim-bullseye
1313
commands:
14+
- apt-get update && apt-get install -y curl git
1415
- ln -fs .env.development .env
1516
- pip install -r requirements.txt
1617
- pip install -r requirements-test.txt
1718
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > "${HOME}/bin/cc-test-reporter"
1819
- chmod +x "${HOME}/bin/cc-test-reporter"
1920
- flake8
21+
- gunicorn -c config/gunicorn.conf.py --check-config
2022
- mypy . --ignore-missing-imports --strict
2123
- cc-test-reporter before-build
2224
- coverage run -m unittest discover

Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
FROM node:18 as node
1+
FROM node:18-slim as node
22
WORKDIR /
33
COPY . .
44
RUN npm ci --only=production \
55
&& npm run minify
66

77

8-
# Need buster for uwsgi builds
9-
FROM python:3.11-buster
8+
FROM python:3.11-slim-bullseye
109

1110
LABEL maintainer="git@albertyw.com"
1211
EXPOSE 5000

bin/start.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ IFS=$'\n\t'
1010
rm -rf static/mount/*
1111
cp -r static/* static/mount || true
1212

13-
# Run supervisor to run uwsgi
13+
# Run supervisor to run gunicorn
1414
supervisord -c config/supervisord.conf

config/gunicorn.conf.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import multiprocessing
2+
3+
4+
proc_name = 'chase-center-calendar'
5+
wsgi_app = 'app.serve:app'
6+
7+
bind = '0.0.0.0:5000'
8+
forwarded_allow_ips = '*'
9+
workers = multiprocessing.cpu_count() * 2 + 1
10+
preload_app = True
11+
12+
accesslog = '/var/www/app/logs/gunicorn/access.log'
13+
errorlog = '/var/www/app/logs/gunicorn/error.log'
14+
access_log_format = (
15+
'%({x-forwarded-for}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" '
16+
'"%(a)s"'
17+
)
18+
19+
max_requests = 5000
20+
max_requests_jitter = 1000

config/supervisord.conf

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ logfile=/var/www/app/logs/supervisord/supervisord.log
44
pidfile=/var/run/supervisord.pid
55
user=root
66

7-
[program:uwsgi]
8-
command=/usr/local/bin/uwsgi --ini /var/www/app/config/uwsgi/website.ini
7+
[program:gunicorn]
8+
command=gunicorn -c /var/www/app/config/gunicorn.conf.py
99
directory=/var/www/app
10-
stdout_logfile=/var/www/app/logs/supervisord/uwsgi-stdout.log
11-
stderr_logfile=/var/www/app/logs/supervisord/uwsgi-stderr.log
10+
stdout_logfile=/var/www/app/logs/supervisord/gunicorn-stdout.log
11+
stderr_logfile=/var/www/app/logs/supervisord/gunicorn-stderr.log
1212
stdout_logfile_maxbytes=10000000
1313
stderr_logfile_maxbytes=10000000
1414
autostart=true

config/uwsgi/website.ini

-83
This file was deleted.

config/uwsgi/websiterunner.py

-6
This file was deleted.

logs/gunicorn/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*log*

package-lock.json

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Core packages
22
python-dotenv==0.21.0 # Read environment variables from .env
33
Flask==2.2.2 # Web microframework
4-
uWSGI==2.0.21 # Application server
4+
gunicorn==20.1.0 # WSGI server
55
syspath==3.0.1 # Modify paths
66

77
# Features
@@ -14,4 +14,5 @@ python-slugify==7.0.0 # Generate string slugs
1414
# Monitoring/tracking/logging
1515
blinker==1.5 # Dependency of rollbar
1616
rollbar==0.16.3 # rollbar.com error logging
17-
varsnap==1.5.4 # Test discovery
17+
setproctitle==1.3.2 # Allow gunicorn to set process title
18+
varsnap==1.5.5 # Test discovery

0 commit comments

Comments
 (0)