Deployment final

This commit is contained in:
Simponic 2022-04-22 14:52:26 -06:00
parent 13f29496d6
commit 7905252d24
4 changed files with 86 additions and 0 deletions

15
.env.example Normal file
View File

@ -0,0 +1,15 @@
PHX_HOST=aggiedit.simponic.xyz
POSTGRES_USER=aggiedit
POSTGRES_PASSWORD=password
POSTGRES_HOSTNAME=db
SECRET_KEY_BASE=secret
PORT=4000
DATABASE_URL=ecto://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOSTNAME/$POSTGRES_USER
SMTP_SERVER=
TO_EMAIL=
CONTACT_EMAIL=
EMAIL_PASSWORD=
USER_UPLOADS=

32
docker-compose.yml Normal file
View File

@ -0,0 +1,32 @@
version: '3'
services:
prod:
build: ./
env_file:
- .env
expose:
- 4000
depends_on:
- 'db'
volumes:
- ${USER_UPLOADS}/uploads:/app/bin/priv/static/uploads
depends_on:
- db
nginx:
build: ./nginx
ports:
- "8081:80"
volumes:
- ${USER_UPLOADS}:/uploads
depends_on:
- prod
db:
image: 'postgres:14'
env_file:
- .env
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:

3
nginx/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM nginx:alpine
COPY ./nginx.conf /etc/nginx/nginx.conf

36
nginx/nginx.conf Normal file
View File

@ -0,0 +1,36 @@
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
}
http {
upstream prod {
server prod:4000;
}
server {
listen 80;
server_name localhost 127.0.0.1;
location /uploads {
root /uploads;
}
location / {
proxy_pass http://prod;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect default;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}