🐳 Set up envs for the TDrive (#19)

- remove php upstream from nginx config
- fix docker-compose configuration
This commit is contained in:
Anton Shepilov
2023-04-13 15:27:10 +02:00
committed by GitHub
parent e0615fa867
commit 01630194fc
7 changed files with 75 additions and 57 deletions
-19
View File
@@ -1,7 +1,3 @@
### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
*.DS_Store *.DS_Store
# User-specific stuff: # User-specific stuff:
@@ -47,18 +43,12 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin # Cursive Clojure plugin
.idea/replstate.xml .idea/replstate.xml
# Ruby plugin and RubyMine
/.rakeTasks
# Crashlytics plugin (for Android Studio and IntelliJ) # Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml com_crashlytics_export_strings.xml
crashlytics.properties crashlytics.properties
crashlytics-build.properties crashlytics-build.properties
fabric.properties fabric.properties
### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml # *.iml
# modules.xml # modules.xml
# .idea/misc.xml # .idea/misc.xml
@@ -90,8 +80,6 @@ fabric.properties
/app/config/parameters.ini /app/config/parameters.ini
# Managed by Composer # Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/* /bin/*
!bin/console !bin/console
!bin/symfony_requirements !bin/symfony_requirements
@@ -102,10 +90,6 @@ fabric.properties
/web/upload/ /web/upload/
/web/public/ /web/public/
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data # Build data
/build/ /build/
/builds/ /builds/
@@ -132,9 +116,6 @@ docker-compose.yml
/app/Ressources/DatabaseEncryption/.Halite.key /app/Ressources/DatabaseEncryption/.Halite.key
/backend/websockets_server/false/ /backend/websockets_server/false/
### AWS ###
/app/config/aws_config.yml
### Test ### ### Test ###
/tests/code_coverage/ /tests/code_coverage/
/web/detached/* /web/detached/*
+30 -12
View File
@@ -12,25 +12,20 @@ services:
- tdrive_network - tdrive_network
node: node:
image: tdrive/tdrive-node build:
container_name: node context: .
dockerfile: docker/tdrive-node/Dockerfile
target: production
container_name: tdrive-node
hostname: tdrive_node
ports: ports:
- 4000:3000 - 4000:4000
- 8000:3000
- 9229:9229 - 9229:9229
environment: environment:
- DEV=dev - DEV=dev
- SEARCH_DRIVER=mongodb - SEARCH_DRIVER=mongodb
- DB_DRIVER=mongodb - DB_DRIVER=mongodb
- PUBSUB_TYPE=local - PUBSUB_TYPE=local
- STATIC_ROOT=/frontend
build:
context: .
dockerfile: docker/tdrive-node/Dockerfile
target: development
volumes:
- ./backend/node:/usr/src/app
- ./frontend/dist:/frontend
- ./docker-data/documents/:/storage/ - ./docker-data/documents/:/storage/
depends_on: depends_on:
- mongo - mongo
@@ -39,6 +34,29 @@ services:
networks: networks:
- tdrive_network - tdrive_network
fronend:
build:
context: .
dockerfile: docker/tdrive-frontend/Dockerfile
container_name: tdrive_frontend
environment:
- DEV=production
- SSL_CERTS=selfsigned
- NODE_HOST=http://tdrive_node:4000
ports:
- 80:80
- 443:443
depends_on:
- node
volumes:
- ./docker-data/logs/nginx/:/var/log/nginx
- ./docker-data/letsencrypt/:/etc/letsencrypt/
- ./docker-data/drive-preview/:/tdrive-core/web/medias/
- ./docker-data/uploads/:/tdrive-core/web/upload/
- ./docker-data/ssl:/etc/nginx/ssl
networks:
- tdrive_network
networks: networks:
tdrive_network: tdrive_network:
driver: bridge driver: bridge
+31 -6
View File
@@ -6,21 +6,46 @@ services:
image: mongo image: mongo
volumes: volumes:
- ./docker-data/mongo:/data/db - ./docker-data/mongo:/data/db
networks:
- tdrive_network
node: node:
image: tdrive/tdrive-node:latest image: docker-registry.linagora.com/tdrive/tdrive-node
ports: hostname: tdrive_node
- 3000:3000
- 8000:3000
environment: environment:
- DEV=production - DEV=production
- SEARCH_DRIVER=mongodb - SEARCH_DRIVER=mongodb
- DB_DRIVER=mongodb - DB_DRIVER=mongodb
- PUBSUB_TYPE=local - PUBSUB_TYPE=local
volumes:
- ./configuration/backend-node/production.json:/usr/src/app/config/production.json
- ./docker-data/documents/:/storage/ - ./docker-data/documents/:/storage/
depends_on: depends_on:
- mongo - mongo
links: links:
- mongo - mongo
networks:
- tdrive_network
fronend:
image: docker-registry.linagora.com/tdrive/tdrive-frontend
environment:
- DEV=production
- SSL_CERTS=selfsigned
- NODE_HOST=http://tdrive_node:4000
ports:
- 80:80
- 443:443
depends_on:
- node
volumes:
- ./docker-data/logs/nginx/:/var/log/nginx
- ./docker-data/letsencrypt/:/etc/letsencrypt/
- ./docker-data/drive-preview/:/tdrive-core/web/medias/
- ./docker-data/uploads/:/tdrive-core/web/upload/
- ./docker-data/ssl:/etc/nginx/ssl
networks:
- tdrive_network
networks:
tdrive_network:
driver: bridge
+6
View File
@@ -0,0 +1,6 @@
FROM ubuntu
RUN apt-get update && \
apt-get install -y iputils-ping && \
apt-get install -y telnet && \
apt-get install -y wget
CMD bash
@@ -39,10 +39,8 @@ case $SSL_CERTS in
esac esac
NODE_HOST="${NODE_HOST:-http://node:3000}" NODE_HOST="${NODE_HOST:-http://node:3000}"
PHP_UPSTREAM="${PHP_UPSTREAM:-php:9000}"
export NODE_HOST export NODE_HOST
export PHP_UPSTREAM export PHP_UPSTREAM
envsubst '$${NODE_HOST} $${NGINX_LISTEN}' < /etc/nginx/sites-available/site.template > /etc/nginx/sites-enabled/site envsubst '$${NODE_HOST} $${NGINX_LISTEN}' < /etc/nginx/sites-available/site.template > /etc/nginx/sites-enabled/site
echo "upstream php-upstream { server ${PHP_UPSTREAM}; }" > /etc/nginx/conf.d/upstream.conf
nginx -g "daemon off;" nginx -g "daemon off;"
-11
View File
@@ -97,15 +97,4 @@ server {
rewrite ^(.*)$ /app.php/$1 last; rewrite ^(.*)$ /app.php/$1 last;
} }
location ~ ^/(app|app_dev|config|dev\/.*)\.php(/|$) {
fastcgi_pass php-upstream;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
}
} }
+6 -5
View File
@@ -28,13 +28,14 @@ FROM node-base as installed-libs
COPY backend/node/ . COPY backend/node/ .
#Install dev dependancies for build #Install dev dependancies for build
RUN NODE_ENV=development npm install && \ RUN export NODE_ENV=development
RUN npm install
#Build in production mode #Build in production mode
export NODE_ENV=production && \ RUN export NODE_ENV=production
npm run build && \ RUN npm run build
rm -rf node_modules && \ RUN rm -rf node_modules
#Install prod dependancies after build #Install prod dependancies after build
npm install --legacy-peer-deps RUN npm install --legacy-peer-deps
# Development Stage # Development Stage
FROM installed-libs as development FROM installed-libs as development