mirror of
https://github.com/sergeyyarkov/astro-directus-example.git
synced 2026-10-11 10:19:04 +03:00
changed folder structure
This commit is contained in:
parent
b8c9607874
commit
6f4275d477
@ -1,22 +1,38 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
restart: 'always'
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: ./website
|
||||||
target: development
|
target: production
|
||||||
|
network: host
|
||||||
container_name: web
|
container_name: web
|
||||||
volumes:
|
volumes:
|
||||||
- './:/app'
|
- './website/nginx/conf.d:/etc/nginx/conf.d:rw'
|
||||||
network_mode: host
|
networks:
|
||||||
|
- directus
|
||||||
|
ports:
|
||||||
|
- '80'
|
||||||
depends_on:
|
depends_on:
|
||||||
- directus
|
- directus
|
||||||
|
- nginx
|
||||||
environment:
|
environment:
|
||||||
- DIRECTUS_URL=http://localhost:8055
|
- DIRECTUS_URL=http://localhost:8055
|
||||||
- DIRECTUS_EMAIL=admin@example.com
|
- DIRECTUS_EMAIL=admin@example.com
|
||||||
- DIRECTUS_PASSWORD=d1r3ctu5
|
- DIRECTUS_PASSWORD=d1r3ctu5
|
||||||
- DIRECTUS_STATIC_TOKEN=
|
- 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:
|
database:
|
||||||
image: postgres:15-alpine
|
image: postgres:15-alpine
|
||||||
container_name: database
|
container_name: database
|
||||||
@ -31,10 +47,16 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- directus
|
- directus
|
||||||
|
|
||||||
|
# cache:
|
||||||
|
# container_name: cache
|
||||||
|
# image: redis:6
|
||||||
|
# networks:
|
||||||
|
# - directus
|
||||||
|
|
||||||
directus:
|
directus:
|
||||||
image: directus/directus:latest
|
image: directus/directus:latest
|
||||||
ports:
|
ports:
|
||||||
- '8055:8055'
|
- 8055:8055
|
||||||
volumes:
|
volumes:
|
||||||
- uploads:/directus/uploads
|
- uploads:/directus/uploads
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -54,6 +76,10 @@ services:
|
|||||||
DB_USER: 'directus'
|
DB_USER: 'directus'
|
||||||
DB_PASSWORD: 'directus'
|
DB_PASSWORD: 'directus'
|
||||||
|
|
||||||
|
# CACHE_ENABLED: 'false'
|
||||||
|
# CACHE_STORE: 'redis'
|
||||||
|
# CACHE_REDIS: 'redis://cache:6379'
|
||||||
|
|
||||||
ADMIN_EMAIL: 'admin@example.com'
|
ADMIN_EMAIL: 'admin@example.com'
|
||||||
ADMIN_PASSWORD: 'd1r3ctu5'
|
ADMIN_PASSWORD: 'd1r3ctu5'
|
||||||
volumes:
|
volumes:
|
||||||
@ -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:
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,11 +4,7 @@ worker_processes auto;
|
|||||||
error_log /var/log/nginx/error.log notice;
|
error_log /var/log/nginx/error.log notice;
|
||||||
pid /var/run/nginx.pid;
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
events { worker_connections 1024; }
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
http {
|
http {
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
@ -25,5 +21,49 @@ http {
|
|||||||
|
|
||||||
keepalive_timeout 65;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,2 +1,3 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
uploads/
|
uploads/
|
||||||
|
dist/
|
||||||
@ -17,13 +17,13 @@ EXPOSE 3000
|
|||||||
CMD [ "npm", "start" ]
|
CMD [ "npm", "start" ]
|
||||||
|
|
||||||
FROM development as builder
|
FROM development as builder
|
||||||
|
WORKDIR /app
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM ${NGINX_IMAGE} as production
|
FROM ${NGINX_IMAGE} as production
|
||||||
|
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
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/conf.d /etc/nginx/conf.d
|
||||||
COPY --from=builder /app/nginx/nginx.conf /etc/nginx/nginx.conf
|
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
24
website/nginx/conf.d/default.conf
Normal file
24
website/nginx/conf.d/default.conf
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 873 B After Width: | Height: | Size: 873 B |
0
src/env.d.ts → website/src/env.d.ts
vendored
0
src/env.d.ts → website/src/env.d.ts
vendored
Loading…
x
Reference in New Issue
Block a user