mirror of
https://github.com/demostf/setup
synced 2026-06-04 09:04:06 +02:00
add api and DB
This commit is contained in:
parent
28d33adce7
commit
21a0aaa6bc
6 changed files with 66 additions and 51 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
||||||
.env
|
.env
|
||||||
|
db_data
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,10 @@ Hosting setup for demos.tf
|
||||||
Create a `.env` file with the following values:
|
Create a `.env` file with the following values:
|
||||||
|
|
||||||
- HOST
|
- HOST
|
||||||
|
- PORT
|
||||||
|
- HTTPS_PORT
|
||||||
- EMAIL
|
- EMAIL
|
||||||
|
- DB_PASSWORD
|
||||||
|
|
||||||
Start the containers:
|
Start the containers:
|
||||||
|
|
||||||
|
|
|
||||||
25
api.tmpl
Normal file
25
api.tmpl
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name api.${HOST};
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
client_max_body_size 150m;
|
||||||
|
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
try_files $uri /index.php?$query_string /index.php;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_pass api:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /app/public/index.php;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /upload {
|
||||||
|
fastcgi_pass api:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME /app/public/upload.php;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
client_max_body_size 150m;
|
|
||||||
|
|
||||||
location = /upload {
|
|
||||||
limit_except GET HEAD {
|
|
||||||
proxy_pass http://upload.demos.tf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,52 +2,45 @@ version: '2'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx
|
image: demostf/demos.tf
|
||||||
container_name: nginx
|
container_name: nginx
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "${PORT}:80"
|
||||||
- "443:443"
|
- "${HTTPS_PORT}:443"
|
||||||
volumes:
|
volumes:
|
||||||
- "/etc/nginx/conf.d"
|
|
||||||
- "/etc/nginx/vhost.d"
|
|
||||||
- "/usr/share/nginx/html"
|
|
||||||
- "certs:/etc/nginx/certs:ro"
|
- "certs:/etc/nginx/certs:ro"
|
||||||
|
- "./api.tmpl:/etc/nginx/conf.d/api.tmpl"
|
||||||
|
environment:
|
||||||
|
- HOST=${HOST}
|
||||||
networks:
|
networks:
|
||||||
- proxy-tier
|
- proxy-tier
|
||||||
nginx-gen:
|
depends_on:
|
||||||
image: jwilder/docker-gen
|
- api
|
||||||
container_name: nginx-gen
|
api:
|
||||||
volumes:
|
image: demostf/api
|
||||||
- "/var/run/docker.sock:/tmp/docker.sock:ro"
|
container_name: api
|
||||||
- "./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro"
|
|
||||||
- "./demostf-nginx.conf:/etc/nginx/vhost.d/${HOST}"
|
|
||||||
volumes_from:
|
|
||||||
- nginx
|
|
||||||
entrypoint: /usr/local/bin/docker-gen -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
|
|
||||||
environment:
|
environment:
|
||||||
- ENABLE_IPV6=true
|
- DB_TYPE=pgsql
|
||||||
|
- DB_HOST=db
|
||||||
|
- DB_DATABASE=postgres
|
||||||
|
- DB_USERNAME=postgres
|
||||||
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
networks:
|
networks:
|
||||||
- proxy-tier
|
- proxy-tier
|
||||||
letsencrypt-nginx-proxy-companion:
|
- db-tier
|
||||||
image: jrcs/letsencrypt-nginx-proxy-companion
|
upload:
|
||||||
container_name: letsencrypt-nginx-proxy-companion
|
image: nginx
|
||||||
volumes_from:
|
container_name: upload
|
||||||
- nginx
|
|
||||||
volumes:
|
|
||||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
|
||||||
- "certs:/etc/nginx/certs:rw"
|
|
||||||
environment:
|
|
||||||
- NGINX_DOCKER_GEN_CONTAINER=nginx-gen
|
|
||||||
|
|
||||||
demostf:
|
db:
|
||||||
image: demostf/demos.tf
|
image: demostf/db
|
||||||
container_name: demostf
|
container_name: db
|
||||||
environment:
|
environment:
|
||||||
- VIRTUAL_HOST=${HOST}
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||||
- LETSENCRYPT_HOST=${HOST}
|
volumes:
|
||||||
- LETSENCRYPT_EMAIL=${EMAIL}
|
- "./db_data:/var/lib/postgresql/data"
|
||||||
networks:
|
networks:
|
||||||
- proxy-tier
|
- db-tier
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
proxy-tier:
|
proxy-tier:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue