Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion develop/dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCSTORE_HOST=docstore
DOCUMENT_UPDATER_HOST=document-updater
FILESTORE_HOST=filestore
GRACEFUL_SHUTDOWN_DELAY_SECONDS=0
HISTORY_V1_HOST=history-v1
V1_HISTORY_HOST=history-v1
HISTORY_REDIS_HOST=redis
LISTEN_ADDRESS=0.0.0.0
MONGO_HOST=mongo
Expand Down
16 changes: 15 additions & 1 deletion server-ce/config/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,23 @@ export DOCSTORE_HOST=127.0.0.1
export DOCUMENT_UPDATER_HOST=127.0.0.1
export DOCUPDATER_HOST=127.0.0.1
export FILESTORE_HOST=127.0.0.1
export HISTORY_V1_HOST=127.0.0.1
export V1_HISTORY_HOST=127.0.0.1
export NOTIFICATIONS_HOST=127.0.0.1
export PROJECT_HISTORY_HOST=127.0.0.1
export REALTIME_HOST=127.0.0.1
export WEB_HOST=127.0.0.1
export WEB_API_HOST=127.0.0.1

export CHAT_PORT=3010
export CLSI_PORT=3013
export DOCSTORE_PORT=3016
export DOCUMENT_UPDATER_PORT=3003
export FILESTORE_PORT=3009
export V1_HISTORY_PORT=3100
export NOTIFICATIONS_PORT=3042
export PROJECT_HISTORY_PORT=3054
export REALTIME_PORT=3026
export WEB_PORT=3000



15 changes: 12 additions & 3 deletions server-ce/config/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,25 @@ const settings = {

apis: {
web: {
url: 'http://127.0.0.1:3000',
url: `http://${
process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'}:${
process.env.WEB_API_PORT || process.env.WEB_PORT || 3000
}`,
user: httpAuthUser,
pass: httpAuthPass,
},
project_history: {
sendProjectStructureOps: true,
url: 'http://127.0.0.1:3054',
url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:${
process.env.PROJECT_HISTORY_PORT || 3054
}`,
},
v1_history: {
url: process.env.V1_HISTORY_URL || 'http://127.0.0.1:3100/api',
url:
process.env.V1_HISTORY_URL ||
`http://${process.env.V1_HISTORY_HOST || '127.0.0.1'}:${
process.env.V1_HISTORY_PORT || '3100'
}/api`,
user: 'staging',
pass: process.env.STAGING_PASSWORD,
requestTimeout: parseInt(
Expand Down
4 changes: 2 additions & 2 deletions server-ce/nginx/overleaf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ server {
}

location / {
proxy_pass http://127.0.0.1:4000;
proxy_pass http://127.0.0.1:${WEB_PORT};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Expand All @@ -22,7 +22,7 @@ server {
}

location /socket.io {
proxy_pass http://127.0.0.1:3026;
proxy_pass http://127.0.0.1:${REALTIME_PORT};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Expand Down
1 change: 1 addition & 0 deletions server-ce/runit/chat-overleaf/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ fi

source /etc/overleaf/env.sh
export LISTEN_ADDRESS=127.0.0.1
export CHAT_PORT=3010

exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/chat/app.js >> /var/log/overleaf/chat.log 2>&1
1 change: 1 addition & 0 deletions server-ce/runit/clsi-overleaf/run
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ fi

source /etc/overleaf/env.sh
export LISTEN_ADDRESS=127.0.0.1
export CLSI_PORT=3013

exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/clsi/app.js >> /var/log/overleaf/clsi.log 2>&1
1 change: 1 addition & 0 deletions server-ce/runit/docstore-overleaf/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ fi

source /etc/overleaf/env.sh
export LISTEN_ADDRESS=127.0.0.1
export DOCSTORE_PORT=3016

exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/docstore/app.js >> /var/log/overleaf/docstore.log 2>&1
1 change: 1 addition & 0 deletions server-ce/runit/document-updater-overleaf/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ fi

source /etc/overleaf/env.sh
export LISTEN_ADDRESS=127.0.0.1
export DOCUMENT_UPDATER_PORT=3003

exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/document-updater/app.js >> /var/log/overleaf/document-updater.log 2>&1
1 change: 1 addition & 0 deletions server-ce/runit/filestore-overleaf/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

source /etc/overleaf/env.sh
export LISTEN_ADDRESS=127.0.0.1
export FILESTORE_PORT=3009

exec /sbin/setuser www-data /usr/bin/node /overleaf/services/filestore/app.js >> /var/log/overleaf/filestore.log 2>&1
1 change: 1 addition & 0 deletions server-ce/runit/notifications-overleaf/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ fi

source /etc/overleaf/env.sh
export LISTEN_ADDRESS=127.0.0.1
export NOTIFICATIONS_PORT=3042

exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/notifications/app.ts >> /var/log/overleaf/notifications.log 2>&1
1 change: 1 addition & 0 deletions server-ce/runit/project-history-overleaf/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ fi

source /etc/overleaf/env.sh
export LISTEN_ADDRESS=127.0.0.1
export PROJECT_HISTORY_PORT=3054

exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/project-history/app.js >> /var/log/overleaf/project-history.log 2>&1
1 change: 1 addition & 0 deletions server-ce/runit/real-time-overleaf/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

source /etc/overleaf/env.sh
export LISTEN_ADDRESS=127.0.0.1
export REALTIME_PORT=3026

exec /sbin/setuser www-data /usr/bin/node /overleaf/services/real-time/app.js >> /var/log/overleaf/real-time.log 2>&1
2 changes: 1 addition & 1 deletion services/chat/config/settings.defaults.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
internal: {
chat: {
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
port: 3010,
port: process.env.CHAT_PORT || 3010,
},
},

Expand Down
3 changes: 2 additions & 1 deletion services/chat/test/acceptance/js/helpers/ChatApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export async function ensureRunning() {
if (!serverPromise) {
const { app } = await createServer()
const startServer = promisify(app.listen.bind(app))
serverPromise = startServer(3010, '127.0.0.1')
const port = Number(process.env.CHAT_PORT || 3010)
serverPromise = startServer(port, '127.0.0.1')
}
return serverPromise
}
Expand Down
14 changes: 10 additions & 4 deletions services/clsi/config/settings.defaults.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = {

internal: {
clsi: {
port: 3013,
port: process.env.CLSI_PORT || 3013,
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},

Expand All @@ -56,15 +56,19 @@ module.exports = {
apis: {
clsi: {
// Internal requests (used by tests only at the time of writing).
url: `http://${process.env.CLSI_HOST || '127.0.0.1'}:3013`,
url: `http://${process.env.CLSI_HOST || '127.0.0.1'}:${
process.env.CLSI_PORT || 3013
}`,
// External url prefix for output files, e.g. for requests via load-balancers.
outputUrlPrefix: `${process.env.ZONE ? `/zone/${process.env.ZONE}` : ''}`,
clsiServerId: process.env.CLSI_SERVER_ID || CLSI_SERVER_ID,
instanceType: process.env.INSTANCE_TYPE,
zone: process.env.ZONE,
isSpotInstance,

downloadHost: process.env.DOWNLOAD_HOST || 'http://localhost:8080',
downloadHost: `http://${process.env.DOWNLOAD_HOST || '127.0.0.1'}:${
process.env.DOWNLOAD_PORT || 8080
}`,
},
clsiPerf: {
host: `${process.env.CLSI_PERF_HOST || '127.0.0.1'}:${
Expand All @@ -84,7 +88,9 @@ module.exports = {
filestore: {
url:
process.env.FILESTORE_DOMAIN_OVERRIDE ||
`http://${process.env.FILESTORE_HOST || '127.0.0.1'}:3009`,
`http://${process.env.FILESTORE_HOST || '127.0.0.1'}:${
process.env.FILESTORE_PORT || 3009
}`,
},
},

