Skip to content

Commit

Permalink
Cria docker compose para a api
Browse files Browse the repository at this point in the history
  • Loading branch information
rafasimao committed Nov 10, 2019
1 parent 6193ef8 commit 9b0c701
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/database.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_USER=raiseupapi
POSTGRES_PASSWORD=raiseupapi
POSTGRES_DB=raiseupapi_development
53 changes: 53 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '3'
services:
proxy.raiseup.local:
image: nginx
container_name: proxy
init: true
volumes:
- ./services/devproxy/conf.d:/etc/nginx/conf.d
ports:
- 80:80
environment:
NGINX_PORT: 80
depends_on:
# - riseup.local
- api.riseup.local

# riseup.local:
# container_name: client
# build:
# context: ./apps/client
# ports:
# - "8080:8080"
# volumes:
# - ./apps/client:/app
# depends_on:
# - api.riseup.local

api.riseup.local:
tty: true
stdin_open: true
container_name: api
init: true
build:
context: ./apps/api
env_file:
- ./config/api.env
volumes:
- ./apps/api:/app
ports:
- 3000:3000
depends_on:
- database.riseup.local

database.riseup.local:
image: postgres:12.0-alpine
container_name: database
init: true
volumes:
- ./data/database:/var/lib/postgresql/data
env_file:
- ./config/database.env
ports:
- 5432:5432
12 changes: 12 additions & 0 deletions services/devproxy/conf.d/api.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
upstream api-riseup {
server api.riseup.local:3000;
}

server {
listen 80;
server_name api.riseup.local;

location / {
proxy_pass http://api-riseup;
}
}
12 changes: 12 additions & 0 deletions services/devproxy/conf.d/client.conf.off
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
upstream riseup {
server riseup.local:8080;
}

server {
listen 80;
server_name riseup.local;

location / {
proxy_pass http://riseup;
}
}
14 changes: 14 additions & 0 deletions services/devproxy/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit 9b0c701

Please sign in to comment.