diff options
| -rw-r--r-- | Dockerfile.production | 5 | ||||
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | config/nginx-default.conf | 2 | ||||
| -rw-r--r-- | config/uwsgi.config | 2 |
4 files changed, 11 insertions, 5 deletions
diff --git a/Dockerfile.production b/Dockerfile.production index 5c70c4c..ae37e23 100644 --- a/Dockerfile.production +++ b/Dockerfile.production | |||
| @@ -30,14 +30,13 @@ RUN set -x \ | |||
| 30 | && cp ./config/nginx.conf /etc/nginx/nginx.conf \ | 30 | && cp ./config/nginx.conf /etc/nginx/nginx.conf \ |
| 31 | && cp ./config/uwsgi.config /etc/uwsgi/apps-enabled/mat2-web.ini \ | 31 | && cp ./config/uwsgi.config /etc/uwsgi/apps-enabled/mat2-web.ini \ |
| 32 | && chown 101:101 /etc/uwsgi/apps-enabled/mat2-web.ini \ | 32 | && chown 101:101 /etc/uwsgi/apps-enabled/mat2-web.ini \ |
| 33 | && mkdir -p /var/cache/nginx \ | 33 | && mkdir -p /var/cache/nginx \ |
| 34 | && chown -R 101:0 /var/cache/nginx \ | 34 | && chown -R 101:0 /var/cache/nginx \ |
| 35 | && chmod -R g+w /var/cache/nginx \ | 35 | && chmod -R g+w /var/cache/nginx \ |
| 36 | && ln -sf /dev/stdout /var/log/nginx/access.log \ | 36 | && ln -sf /dev/stdout /var/log/nginx/access.log \ |
| 37 | && ln -sf /dev/stderr /var/log/nginx/error.log \ | 37 | && ln -sf /dev/stderr /var/log/nginx/error.log \ |
| 38 | && rm -rf /var/cache/apt/* /var/lib/apt/lists/* \ | 38 | && rm -rf /var/cache/apt/* /var/lib/apt/lists/* \ |
| 39 | && mkdir ./uploads \ | 39 | && chown -R nginx:nginx . |
| 40 | && chown -R nginx:nginx . | ||
| 41 | 40 | ||
| 42 | STOPSIGNAL SIGTERM | 41 | STOPSIGNAL SIGTERM |
| 43 | 42 | ||
| @@ -202,6 +202,13 @@ and `Dockerfile.production` is used for production deployments. | |||
| 202 | You can find the automated docker builds in the registry of this | 202 | You can find the automated docker builds in the registry of this |
| 203 | repository: https://0xacab.org/jvoisin/mat2-web/container_registry | 203 | repository: https://0xacab.org/jvoisin/mat2-web/container_registry |
| 204 | 204 | ||
| 205 | ### Building the production image | ||
| 206 | Build command: `docker build -f Dockerfile.production -t mat-web .` | ||
| 207 | |||
| 208 | Run it: ` docker run -ti -p8181:8080 --read-only --tmpfs /tmp --tmpfs=/var/www/mat2-web/uploads mat-web:latest` | ||
| 209 | |||
| 210 | This does mount the upload folder as tmpfs and servers the app on `localhost:8181` | ||
| 211 | |||
| 205 | # Configuration | 212 | # Configuration |
| 206 | 213 | ||
| 207 | The default settings from `main.py` may be overridden by adding a `config.py` | 214 | The default settings from `main.py` may be overridden by adding a `config.py` |
diff --git a/config/nginx-default.conf b/config/nginx-default.conf index fd3e2f1..52c2fe2 100644 --- a/config/nginx-default.conf +++ b/config/nginx-default.conf | |||
| @@ -9,6 +9,6 @@ server { | |||
| 9 | location / { try_files $uri @yourapplication; } | 9 | location / { try_files $uri @yourapplication; } |
| 10 | location @yourapplication { | 10 | location @yourapplication { |
| 11 | include uwsgi_params; | 11 | include uwsgi_params; |
| 12 | uwsgi_pass unix:/var/www/mat2-web/mat2-web.sock; | 12 | uwsgi_pass unix:/tmp/uwsgi.sock; |
| 13 | } | 13 | } |
| 14 | } | 14 | } |
diff --git a/config/uwsgi.config b/config/uwsgi.config index 177ddaf..9b46181 100644 --- a/config/uwsgi.config +++ b/config/uwsgi.config | |||
| @@ -13,7 +13,7 @@ gid = www-data | |||
| 13 | harakiri = 30 | 13 | harakiri = 30 |
| 14 | die-on-term = true | 14 | die-on-term = true |
| 15 | 15 | ||
| 16 | socket = mat2-web.sock | 16 | socket = /tmp/uwsgi.sock |
| 17 | chmod-socket = 774 | 17 | chmod-socket = 774 |
| 18 | plugins = python3 | 18 | plugins = python3 |
| 19 | 19 | ||
