Reimplemented front and back end SSL and made Docker copy in fresh files (database, html, etc.) every startup.

This commit is contained in:
kououken 2018-12-22 17:57:39 -06:00
parent 03d7bc0d2e
commit 79956e0186
18 changed files with 136 additions and 10 deletions

View file

@ -1,5 +1,5 @@
# pull python base image # pull python base image
FROM python:3.7-alpine FROM python:3.5
# set up enviroment # set up enviroment
ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONDONTWRITEBYTECODE 1
@ -16,3 +16,6 @@ RUN pipenv install --skip-lock --system --dev
# copy project # copy project
COPY . /usr/src/app/ COPY . /usr/src/app/
# copy ssl files
COPY ./ssl/ /etc/ssl/private/

20
back/ssl/selfsigned.crt Normal file
View file

@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDVDCCAjygAwIBAgIJANSXcVJxmIYNMA0GCSqGSIb3DQEBCwUAMD8xCzAJBgNV
BAYTAlVTMQ8wDQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMQwwCgYD
VQQKDANQU1UwHhcNMTgxMjIyMTczMjMwWhcNMTkxMjIyMTczMjMwWjA/MQswCQYD
VQQGEwJVUzEPMA0GA1UECAwGT3JlZ29uMREwDwYDVQQHDAhQb3J0bGFuZDEMMAoG
A1UECgwDUFNVMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzBLLMprD
v1BVODoKHrt+QAd1vDuw0UCR61ytWNQSjMWG+rl4MD+gHq/BK4r2RiuC4E+mLe0O
pEYdyVC2K5BBs5jS8XD+DML66rSNxMaSvBgRtmlWqBEbI14h2uReQmr0v/lKJlqS
i5UemkdfNZkMy3xPmnRPvbwu4raPbUpTlrKs/lpc6sNKxNWudbsfIocGFbOHTlGE
y9ii1L2z6Bsfla5yvVujttFw/QsZyImdThDruphI54jS40JG/BDxjwDB8MOAAmrB
KlvG+GlcdiTBRg0XSeVBp3kBg/O+ImZV4TOlEcdX4g0NzAMIQ3hokhr82H4JXE33
zcAHb0mVSXCkowIDAQABo1MwU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OhJoGER/DnziBE4TPUPjibUf7tahIqNOIxd+FJzK4mbOwMmhbpxIfNkdDv
xyLJt4Bq0TJk5knLD+w9Q0+2
-----END PRIVATE KEY-----

View file

@ -2,21 +2,20 @@ version: '3.6'
services: services:
api: api:
build: ./app build: ./back
command: gunicorn reimbursinator.wsgi:application --bind 0.0.0.0:81 command: gunicorn --bind 0.0.0.0:444 --keyfile /etc/ssl/private/selfsigned.key --certfile /etc/ssl/private/selfsigned.crt reimbursinator.wsgi:application
volumes: #volumes:
- ./app/:/usr/src/app/ # - ./app/:/usr/src/back/
ports: ports:
- 8001:81 - "8444:444"
environment: environment:
- SECRET_KEY=please_change - SECRET_KEY=please_change
web: web:
build: ./front
image: nginx:1.10.3 image: nginx:1.10.3
volumes:
- ./static:/usr/share/nginx/html
ports: ports:
- "8000:80" - "8443:443"
environment: environment:
- NGINX_HOST=reimbursinator.com - NGINX_HOST=reimbursinator.com
- NGINX_PORT=80 - NGINX_PORT=443
command: /bin/bash -c "exec nginx -g 'daemon off;'" command: /bin/bash -c "exec nginx -g 'daemon off;'"

6
front/Dockerfile Normal file
View file

@ -0,0 +1,6 @@
FROM nginx:1.10.3
# copy config files
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY ./static/ /usr/share/nginx/html/
COPY ./ssl/ /etc/ssl/private/

22
front/nginx/default.conf Normal file
View file

@ -0,0 +1,22 @@
server {
server_name localhost;
listen 443;
ssl on;
ssl_certificate /etc/ssl/private/selfsigned.crt;
ssl_certificate_key /etc/ssl/private/selfsigned.key;
client_max_body_size 4G;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}

20
front/ssl/selfsigned.crt Normal file
View file

@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDVDCCAjygAwIBAgIJANSXcVJxmIYNMA0GCSqGSIb3DQEBCwUAMD8xCzAJBgNV
BAYTAlVTMQ8wDQYDVQQIDA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