use tmpfs for file storage

This commit is contained in:
Jan Friedli 2020-03-28 15:17:45 +01:00
parent 40d4fdad9e
commit e53ea9a051
No known key found for this signature in database
GPG Key ID: F945FA2FCA30549D
4 changed files with 11 additions and 5 deletions

View File

@ -30,14 +30,13 @@ RUN set -x \
&& cp ./config/nginx.conf /etc/nginx/nginx.conf \
&& cp ./config/uwsgi.config /etc/uwsgi/apps-enabled/mat2-web.ini \
&& chown 101:101 /etc/uwsgi/apps-enabled/mat2-web.ini \
&& mkdir -p /var/cache/nginx \
&& mkdir -p /var/cache/nginx \
&& chown -R 101:0 /var/cache/nginx \
&& chmod -R g+w /var/cache/nginx \
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/* \
&& mkdir ./uploads \
&& chown -R nginx:nginx .
&& chown -R nginx:nginx .
STOPSIGNAL SIGTERM

View File

@ -202,6 +202,13 @@ and `Dockerfile.production` is used for production deployments.
You can find the automated docker builds in the registry of this
repository: https://0xacab.org/jvoisin/mat2-web/container_registry
### Building the production image
Build command: `docker build -f Dockerfile.production -t mat-web .`
Run it: ` docker run -ti -p8181:8080 --read-only --tmpfs /tmp --tmpfs=/var/www/mat2-web/uploads mat-web:latest`
This does mount the upload folder as tmpfs and servers the app on `localhost:8181`
# Configuration
The default settings from `main.py` may be overridden by adding a `config.py`

View File

@ -9,6 +9,6 @@ server {
location / { try_files $uri @yourapplication; }
location @yourapplication {
include uwsgi_params;
uwsgi_pass unix:/var/www/mat2-web/mat2-web.sock;
uwsgi_pass unix:/tmp/uwsgi.sock;
}
}

View File

@ -13,7 +13,7 @@ gid = www-data
harakiri = 30
die-on-term = true
socket = mat2-web.sock
socket = /tmp/uwsgi.sock
chmod-socket = 774
plugins = python3