Merge pull request #6567 from overleaf/jpa-server-ce-pro-layout

[misc] align directory layout of server-ce/pro with production docker images

GitOrigin-RevId: d3e6b9f8793e83df59f86105d511c6fb87c3eea3
This commit is contained in:
Jakob Ackermann 2022-02-01 16:39:55 +00:00 committed by Copybot
parent 347649ebaa
commit d5dd92c034
18 changed files with 28 additions and 45 deletions

View file

@ -5,13 +5,13 @@
ARG SHARELATEX_BASE_TAG=sharelatex/sharelatex-base:latest
FROM $SHARELATEX_BASE_TAG
WORKDIR /var/www/sharelatex
WORKDIR /overleaf
# Add required source files
# -------------------------
ADD server-ce/genScript.js /var/www/sharelatex/genScript.js
ADD server-ce/services.js /var/www/sharelatex/services.js
ADD services/ /var/www/sharelatex/
ADD server-ce/genScript.js /overleaf/genScript.js
ADD server-ce/services.js /overleaf/services.js
ADD services/ /overleaf/services/
# Store the revision
# ------------------

View file

@ -68,7 +68,7 @@ RUN mkdir /install-tl-unx \
# Set up sharelatex user and home directory
# -----------------------------------------
RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex && \
RUN adduser --system --group --home /overleaf --no-create-home sharelatex && \
mkdir -p /var/lib/sharelatex && \
chown www-data:www-data /var/lib/sharelatex && \
mkdir -p /var/log/sharelatex && \

View file

@ -5,23 +5,23 @@ set -e
TASK="$1"
shift 1
cd /var/www/sharelatex/web/modules/server-ce-scripts/scripts
cd /overleaf/services/web
case "$TASK" in
user:create-admin)
node create-user --admin "$@"
node modules/server-ce-scripts/scripts/create-user --admin "$@"
;;
user:delete)
node delete-user "$@"
node modules/server-ce-scripts/scripts/delete-user "$@"
;;
check:mongo)
node check-mongodb
node modules/server-ce-scripts/scripts/check-mongodb
;;
check:redis)
node check-redis
node modules/server-ce-scripts/scripts/check-redis
;;
*)

View file

@ -4,26 +4,9 @@ console.log('#!/bin/bash')
console.log('set -ex')
switch (process.argv.pop()) {
case 'checkout':
for (const service of services) {
console.log(`git clone ${service.repo} ${service.name}`)
console.log(`git -C ${service.name} checkout ${service.version}`)
}
break
case 'revisions':
for (const service of services) {
console.log(`echo -n /var/www/sharelatex/${service.name},`)
console.log(`git -C ${service.name} rev-parse HEAD`)
}
break
case 'cleanup-git':
for (const service of services) {
console.log(`rm -rf ${service.name}/.git`)
}
break
case 'install':
for (const service of services) {
console.log('pushd', service.name)
console.log('pushd', `services/${service.name}`)
switch (service.name) {
case 'web':
console.log('npm ci')
@ -37,7 +20,7 @@ switch (process.argv.pop()) {
break
case 'compile':
for (const service of services) {
console.log('pushd', service.name)
console.log('pushd', `services/${service.name}`)
switch (service.name) {
case 'web':
console.log('npm run webpack:production')

View file

@ -2,7 +2,7 @@
set -e
echo "Checking can connect to mongo and redis"
cd /var/www/sharelatex/web/modules/server-ce-scripts/scripts
node check-mongodb
node check-redis
cd /overleaf/services/web
node modules/server-ce-scripts/scripts/check-mongodb
node modules/server-ce-scripts/scripts/check-redis
echo "All checks passed"

View file

@ -8,6 +8,6 @@ else
fi
echo "Running migrations for $environment"
cd /var/www/sharelatex/web
cd /overleaf/services/web
npm run migrations -- migrate -t "$environment"
echo "Finished migrations"

View file

@ -2,7 +2,7 @@ server {
listen 80;
server_name _; # Catch all, see http://nginx.org/en/docs/http/server_names.html
root /var/www/sharelatex/web/public/;
root /overleaf/services/web/public/;
location / {
proxy_pass http://127.0.0.1:3000;

View file

@ -6,4 +6,4 @@ if [ "$DEBUG_NODE" == "true" ]; then
NODE_PARAMS="--inspect=0.0.0.0:30100"
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/chat/app.js >> /var/log/sharelatex/chat.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/chat/app.js >> /var/log/sharelatex/chat.log 2>&1

View file

@ -15,4 +15,4 @@ if [ -e '/var/run/docker.sock' ]; then
usermod -aG dockeronhost www-data
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/clsi/app.js >> /var/log/sharelatex/clsi.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/clsi/app.js >> /var/log/sharelatex/clsi.log 2>&1

View file

@ -6,4 +6,4 @@ if [ "$DEBUG_NODE" == "true" ]; then
NODE_PARAMS="--inspect=0.0.0.0:30360"
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/contacts/app.js >> /var/log/sharelatex/contacts.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/contacts/app.js >> /var/log/sharelatex/contacts.log 2>&1

View file

@ -6,4 +6,4 @@ if [ "$DEBUG_NODE" == "true" ]; then
NODE_PARAMS="--inspect=0.0.0.0:30160"
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/docstore/app.js >> /var/log/sharelatex/docstore.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/docstore/app.js >> /var/log/sharelatex/docstore.log 2>&1

View file

@ -6,4 +6,4 @@ if [ "$DEBUG_NODE" == "true" ]; then
NODE_PARAMS="--inspect=0.0.0.0:30030"
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/document-updater/app.js >> /var/log/sharelatex/document-updater.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/document-updater/app.js >> /var/log/sharelatex/document-updater.log 2>&1

View file

@ -1,2 +1,2 @@
#!/bin/bash
exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1
exec /sbin/setuser www-data /usr/bin/node /overleaf/services/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1

View file

@ -6,4 +6,4 @@ if [ "$DEBUG_NODE" == "true" ]; then
NODE_PARAMS="--inspect=0.0.0.0:30420"
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/notifications/app.js >> /var/log/sharelatex/notifications.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/notifications/app.js >> /var/log/sharelatex/notifications.log 2>&1

View file

@ -1,2 +1,2 @@
#!/bin/bash
exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/real-time/app.js >> /var/log/sharelatex/real-time.log 2>&1
exec /sbin/setuser www-data /usr/bin/node /overleaf/services/real-time/app.js >> /var/log/sharelatex/real-time.log 2>&1

View file

@ -6,4 +6,4 @@ if [ "$DEBUG_NODE" == "true" ]; then
NODE_PARAMS="--inspect=0.0.0.0:30050"
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/spelling/app.js >> /var/log/sharelatex/spelling.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/spelling/app.js >> /var/log/sharelatex/spelling.log 2>&1

View file

@ -6,4 +6,4 @@ if [ "$DEBUG_NODE" == "true" ]; then
NODE_PARAMS="--inspect=0.0.0.0:30150"
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/track-changes/app.js >> /var/log/sharelatex/track-changes.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/track-changes/app.js >> /var/log/sharelatex/track-changes.log 2>&1

View file

@ -6,4 +6,4 @@ if [ "$DEBUG_NODE" == "true" ]; then
NODE_PARAMS="--inspect=0.0.0.0:30000"
fi
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/web/app.js >> /var/log/sharelatex/web.log 2>&1
exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/web/app.js >> /var/log/sharelatex/web.log 2>&1