mirror of
https://github.com/sergeyyarkov/educt.git
synced 2026-10-11 02:09:06 +03:00
feat: setup docker files
This commit is contained in:
commit
729fb56ab2
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[submodule "educt-server"]
|
||||||
|
path = educt-server
|
||||||
|
url = https://github.com/sergeyyarkov/educt-server.git
|
||||||
|
[submodule "educt-client"]
|
||||||
|
path = educt-client
|
||||||
|
url = https://github.com/sergeyyarkov/educt-client.git
|
||||||
14
Makefile
Normal file
14
Makefile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
build:
|
||||||
|
docker-compose -f docker-compose.yml build $(c)
|
||||||
|
up:
|
||||||
|
docker-compose -f docker-compose.yml up -d $(c)
|
||||||
|
down:
|
||||||
|
docker-compose -f docker-compose.yml down $(c)
|
||||||
|
stop:
|
||||||
|
docker-compose -f docker-compose.yml stop $(c)
|
||||||
|
logs:
|
||||||
|
docker-compose -f docker-compose.yml logs --tail=100 -f $(c)
|
||||||
|
migrate:
|
||||||
|
docker-compose -f docker-compose.yml run api npm run db:migrate:force
|
||||||
|
seed:
|
||||||
|
docker-compose -f docker-compose.yml run api npm run db:seed
|
||||||
100
docker-compose.yml
Normal file
100
docker-compose.yml
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
nginx:
|
||||||
|
container_name: nginx
|
||||||
|
restart: always
|
||||||
|
image: nginx:latest
|
||||||
|
volumes:
|
||||||
|
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
depends_on:
|
||||||
|
- api
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
client:
|
||||||
|
container_name: client
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: ./educt-client
|
||||||
|
target: production
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
depends_on:
|
||||||
|
- api
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
api:
|
||||||
|
container_name: api
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: ./educt-server
|
||||||
|
target: production
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- 3333:3333
|
||||||
|
environment:
|
||||||
|
- PORT=3333
|
||||||
|
- APP_KEY=IP387l45rlNO3t7Qgjd89qr-a2G4oUgz
|
||||||
|
- DB_CONNECTION=pg
|
||||||
|
- PG_HOST=postgres
|
||||||
|
- PG_PORT=5432
|
||||||
|
- PG_USER=postgres
|
||||||
|
- PG_PASSWORD=1234
|
||||||
|
- PG_DB_NAME=educt
|
||||||
|
- REDIS_CONNECTION=local
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
- REDIS_PORT=6379
|
||||||
|
- REDIS_PASSWORD=
|
||||||
|
- SMTP_HOST=localhost
|
||||||
|
- SMTP_PORT=587
|
||||||
|
- SMTP_USERNAME=<username>
|
||||||
|
- SMTP_PASSWORD=<password>
|
||||||
|
- MAILGUN_API_KEY=<key>
|
||||||
|
- MAILGUN_DOMAIN=<domain>
|
||||||
|
- CACHE_VIEWS=false
|
||||||
|
- DRIVE_DISK=local
|
||||||
|
- S3_KEY=<key>
|
||||||
|
- S3_SECRET=<secret>
|
||||||
|
- S3_BUCKET=<bucket>
|
||||||
|
- S3_REGION=<region>
|
||||||
|
volumes:
|
||||||
|
- uploads:/home/node/app/uploads
|
||||||
|
command: ['dumb-init', 'node', 'server.js']
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
postgres:
|
||||||
|
container_name: postgres
|
||||||
|
image: postgres:14
|
||||||
|
volumes:
|
||||||
|
- postgres_volume:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: 1234
|
||||||
|
POSTGRES_DB: educt
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
redis:
|
||||||
|
container_name: redis
|
||||||
|
image: redis:6-alpine
|
||||||
|
volumes:
|
||||||
|
- redis_volume:/data
|
||||||
|
ports:
|
||||||
|
- 6379:6379
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
volumes:
|
||||||
|
postgres_volume:
|
||||||
|
redis_volume:
|
||||||
|
uploads:
|
||||||
|
networks:
|
||||||
|
app-network:
|
||||||
|
driver: bridge
|
||||||
1
educt-client
Submodule
1
educt-client
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 4e72abee410a9ef889384211ecb3379926385aff
|
||||||
1
educt-server
Submodule
1
educt-server
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 793d7d650a0b99c1eec8e3d7b3e153ff8de20392
|
||||||
29
nginx/default.conf
Normal file
29
nginx/default.conf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://client:5000;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api {
|
||||||
|
proxy_pass http://api:3333;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection 'upgrade';
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user