Expand Down
2 changes: 1 addition & 1 deletion services/docstore/config/settings.defaults.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ https.globalAgent.keepAlive = false
const Settings = {
internal: {
docstore: {
port: 3016,
port: process.env.DOCSTORE_PORT || 3016,
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
Expand Down
1 change: 1 addition & 0 deletions services/document-updater/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ for (const eventName of events) {
}

const port =
process.env.DOCUMENT_UPDATER_PORT ||
Settings.internal.documentupdater.port ||
(Settings.api &&
Settings.api.documentupdater &&
Expand Down
6 changes: 4 additions & 2 deletions services/document-updater/config/settings.defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
internal: {
documentupdater: {
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
port: 3003,
port: process.env.DOCUMENT_UPDATER_PORT || 3003,
},
},

Expand All @@ -21,7 +21,9 @@ module.exports = {
pass: process.env.WEB_API_PASSWORD || 'password',
},
project_history: {
url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:3054`,
url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:${
process.env.PROJECT_HISTORY_PORT || 3054
}`,
},
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function updateDocVersionInRedis(docId, redisDoc, mongoDoc) {
async function fixPartiallyDeletedDocMetadata(projectId, docId, pathname) {
try {
await fetchNothing(
`http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016/project/${projectId}/doc/${docId}`,
`http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:${process.env.DOCSTORE_PORT || 3016}/project/${projectId}/doc/${docId}`,
{
method: 'PATCH',
signal: AbortSignal.timeout(60_000),
Expand All @@ -102,7 +102,7 @@ async function getDocFromMongo(projectId, docId) {
let docstoreDoc
try {
docstoreDoc = await fetchJson(
`http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016/project/${projectId}/doc/${docId}/peek`,
`http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:${process.env.DOCSTORE_PORT || 3016}/project/${projectId}/doc/${docId}/peek`,
{ signal: AbortSignal.timeout(60_000) }
)
} catch (err) {
Expand All @@ -111,7 +111,7 @@ async function getDocFromMongo(projectId, docId) {
let deletedDocName
try {
const body = await fetchJson(
`http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016/project/${projectId}/doc-deleted`,
`http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:${process.env.DOCSTORE_PORT || 3016}/project/${projectId}/doc-deleted`,
{ signal: AbortSignal.timeout(60_000) }
)
deletedDocName = body.find(doc => doc._id === docId)?.name
Expand Down
2 changes: 1 addition & 1 deletion services/filestore/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ app.get('/health_check', (req, res) => {

app.use(RequestLogger.errorHandler)

const port = settings.internal.filestore.port || 3009
const port = Number(process.env.FILESTORE_PORT || settings.internal.filestore.port || 3009)
const host = settings.internal.filestore.host || '0.0.0.0'

let server = null
Expand Down
2 changes: 1 addition & 1 deletion services/filestore/config/settings.defaults.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (process.env.BACKEND == null) {
const settings = {
internal: {
filestore: {
port: 3009,
port: process.env.FILESTORE_PORT || 3009,
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
Expand Down
2 changes: 1 addition & 1 deletion services/history-v1/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ app.setup = async function appSetup() {
async function startApp() {
await app.setup()

const port = parseInt(process.env.PORT, 10) || 3100
const port = parseInt(process.env.V1_HISTORY_PORT, 10) || 3100
app.listen(port, err => {
if (err) {
console.error(err)
Expand Down
2 changes: 1 addition & 1 deletion services/history-v1/storage/scripts/expire_redis_chunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const optionDefinitions = [
const options = commandLineArgs(optionDefinitions)
const DRY_RUN = options['dry-run'] || false
const POST_REQUEST = options['post-request'] || false
const HISTORY_V1_URL = `http://${process.env.HISTORY_V1_HOST || 'localhost'}:${process.env.PORT || 3100}`
const HISTORY_V1_URL = `http://${process.env.V1_HISTORY_HOST || 'localhost'}:${process.env.V1_HISTORY_PORT || 3100}`

logger.initialize('expire-redis-chunks')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const DRY_RUN = options['dry-run'] || false
const USE_QUEUE = options.queue || false
const MAX_TIME = options['max-time'] || null
const MIN_RATE = options['min-rate']
const HISTORY_V1_URL = `http://${process.env.HISTORY_V1_HOST || 'localhost'}:${process.env.PORT || 3100}`
const HISTORY_V1_URL = `http://${process.env.V1_HISTORY_HOST || 'localhost'}:${process.env.PORT || 3100}`
let isShuttingDown = false

logger.initialize('persist-redis-chunks')
Expand Down
2 changes: 1 addition & 1 deletion services/notifications/config/settings.defaults.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
internal: {
notifications: {
port: 3042,
port: process.env.NOTIFICATIONS_PORT || 3042,
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
Expand Down
23 changes: 16 additions & 7 deletions services/project-history/config/settings.defaults.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,26 @@ module.exports = {
},
internal: {
history: {
port: 3054,
port: process.env.PROJECT_HISTORY_PORT || 3054,
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
apis: {
documentupdater: {
url: `http://${process.env.DOCUPDATER_HOST || '127.0.0.1'}:3003`,
url: `http://${process.env.DOCUPDATER_HOST || '127.0.0.1'}:${
process.env.DOCUMENT_UPDATER_PORT || 3003
}`,
},
docstore: {
url: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
url: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:${
process.env.DOCSTORE_PORT || 3016
}`,
},
filestore: {
enabled: process.env.FILESTORE_ENABLED !== 'false',
url: `http://${process.env.FILESTORE_HOST || '127.0.0.1'}:3009`,
url: `http://${process.env.FILESTORE_HOST || '127.0.0.1'}:${
process.env.FILESTORE_PORT || 3009
}`,
},
web: {
url: `http://${
Expand All @@ -42,7 +48,9 @@ module.exports = {
),
},
project_history: {
url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:3054`,
url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:${
process.env.PROJECT_HISTORY_PORT || 3054
}`,
},
},
redis: {
Expand Down Expand Up @@ -89,8 +97,9 @@ module.exports = {
`http://${
process.env.V1_HISTORY_HOST ||
process.env.HISTORY_V1_HOST ||
'127.0.0.1'
}:3100/api`,
'127.0.0.1'}:${
process.env.V1_HISTORY_PORT || 3100
}/api`,
user: process.env.V1_HISTORY_USER || 'staging',
pass: process.env.V1_HISTORY_PASSWORD || 'password',
sync: {
Expand Down
7 changes: 4 additions & 3 deletions services/real-time/config/settings.defaults.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const settings = {

internal: {
realTime: {
port: 3026,
port: process.env.REALTIME_PORT || 3026,
host: process.env.LISTEN_ADDRESS || '127.0.0.1',
},
},
Expand All @@ -107,8 +107,9 @@ const settings = {
url: `http://${
process.env.DOCUMENT_UPDATER_HOST ||
process.env.DOCUPDATER_HOST ||
'127.0.0.1'
}:3003`,
'127.0.0.1'}:${
process.env.DOCUMENT_UPDATER_PORT || 3003
}`,
},
},

Expand Down
Loading