Эх сурвалжийг харах

Merge pull request #11914 from overleaf/ae-develop-project-history

Add project-history and history-v1 to Server CE dev environment

GitOrigin-RevId: 611173e5d489a175dd9945f59cab59692bd5ea39
Alf Eaton 3 жил өмнө
parent
commit
cff49bd9c1

+ 2 - 0
develop/dev.env

@@ -5,9 +5,11 @@ DOCSTORE_HOST=docstore
 DOCUMENT_UPDATER_HOST=document-updater
 FILESTORE_HOST=filestore
 GRACEFUL_SHUTDOWN_DELAY=0
+HISTORY_V1_HOST=history-v1
 LISTEN_ADDRESS=0.0.0.0
 MONGO_HOST=mongo
 NOTIFICATIONS_HOST=notifications
+PROJECT_HISTORY_HOST=project-history
 REALTIME_HOST=real-time
 REDIS_HOST=redis
 SPELLING_HOST=spelling

+ 25 - 0
develop/docker-compose.dev.yml

@@ -65,6 +65,20 @@ services:
       - ../services/filestore/app.js:/overleaf/services/filestore/app.js
       - ../services/filestore/config:/overleaf/services/filestore/config
 
+  history-v1:
+    command: [ "npm", "run", "nodemon" ]
+    environment:
+      - NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
+    ports:
+      - "127.0.0.1:9239:9229"
+    volumes:
+      - ../services/history-v1/api:/overleaf/services/history-v1/api
+      - ../services/history-v1/app.js:/overleaf/services/history-v1/app.js
+      - ../services/history-v1/config:/overleaf/services/history-v1/config
+      - ../services/history-v1/storage:/overleaf/services/history-v1/storage
+      - ../services/history-v1/knexfile.js:/overleaf/services/history-v1/knexfile.js
+      - ../services/history-v1/migrations:/overleaf/services/history-v1/migrations
+
   notifications:
     command: ["npm", "run", "nodemon"]
     environment:
@@ -76,6 +90,17 @@ services:
       - ../services/notifications/app.js:/overleaf/services/notifications/app.js
       - ../services/notifications/config:/overleaf/services/notifications/config
 
+  project-history:
+    command: [ "npm", "run", "nodemon" ]
+    environment:
+      - NODE_APP_OPTIONS=--inspect=0.0.0.0:9229
+    ports:
+      - "127.0.0.1:9240:9229"
+    volumes:
+      - ../services/project-history/app:/overleaf/services/project-history/app
+      - ../services/project-history/app.js:/overleaf/services/project-history/app.js
+      - ../services/project-history/config:/overleaf/services/project-history/config
+
   real-time:
     command: ["npm", "run", "nodemon"]
     environment:

+ 26 - 0
develop/docker-compose.yml

@@ -10,6 +10,7 @@ volumes:
   sharelatex-data:
   spelling-cache:
   web-data:
+  history-v1-buckets:
 
 services:
   chat:
@@ -71,6 +72,22 @@ services:
       - filestore-uploads:/overleaf/services/filestore/uploads
       - filestore-user-files:/overleaf/services/filestore/user_files
 
+  history-v1:
+    build:
+      context: ..
+      dockerfile: services/history-v1/Dockerfile
+    env_file:
+        - dev.env
+    environment:
+      OVERLEAF_EDITOR_ANALYTICS_BUCKET: "/buckets/analytics"
+      OVERLEAF_EDITOR_BLOBS_BUCKET: "/buckets/blobs"
+      OVERLEAF_EDITOR_CHUNKS_BUCKET: "/buckets/chunks"
+      OVERLEAF_EDITOR_PROJECT_BLOBS_BUCKET: "/buckets/project_blobs"
+      OVERLEAF_EDITOR_ZIPS_BUCKET: "/buckets/zips"
+      PERSISTOR_BACKEND: fs
+    volumes:
+        - history-v1-buckets:/buckets
+
   mongo:
     image: mongo:4.4
     ports:
@@ -85,6 +102,13 @@ services:
     env_file:
       - dev.env
 
+  project-history:
+    build:
+      context: ..
+      dockerfile: services/project-history/Dockerfile
+    env_file:
+        - dev.env
+
   real-time:
     build:
       context: ..
@@ -141,7 +165,9 @@ services:
       - docstore
       - document-updater
       - filestore
+      - history-v1
       - notifications
+      - project-history
       - real-time
       - spelling
 

+ 3 - 0
services/history-v1/Dockerfile

@@ -10,6 +10,9 @@ WORKDIR /overleaf/services/history-v1
 # (see https://googleapis.dev/nodejs/storage/latest/File.html#createWriteStream)
 RUN mkdir /home/node/.config && chown node:node /home/node/.config
 
+# fs persistor needs a writable folder as a target for the mounted volume
+RUN mkdir /buckets && chown node:node /buckets
+
 FROM base as app
 
 COPY package.json package-lock.json /overleaf/

+ 6 - 0
services/web/config/settings.defaults.js

@@ -204,6 +204,12 @@ module.exports = {
       backendGroupName: undefined,
       defaultBackendClass: process.env.CLSI_DEFAULT_BACKEND_CLASS || 'e2',
     },
+    project_history: {
+      sendProjectStructureOps: true,
+      initializeHistoryForNewProjects: true,
+      displayHistoryForNewProjects: true,
+      url: `http://${process.env.PROJECT_HISTORY_HOST || 'localhost'}:3054`,
+    },
     realTime: {
       url: `http://${process.env.REALTIME_HOST || 'localhost'}:3026`,
     },