changed folder structure

This commit is contained in:
Sergey Yarkov 2023-03-22 23:53:02 +03:00
parent b8c9607874
commit 6f4275d477
No known key found for this signature in database
GPG Key ID: E91CE1FABC619B6F
30 changed files with 105 additions and 136 deletions

View File

@ -1,22 +1,38 @@
version: '3.8'
services:
web:
restart: 'always'
build:
context: .
target: development
context: ./website
target: production
network: host
container_name: web
volumes:
- './:/app'
network_mode: host
- './website/nginx/conf.d:/etc/nginx/conf.d:rw'
networks:
- directus
ports:
- '80'
depends_on:
- directus
- nginx
environment:
- DIRECTUS_URL=http://localhost:8055
- DIRECTUS_EMAIL=admin@example.com
- DIRECTUS_PASSWORD=d1r3ctu5
- DIRECTUS_STATIC_TOKEN=
nginx:
container_name: nginx
image: nginx:1.23.3-alpine
volumes:
- './nginx/nginx.conf:/etc/nginx/nginx.conf'
ports:
- '80:80'
depends_on:
- directus
networks:
- directus
database:
image: postgres:15-alpine
container_name: database
@ -31,10 +47,16 @@ services:
networks:
- directus
# cache:
# container_name: cache
# image: redis:6
# networks:
# - directus
directus:
image: directus/directus:latest
ports:
- '8055:8055'
- 8055:8055
volumes:
- uploads:/directus/uploads
depends_on:
@ -54,6 +76,10 @@ services:
DB_USER: 'directus'
DB_PASSWORD: 'directus'
# CACHE_ENABLED: 'false'
# CACHE_STORE: 'redis'
# CACHE_REDIS: 'redis://cache:6379'
ADMIN_EMAIL: 'admin@example.com'
ADMIN_PASSWORD: 'd1r3ctu5'
volumes:

View File

@ -1,70 +0,0 @@
version: '3.8'
services:
web:
build:
context: .
target: production
container_name: web
volumes:
- './nginx/conf.d:/etc/nginx/conf.d'
- './nginx/nginx.conf:/etc/nginx/nginx.conf'
ports:
- '80:80'
networks:
- directus
depends_on:
- directus
database:
image: postgres:15-alpine
container_name: database
environment:
POSTGRES_USER: directus
POSTGRES_PASSWORD: directus
POSTGRES_DB: directus
volumes:
- db-data:/var/lib/postgresql/data
ports:
- 5432:5432
networks:
- directus
cache:
container_name: cache
image: redis:6
networks:
- directus
directus:
image: directus/directus:latest
ports:
- 8055
volumes:
- uploads:/directus/uploads
depends_on:
- cache
- database
networks:
- directus
environment:
KEY: '255d861b-5ea1-5996-9aa3-922530ec40b1'
SECRET: '6116487b-cda1-52c2-b5b5-c8022c45e263'
DB_CLIENT: 'pg'
DB_HOST: 'database'
DB_PORT: '5432'
DB_DATABASE: 'directus'
DB_USER: 'directus'
DB_PASSWORD: 'directus'
CACHE_ENABLED: 'true'
CACHE_STORE: 'redis'
CACHE_REDIS: 'redis://cache:6379'
ADMIN_EMAIL: 'admin@example.com'
ADMIN_PASSWORD: 'd1r3ctu5'
volumes:
db-data:
uploads:
networks:
directus:

View File

@ -1,52 +0,0 @@
server_tokens off;
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
location ~* \.(css|js|png|jpe?g|wepb|ico|gif|svg)$ {
add_header Cache-Control "public";
access_log off;
expires 30d;
}
}
error_page 500 502 503 504 /50x.html;
error_page 404 /404.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
server {
listen 80;
listen [::]:80;
client_max_body_size 100M;
server_name cms.localhost;
location / {
proxy_pass http://directus:8055;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_connect_timeout 30s;
proxy_read_timeout 86400s;
proxy_send_timeout 30s;
proxy_http_version 1.1;
add_header X-Cache $upstream_cache_status;
}
}

View File

@ -4,11 +4,7 @@ worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
events { worker_connections 1024; }
http {
include /etc/nginx/mime.types;
@ -25,5 +21,49 @@ http {
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
server_tokens off;
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
proxy_pass http://web:80;
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-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 80;
listen [::]:80;
client_max_body_size 100M;
server_name cms.localhost;
location / {
proxy_pass http://directus:8055;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_connect_timeout 30s;
proxy_read_timeout 86400s;
proxy_send_timeout 30s;
proxy_http_version 1.1;
add_header X-Cache $upstream_cache_status;
}
}
}

View File

@ -1,2 +1,3 @@
node_modules/
uploads/
uploads/
dist/

View File

@ -17,13 +17,13 @@ EXPOSE 3000
CMD [ "npm", "start" ]
FROM development as builder
WORKDIR /app
RUN npm run build
FROM ${NGINX_IMAGE} as production
COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=builder /app/nginx/conf.d /etc/nginx/conf.d
COPY --from=builder /app/nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80

View File

@ -0,0 +1,24 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
location ~* \.(css|js|png|jpe?g|wepb|ico|gif|svg)$ {
add_header Cache-Control "public";
access_log off;
expires 30d;
}
}
error_page 500 502 503 504 /50x.html;
error_page 404 /404.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View File

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 873 B