summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimponic <loganhunt@simponic.xyz>2022-04-22 14:52:26 -0600
committerSimponic <loganhunt@simponic.xyz>2022-04-22 14:52:26 -0600
commit7905252d246e507cac894c7e58edbc1e3df360e9 (patch)
tree4e5ec1bcc6785ef85ef7f82a3dccd76400c3e95d
parent13f29496d6d9810ec76902b75e3988579f3344be (diff)
downloadaggiedit-7905252d246e507cac894c7e58edbc1e3df360e9.tar.gz
aggiedit-7905252d246e507cac894c7e58edbc1e3df360e9.zip
Deployment final
-rw-r--r--.env.example15
-rw-r--r--docker-compose.yml32
-rw-r--r--nginx/Dockerfile3
-rw-r--r--nginx/nginx.conf36
4 files changed, 86 insertions, 0 deletions
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..08221f2
--- /dev/null
+++ b/.env.example
@@ -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=
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..dc7615d
--- /dev/null
+++ b/docker-compose.yml
@@ -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:
diff --git a/nginx/Dockerfile b/nginx/Dockerfile
new file mode 100644
index 0000000..4909c28
--- /dev/null
+++ b/nginx/Dockerfile
@@ -0,0 +1,3 @@
+FROM nginx:alpine
+
+COPY ./nginx.conf /etc/nginx/nginx.conf
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
new file mode 100644
index 0000000..f1704d9
--- /dev/null
+++ b/nginx/nginx.conf
@@ -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";
+ }
+ }
+}