🐳 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
# User-specific stuff:
@@ -47,18 +43,12 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Ruby plugin and RubyMine
/.rakeTasks
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
@@ -90,8 +80,6 @@ fabric.properties
/app/config/parameters.ini
# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
@@ -102,10 +90,6 @@ fabric.properties
/web/upload/
/web/public/
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data
/build/
/builds/
@@ -132,9 +116,6 @@ docker-compose.yml
/app/Ressources/DatabaseEncryption/.Halite.key
/backend/websockets_server/false/
### AWS ###
/app/config/aws_config.yml
### Test ###
/tests/code_coverage/
/web/detached/*
+30 -12
View File
@@ -12,25 +12,20 @@ services:
- tdrive_network
node:
image: tdrive/tdrive-node
container_name: node
build:
context: .
dockerfile: docker/tdrive-node/Dockerfile
target: production
container_name: tdrive-node
hostname: tdrive_node
ports:
- 4000:3000
- 8000:3000
- 4000:4000
- 9229:9229
environment:
- DEV=dev
- SEARCH_DRIVER=mongodb
- DB_DRIVER=mongodb
- 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/
depends_on:
- mongo
@@ -39,6 +34,29 @@ services:
networks:
- 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:
tdrive_network:
driver: bridge
+31 -6
View File
@@ -6,21 +6,46 @@ services:
image: mongo
volumes:
- ./docker-data/mongo:/data/db
networks:
- tdrive_network
node:
image: tdrive/tdrive-node:latest
ports:
- 3000:3000
- 8000:3000
image: docker-registry.linagora.com/tdrive/tdrive-node
hostname: tdrive_node
environment:
- DEV=production
- SEARCH_DRIVER=mongodb
- DB_DRIVER=mongodb
- PUBSUB_TYPE=local
volumes:
- ./configuration/backend-node/production.json:/usr/src/app/config/production.json
- ./docker-data/documents/:/storage/
depends_on:
- mongo
links:
- 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
NODE_HOST="${NODE_HOST:-http://node:3000}"
PHP_UPSTREAM="${PHP_UPSTREAM:-php:9000}"
export NODE_HOST
export PHP_UPSTREAM
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;"
-11
View File
@@ -97,15 +97,4 @@ server {
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/ .
#Install dev dependancies for build
RUN NODE_ENV=development npm install && \
RUN export NODE_ENV=development
RUN npm install
#Build in production mode
export NODE_ENV=production && \
npm run build && \
rm -rf node_modules && \
RUN export NODE_ENV=production
RUN npm run build
RUN rm -rf node_modules
#Install prod dependancies after build
npm install --legacy-peer-deps
RUN npm install --legacy-peer-deps
# Development Stage
FROM installed-libs as development