From 2bf86d8ea7c84768cb5a7d48693fa0a860c57d0d Mon Sep 17 00:00:00 2001 From: mserranom Date: Wed, 7 Aug 2019 08:47:05 +0000 Subject: [PATCH 1/3] Revive overleaf community --- server-ce/Dockerfile | 89 ++++++++++++++++-------- server-ce/Dockerfile-base | 48 +++++++++---- server-ce/runit/real-time-sharelatex/run | 2 +- server-ce/settings.coffee | 4 +- 4 files changed, 98 insertions(+), 45 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 881d48cfe6..c527411457 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -1,51 +1,80 @@ -# Sharelatex Community Edition (sharelatex/sharelatex) +# --------------------------------------------- +# Overleaf Community Edition (overleaf/overleaf) +# --------------------------------------------- FROM sharelatex/sharelatex-base:latest ENV baseDir . -# Install sharelatex settings file + +# Install app settings files +# -------------------------- ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee -ADD ${baseDir}/runit /etc/service -RUN rm /etc/nginx/sites-enabled/default -ADD ${baseDir}/nginx/nginx.conf /etc/nginx/nginx.conf -ADD ${baseDir}/nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf +# Checkout Overleaf Community Edition repo +# ---------------------------------------- +RUN git clone https://github.com/overleaf/overleaf.git \ + --depth 1 /var/www/sharelatex -ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex -COPY ${baseDir}/init_scripts/ /etc/my_init.d/ - -# Install ShareLaTeX -RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex - -ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js +# Install dependencies needed to run configuration scripts +# -------------------------------------------------------- ADD ${baseDir}/package.json /var/www/package.json ADD ${baseDir}/git-revision.js /var/www/git-revision.js RUN cd /var/www && npm install -RUN cd /var/www/sharelatex; \ - npm install; \ - grunt install; \ - bash -c 'source ./bin/install-services'; \ - cd web; \ - npm install; \ - npm install bcrypt; \ - cd modules; \ - git clone https://github.com/sharelatex/launchpad-web-module.git launchpad; \ - grunt compile; +# Replace overleaf/config/services.js with the list of available +# services in Overleaf Community Edition +# -------------------------------------------------------------- +ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js + + +# Checkout services +# ----------------- +RUN cd /var/www/sharelatex && \ + npm install && grunt install; + + +# install and compile services +# ---------------------------- +RUN bash -c 'cd /var/www/sharelatex && source ./bin/install-services' +RUN bash -c 'cd /var/www/sharelatex && source ./bin/compile-services' + + +# Change application ownership to www-data +# ---------------------------------------- +RUN chown -R www-data:www-data /var/www/sharelatex; + + +# Copy runit service startup scripts to its location +# -------------------------------------------------- +ADD ${baseDir}/runit /etc/service + + +# Configure nginx +# --------------- +RUN rm /etc/nginx/sites-enabled/default +ADD ${baseDir}/nginx/nginx.conf /etc/nginx/nginx.conf +ADD ${baseDir}/nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf + + +# Configure log rotation +# ---------------------- +ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex + + +# Copy Phusion Image startup scripts to its location +# -------------------------------------------------- +COPY ${baseDir}/init_scripts/ /etc/my_init.d/ + + +# Stores the version installed for each service +# --------------------------------------------- RUN cd /var/www && node git-revision > revisions.txt - -# Minify js assets -RUN cd /var/www/sharelatex/web; \ - grunt compile:minify; -RUN cd /var/www/sharelatex/clsi; \ - grunt compile:bin; \ - chown -R www-data:www-data /var/www/sharelatex; EXPOSE 80 diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index a59431fc9d..f1a7e22531 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -1,41 +1,63 @@ +# -------------------------------------------------- # Sharelatex Base Image (sharelatex/sharelatex-base) +# -------------------------------------------------- -FROM phusion/baseimage:0.9.16 +FROM phusion/baseimage:0.11 ENV baseDir . -RUN apt-get update -RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo bash - -RUN apt-get install -y build-essential wget nodejs unzip time imagemagick optipng strace nginx git python zlib1g-dev libpcre3-dev aspell aspell-en aspell-af aspell-am aspell-ar aspell-ar-large aspell-bg aspell-bn aspell-br aspell-ca aspell-cs aspell-cy aspell-da aspell-de aspell-de-alt aspell-el aspell-eo aspell-es aspell-et aspell-eu-es aspell-fa aspell-fo aspell-fr aspell-ga aspell-gl-minimos aspell-gu aspell-he aspell-hi aspell-hr aspell-hsb aspell-hu aspell-hy aspell-id aspell-is aspell-it aspell-kk aspell-kn aspell-ku aspell-lt aspell-lv aspell-ml aspell-mr aspell-nl aspell-no aspell-nr aspell-ns aspell-or aspell-pa aspell-pl aspell-pt-br aspell-ro aspell-ru aspell-sk aspell-sl aspell-ss aspell-st aspell-sv aspell-ta aspell-te aspell-tl aspell-tn aspell-ts aspell-uk aspell-uz aspell-xh aspell-zu +# Install dependencies +# -------------------- +RUN apt-get update +RUN apt-get install -y sudo +RUN apt-get install -y build-essential wget net-tools unzip time imagemagick optipng strace nginx git python zlib1g-dev libpcre3-dev aspell aspell-en + + +# Install qpdf +# ------------ WORKDIR /opt RUN wget https://s3.amazonaws.com/sharelatex-random-files/qpdf-6.0.0.tar.gz && tar xzf qpdf-6.0.0.tar.gz WORKDIR /opt/qpdf-6.0.0 RUN ./configure && make && make install && ldconfig + +# Install Node +# ------------ +RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - +RUN apt-get install -y nodejs +RUN npm install -g grunt-cli + + +# Install Node6 (required by some services) +# ----------------------------------------- +RUN wget https://nodejs.org/dist/v6.17.1/node-v6.17.1-linux-x64.tar.gz && \ + mkdir -p /opt/nodejs && tar -xzf node-v6.17.1-linux-x64.tar.gz -C /opt/nodejs/ && \ + cd /opt/nodejs && mv node-v6.17.1-linux-x64 6.17.1 && \ + ln -s /opt/nodejs/6.17.1/bin/node /usr/bin/node6 + + # Install TexLive -RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ +# --------------- +RUN wget https://ctan.crest.fr/tex-archive/systems/texlive/tlnet/install-tl-unx.tar.gz; \ mkdir /install-tl-unx; \ tar -xvf install-tl-unx.tar.gz -C /install-tl-unx --strip-components=1 - RUN echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile; \ - /install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile - + /install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile \ + -repository http://tug.ctan.org/systems/texlive/tlnet/ RUN rm -r /install-tl-unx; \ rm install-tl-unx.tar.gz - -ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2017/bin/x86_64-linux/ +ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2019/bin/x86_64-linux/ RUN tlmgr install latexmk RUN tlmgr install texcount -RUN npm install -g grunt-cli # Set up sharelatex user and home directory +# ----------------------------------------- RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex; \ mkdir -p /var/lib/sharelatex; \ chown www-data:www-data /var/lib/sharelatex; \ mkdir -p /var/log/sharelatex; \ chown www-data:www-data /var/log/sharelatex; \ mkdir -p /var/lib/sharelatex/data/template_files; \ - chown www-data:www-data /var/lib/sharelatex/data/template_files; - + chown www-data:www-data /var/lib/sharelatex/data/template_files; \ No newline at end of file diff --git a/server-ce/runit/real-time-sharelatex/run b/server-ce/runit/real-time-sharelatex/run index c57d1d489e..7168368c38 100755 --- a/server-ce/runit/real-time-sharelatex/run +++ b/server-ce/runit/real-time-sharelatex/run @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/real-time/app.js >> /var/log/sharelatex/real-time.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node6 /var/www/sharelatex/real-time/app.js >> /var/log/sharelatex/real-time.log 2>&1 \ No newline at end of file diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 7f4f18067f..92a545eac7 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -22,6 +22,8 @@ TMP_DIR = '/var/lib/sharelatex/tmp' settings = + brandPrefix: "" + allowAnonymousReadAndWriteSharing: process.env['SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING'] == 'true' @@ -169,7 +171,7 @@ settings = # Should javascript assets be served minified or not. Note that you will # need to run `grunt compile:minify` within the web-sharelatex directory # to generate these. - useMinifiedJs: true + useMinifiedJs: false # Should static assets be sent with a header to tell the browser to cache # them. This should be false in development where changes are being made, From 28772d6d2518cdef2f1c8ca78ad4a303ddcb5387 Mon Sep 17 00:00:00 2001 From: mserranom Date: Wed, 7 Aug 2019 08:52:55 +0000 Subject: [PATCH 2/3] added missing aspell languages --- server-ce/Dockerfile-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index f1a7e22531..2f88946bdd 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -11,7 +11,7 @@ ENV baseDir . # -------------------- RUN apt-get update RUN apt-get install -y sudo -RUN apt-get install -y build-essential wget net-tools unzip time imagemagick optipng strace nginx git python zlib1g-dev libpcre3-dev aspell aspell-en +RUN apt-get install -y build-essential wget net-tools unzip time imagemagick optipng strace nginx git python zlib1g-dev libpcre3-dev aspell aspell-en aspell-af aspell-am aspell-ar aspell-ar-large aspell-bg aspell-bn aspell-br aspell-ca aspell-cs aspell-cy aspell-da aspell-de aspell-el aspell-eo aspell-es aspell-et aspell-eu-es aspell-fa aspell-fo aspell-fr aspell-ga aspell-gl-minimos aspell-gu aspell-he aspell-hi aspell-hr aspell-hsb aspell-hu aspell-hy aspell-id aspell-is aspell-it aspell-kk aspell-kn aspell-ku aspell-lt aspell-lv aspell-ml aspell-mr aspell-nl aspell-nr aspell-ns aspell-pa aspell-pl aspell-pt aspell-pt-br aspell-ro aspell-ru aspell-sk aspell-sl aspell-ss aspell-st aspell-sv aspell-tl aspell-tn aspell-ts aspell-uk aspell-uz aspell-xh aspell-zu # Install qpdf From 803f920b550c51c87f52fee1bf250e306430621f Mon Sep 17 00:00:00 2001 From: mserranom Date: Thu, 8 Aug 2019 10:44:14 +0000 Subject: [PATCH 3/3] addressed PR comments --- server-ce/.editorconfig | 9 +++++++++ server-ce/Dockerfile-base | 23 +++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 server-ce/.editorconfig diff --git a/server-ce/.editorconfig b/server-ce/.editorconfig new file mode 100644 index 0000000000..9d08a1a828 --- /dev/null +++ b/server-ce/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index 2f88946bdd..aed92b21b8 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -39,12 +39,11 @@ RUN wget https://nodejs.org/dist/v6.17.1/node-v6.17.1-linux-x64.tar.gz && \ # Install TexLive # --------------- -RUN wget https://ctan.crest.fr/tex-archive/systems/texlive/tlnet/install-tl-unx.tar.gz; \ - mkdir /install-tl-unx; \ +RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \ + mkdir /install-tl-unx && \ tar -xvf install-tl-unx.tar.gz -C /install-tl-unx --strip-components=1 -RUN echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile; \ - /install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile \ - -repository http://tug.ctan.org/systems/texlive/tlnet/ +RUN echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile && \ + /install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile RUN rm -r /install-tl-unx; \ rm install-tl-unx.tar.gz ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2019/bin/x86_64-linux/ @@ -54,10 +53,10 @@ RUN tlmgr install texcount # Set up sharelatex user and home directory # ----------------------------------------- -RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex; \ - mkdir -p /var/lib/sharelatex; \ - chown www-data:www-data /var/lib/sharelatex; \ - mkdir -p /var/log/sharelatex; \ - chown www-data:www-data /var/log/sharelatex; \ - mkdir -p /var/lib/sharelatex/data/template_files; \ - chown www-data:www-data /var/lib/sharelatex/data/template_files; \ No newline at end of file +RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex && \ + mkdir -p /var/lib/sharelatex && \ + chown www-data:www-data /var/lib/sharelatex && \ + mkdir -p /var/log/sharelatex && \ + chown www-data:www-data /var/log/sharelatex && \ + mkdir -p /var/lib/sharelatex/data/template_files && \ + chown www-data:www-data /var/lib/sharelatex/data/template_files