first commit
This commit is contained in:
3
develop/.gitignore
vendored
Normal file
3
develop/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/compiles/*
|
||||
!.gitkeep
|
||||
.env
|
89
develop/README.md
Normal file
89
develop/README.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# Overleaf Community Edition, development environment
|
||||
|
||||
## Building and running
|
||||
|
||||
In this `develop` directory, build the services:
|
||||
|
||||
```shell
|
||||
bin/build
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> If Docker is running out of RAM while building the services in parallel, create a `.env` file in this directory containing `COMPOSE_PARALLEL_LIMIT=1`.
|
||||
|
||||
Then start the services:
|
||||
|
||||
```shell
|
||||
bin/up
|
||||
```
|
||||
|
||||
Once the services are running, open <http://localhost/launchpad> to create the first admin account.
|
||||
|
||||
## TeX Live
|
||||
|
||||
Compiling a PDF requires building a TeX Live image to handle the compilation inside Docker:
|
||||
|
||||
```shell
|
||||
docker build texlive -t texlive-full
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> To compile on a macOS host, you may need to override the path to the Docker socket by creating a `.env` file in this directory, containing
|
||||
> `DOCKER_SOCKET_PATH=/var/run/docker.sock.raw`
|
||||
|
||||
## Development
|
||||
|
||||
To avoid running `bin/build && bin/up` after every code change, you can run Overleaf
|
||||
Community Edition in _development mode_, where services will automatically update on code changes.
|
||||
|
||||
To do this, use the included `bin/dev` script:
|
||||
|
||||
```shell
|
||||
bin/dev
|
||||
```
|
||||
|
||||
This will start all services using `nodemon`, which will automatically monitor the code and restart the services as necessary.
|
||||
|
||||
To improve performance, you can start only a subset of the services in development mode by providing a space-separated list to the `bin/dev` script:
|
||||
|
||||
```shell
|
||||
bin/dev [service1] [service2] ... [serviceN]
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Starting the `web` service in _development mode_ will only update the `web`
|
||||
> service when backend code changes. In order to automatically update frontend
|
||||
> code as well, make sure to start the `webpack` service in _development mode_
|
||||
> as well.
|
||||
|
||||
If no services are named, all services will start in development mode.
|
||||
|
||||
## Debugging
|
||||
|
||||
When run in _development mode_ most services expose a debugging port to which
|
||||
you can attach a debugger such as
|
||||
[the inspector in Chrome's Dev Tools](chrome://inspect/) or one integrated into
|
||||
an IDE. The following table shows the port exposed on the **host machine** for
|
||||
each service:
|
||||
|
||||
| Service | Port |
|
||||
| ------------------ | ---- |
|
||||
| `web` | 9229 |
|
||||
| `clsi` | 9230 |
|
||||
| `chat` | 9231 |
|
||||
| `contacts` | 9232 |
|
||||
| `docstore` | 9233 |
|
||||
| `document-updater` | 9234 |
|
||||
| `filestore` | 9235 |
|
||||
| `notifications` | 9236 |
|
||||
| `real-time` | 9237 |
|
||||
| `history-v1` | 9239 |
|
||||
| `project-history` | 9240 |
|
||||
|
||||
To attach to a service using Chrome's _remote debugging_, go to
|
||||
<chrome://inspect/> and make sure _Discover network targets_ is checked. Next
|
||||
click _Configure..._ and add an entry `localhost:[service port]` for each of the
|
||||
services you want to attach a debugger to.
|
||||
|
||||
After adding an entry, the service will show up as a _Remote Target_ that you
|
||||
can inspect and debug.
|
3
develop/bin/build
Executable file
3
develop/bin/build
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker compose build --pull "$@"
|
3
develop/bin/dev
Executable file
3
develop/bin/dev
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --no-deps --detach "$@"
|
3
develop/bin/down
Executable file
3
develop/bin/down
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker compose down "$@"
|
9
develop/bin/logs
Executable file
9
develop/bin/logs
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker compose logs --follow --tail 10 --no-color "$@" \
|
||||
| ggrep --line-buffered --invert-match "global.gc" \
|
||||
| ggrep --line-buffered --invert-match "health.check" \
|
||||
| ggrep --line-buffered --invert-match "slow event loop" \
|
||||
| ggrep --line-buffered --invert-match "process.memoryUsage" \
|
||||
| ggrep --line-buffered --only-matching "[{].*" \
|
||||
| bunyan --output short
|
3
develop/bin/shell
Executable file
3
develop/bin/shell
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker compose exec -it "$@" /bin/bash
|
3
develop/bin/up
Executable file
3
develop/bin/up
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker compose up --detach "$@"
|
0
develop/compiles/.gitkeep
Normal file
0
develop/compiles/.gitkeep
Normal file
20
develop/dev.env
Normal file
20
develop/dev.env
Normal file
@@ -0,0 +1,20 @@
|
||||
CHAT_HOST=chat
|
||||
CLSI_HOST=clsi
|
||||
CONTACTS_HOST=contacts
|
||||
DOCSTORE_HOST=docstore
|
||||
DOCUMENT_UPDATER_HOST=document-updater
|
||||
FILESTORE_HOST=filestore
|
||||
GRACEFUL_SHUTDOWN_DELAY_SECONDS=0
|
||||
HISTORY_V1_HOST=history-v1
|
||||
LISTEN_ADDRESS=0.0.0.0
|
||||
MONGO_HOST=mongo
|
||||
MONGO_URL=mongodb://mongo/sharelatex?directConnection=true
|
||||
NOTIFICATIONS_HOST=notifications
|
||||
PROJECT_HISTORY_HOST=project-history
|
||||
REALTIME_HOST=real-time
|
||||
REDIS_HOST=redis
|
||||
SESSION_SECRET=foo
|
||||
WEBPACK_HOST=webpack
|
||||
WEB_API_PASSWORD=overleaf
|
||||
WEB_API_USER=overleaf
|
||||
WEB_HOST=web
|
139
develop/docker-compose.dev.yml
Normal file
139
develop/docker-compose.dev.yml
Normal file
@@ -0,0 +1,139 @@
|
||||
services:
|
||||
clsi:
|
||||
command: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9230:9229"
|
||||
volumes:
|
||||
- ../services/clsi/app:/overleaf/services/clsi/app
|
||||
- ../services/clsi/app.js:/overleaf/services/clsi/app.js
|
||||
- ../services/clsi/config:/overleaf/services/clsi/config
|
||||
|
||||
chat:
|
||||
command: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9231:9229"
|
||||
volumes:
|
||||
- ../services/chat/app:/overleaf/services/chat/app
|
||||
- ../services/chat/app.js:/overleaf/services/chat/app.js
|
||||
- ../services/chat/config:/overleaf/services/chat/config
|
||||
|
||||
contacts:
|
||||
command: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9232:9229"
|
||||
volumes:
|
||||
- ../services/contacts/app:/overleaf/services/contacts/app
|
||||
- ../services/contacts/app.js:/overleaf/services/contacts/app.js
|
||||
- ../services/contacts/config:/overleaf/services/contacts/config
|
||||
|
||||
docstore:
|
||||
command: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9233:9229"
|
||||
volumes:
|
||||
- ../services/docstore/app:/overleaf/services/docstore/app
|
||||
- ../services/docstore/app.js:/overleaf/services/docstore/app.js
|
||||
- ../services/docstore/config:/overleaf/services/docstore/config
|
||||
|
||||
document-updater:
|
||||
command: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9234:9229"
|
||||
volumes:
|
||||
- ../services/document-updater/app:/overleaf/services/document-updater/app
|
||||
- ../services/document-updater/app.js:/overleaf/services/document-updater/app.js
|
||||
- ../services/document-updater/config:/overleaf/services/document-updater/config
|
||||
|
||||
filestore:
|
||||
command: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9235:9229"
|
||||
volumes:
|
||||
- ../services/filestore/app:/overleaf/services/filestore/app
|
||||
- ../services/filestore/app.js:/overleaf/services/filestore/app.js
|
||||
- ../services/filestore/config:/overleaf/services/filestore/config
|
||||
|
||||
history-v1:
|
||||
command: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_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: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9236:9229"
|
||||
volumes:
|
||||
- ../services/notifications/app:/overleaf/services/notifications/app
|
||||
- ../services/notifications/app.js:/overleaf/services/notifications/app.js
|
||||
- ../services/notifications/config:/overleaf/services/notifications/config
|
||||
|
||||
project-history:
|
||||
command: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_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: ["node", "--watch", "app.js"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9237:9229"
|
||||
volumes:
|
||||
- ../services/real-time/app:/overleaf/services/real-time/app
|
||||
- ../services/real-time/app.js:/overleaf/services/real-time/app.js
|
||||
- ../services/real-time/config:/overleaf/services/real-time/config
|
||||
|
||||
web:
|
||||
command: ["node", "--watch", "app.js", "--watch-locales"]
|
||||
environment:
|
||||
- NODE_OPTIONS=--inspect=0.0.0.0:9229
|
||||
ports:
|
||||
- "127.0.0.1:9229:9229"
|
||||
volumes:
|
||||
- ../services/web/app:/overleaf/services/web/app
|
||||
- ../services/web/app.mjs:/overleaf/services/web/app.mjs
|
||||
- ../services/web/config:/overleaf/services/web/config
|
||||
- ../services/web/locales:/overleaf/services/web/locales
|
||||
- ../services/web/modules:/overleaf/services/web/modules
|
||||
- ../services/web/public:/overleaf/services/web/public
|
||||
|
||||
webpack:
|
||||
volumes:
|
||||
- ../services/web/app:/overleaf/services/web/app
|
||||
- ../services/web/config:/overleaf/services/web/config
|
||||
- ../services/web/frontend:/overleaf/services/web/frontend
|
||||
- ../services/web/locales:/overleaf/services/web/locales
|
||||
- ../services/web/modules:/overleaf/services/web/modules
|
||||
- ../services/web/public:/overleaf/services/web/public
|
||||
- ../services/web/transform:/overleaf/services/web/transform
|
||||
- ../services/web/types:/overleaf/services/web/types
|
||||
- ../services/web/webpack-plugins:/overleaf/services/web/webpack-plugins
|
175
develop/docker-compose.yml
Normal file
175
develop/docker-compose.yml
Normal file
@@ -0,0 +1,175 @@
|
||||
volumes:
|
||||
clsi-cache:
|
||||
clsi-output:
|
||||
filestore-public-files:
|
||||
filestore-template-files:
|
||||
filestore-uploads:
|
||||
filestore-user-files:
|
||||
mongo-data:
|
||||
redis-data:
|
||||
sharelatex-data:
|
||||
web-data:
|
||||
history-v1-buckets:
|
||||
|
||||
services:
|
||||
chat:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/chat/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
|
||||
clsi:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/clsi/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
environment:
|
||||
- DOCKER_RUNNER=true
|
||||
- TEXLIVE_IMAGE=texlive-full # docker build texlive -t texlive-full
|
||||
- COMPILES_HOST_DIR=${PWD}/compiles
|
||||
- OUTPUT_HOST_DIR=${PWD}/output
|
||||
user: root
|
||||
volumes:
|
||||
- ${PWD}/compiles:/overleaf/services/clsi/compiles
|
||||
- ${DOCKER_SOCKET_PATH:-/var/run/docker.sock}:/var/run/docker.sock
|
||||
- clsi-cache:/overleaf/services/clsi/cache
|
||||
- clsi-output:/overleaf/services/clsi/output
|
||||
|
||||
contacts:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/contacts/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
|
||||
docstore:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/docstore/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
|
||||
document-updater:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/document-updater/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
|
||||
filestore:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/filestore/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
# environment:
|
||||
# - ENABLE_CONVERSIONS=true
|
||||
volumes:
|
||||
- filestore-public-files:/overleaf/services/filestore/public_files
|
||||
- filestore-template-files:/overleaf/services/filestore/template_files
|
||||
- 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:6.0
|
||||
command: --replSet overleaf
|
||||
ports:
|
||||
- "127.0.0.1:27017:27017" # for debugging
|
||||
volumes:
|
||||
- mongo-data:/data/db
|
||||
- ../bin/shared/mongodb-init-replica-set.js:/docker-entrypoint-initdb.d/mongodb-init-replica-set.js
|
||||
environment:
|
||||
MONGO_INITDB_DATABASE: sharelatex
|
||||
extra_hosts:
|
||||
# Required when using the automatic database setup for initializing the
|
||||
# replica set. This override is not needed when running the setup after
|
||||
# starting up mongo.
|
||||
- mongo:127.0.0.1
|
||||
|
||||
notifications:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/notifications/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
|
||||
project-history:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/project-history/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
|
||||
real-time:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/real-time/Dockerfile
|
||||
env_file:
|
||||
- dev.env
|
||||
|
||||
redis:
|
||||
image: redis:5
|
||||
ports:
|
||||
- "127.0.0.1:6379:6379" # for debugging
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
|
||||
web:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/web/Dockerfile
|
||||
target: dev
|
||||
env_file:
|
||||
- dev.env
|
||||
environment:
|
||||
- APP_NAME=Overleaf Community Edition
|
||||
- ENABLED_LINKED_FILE_TYPES=project_file,project_output_file
|
||||
- EMAIL_CONFIRMATION_DISABLED=true
|
||||
- NODE_ENV=development
|
||||
- OVERLEAF_ALLOW_PUBLIC_ACCESS=true
|
||||
command: ["node", "app.mjs"]
|
||||
volumes:
|
||||
- sharelatex-data:/var/lib/overleaf
|
||||
- web-data:/overleaf/services/web/data
|
||||
depends_on:
|
||||
- mongo
|
||||
- redis
|
||||
- chat
|
||||
- clsi
|
||||
- contacts
|
||||
- docstore
|
||||
- document-updater
|
||||
- filestore
|
||||
- history-v1
|
||||
- notifications
|
||||
- project-history
|
||||
- real-time
|
||||
|
||||
webpack:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: services/web/Dockerfile
|
||||
target: webpack
|
||||
command: ["npx", "webpack", "serve", "--config", "webpack.config.dev-env.js"]
|
||||
ports:
|
||||
- "127.0.0.1:80:3808"
|
||||
volumes:
|
||||
- ./webpack.config.dev-env.js:/overleaf/services/web/webpack.config.dev-env.js
|
8
develop/texlive/Dockerfile
Normal file
8
develop/texlive/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
FROM debian:testing-slim
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-cache depends texlive-full | grep "Depends: " | grep -v -- "-doc" | grep -v -- "-lang-" | sed 's/Depends: //' | xargs apt-get install -y --no-install-recommends
|
||||
RUN apt-get install -y --no-install-recommends fontconfig inkscape pandoc python3-pygments
|
||||
|
||||
RUN useradd tex
|
||||
USER tex
|
23
develop/webpack.config.dev-env.js
Normal file
23
develop/webpack.config.dev-env.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const { merge } = require('webpack-merge')
|
||||
|
||||
const base = require('./webpack.config.dev')
|
||||
|
||||
module.exports = merge(base, {
|
||||
devServer: {
|
||||
allowedHosts: 'auto',
|
||||
devMiddleware: {
|
||||
index: false,
|
||||
},
|
||||
proxy: [
|
||||
{
|
||||
context: '/socket.io/**',
|
||||
target: 'http://real-time:3026',
|
||||
ws: true,
|
||||
},
|
||||
{
|
||||
context: ['!**/*.js', '!**/*.css', '!**/*.json'],
|
||||
target: 'http://web:3000',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user