From 97ea2b6aa1e7c3bd015092fd240ae6a67a2f23b6 Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 6 Feb 2015 17:01:50 +0000 Subject: [PATCH 001/182] Initial Dockerfile image build --- server-ce/00_make_sharelatex_data_dirs.sh | 21 + server-ce/00_regen_sharelatex_secrets.sh | 7 + server-ce/Dockerfile | 81 ++++ server-ce/README.md | 70 +++ server-ce/nginx/nginx.conf | 74 +++ server-ce/nginx/sharelatex.conf | 45 ++ server-ce/runit/chat-sharelatex.sh | 3 + server-ce/runit/clsi-sharelatex.sh | 3 + server-ce/runit/docstore-sharelatex.sh | 3 + .../runit/document-updater-sharelatex.sh | 3 + server-ce/runit/filestore-sharelatex.sh | 3 + server-ce/runit/nginx.sh | 2 + server-ce/runit/real-time-sharelatex.sh | 3 + server-ce/runit/spelling-sharelatex.sh | 3 + server-ce/runit/tags-sharelatex.sh | 3 + server-ce/runit/track-changes-sharelatex.sh | 3 + server-ce/runit/web-sharelatex.sh | 3 + server-ce/settings.coffee | 422 ++++++++++++++++++ 18 files changed, 752 insertions(+) create mode 100755 server-ce/00_make_sharelatex_data_dirs.sh create mode 100755 server-ce/00_regen_sharelatex_secrets.sh create mode 100644 server-ce/Dockerfile create mode 100644 server-ce/README.md create mode 100644 server-ce/nginx/nginx.conf create mode 100644 server-ce/nginx/sharelatex.conf create mode 100755 server-ce/runit/chat-sharelatex.sh create mode 100755 server-ce/runit/clsi-sharelatex.sh create mode 100755 server-ce/runit/docstore-sharelatex.sh create mode 100755 server-ce/runit/document-updater-sharelatex.sh create mode 100755 server-ce/runit/filestore-sharelatex.sh create mode 100755 server-ce/runit/nginx.sh create mode 100755 server-ce/runit/real-time-sharelatex.sh create mode 100755 server-ce/runit/spelling-sharelatex.sh create mode 100755 server-ce/runit/tags-sharelatex.sh create mode 100755 server-ce/runit/track-changes-sharelatex.sh create mode 100755 server-ce/runit/web-sharelatex.sh create mode 100644 server-ce/settings.coffee diff --git a/server-ce/00_make_sharelatex_data_dirs.sh b/server-ce/00_make_sharelatex_data_dirs.sh new file mode 100755 index 0000000000..f8d424f201 --- /dev/null +++ b/server-ce/00_make_sharelatex_data_dirs.sh @@ -0,0 +1,21 @@ +#!/bin/sh +mkdir -p /var/lib/sharelatex/data +chown sharelatex:sharelatex /var/lib/sharelatex/data + +mkdir -p /var/lib/sharelatex/data/user_files +chown sharelatex:sharelatex /var/lib/sharelatex/data/user_files + +mkdir -p /var/lib/sharelatex/data/compiles +chown sharelatex:sharelatex /var/lib/sharelatex/data/compiles + +mkdir -p /var/lib/sharelatex/data/cache +chown sharelatex:sharelatex /var/lib/sharelatex/data/cache + +mkdir -p /var/lib/sharelatex/tmp +chown sharelatex:sharelatex /var/lib/sharelatex/tmp + +mkdir -p /var/lib/sharelatex/tmp/uploads +chown sharelatex:sharelatex /var/lib/sharelatex/tmp/uploads + +mkdir -p /var/lib/sharelatex/tmp/dumpFolder +chown sharelatex:sharelatex /var/lib/sharelatex/tmp/dumpFolder \ No newline at end of file diff --git a/server-ce/00_regen_sharelatex_secrets.sh b/server-ce/00_regen_sharelatex_secrets.sh new file mode 100755 index 0000000000..80fd293260 --- /dev/null +++ b/server-ce/00_regen_sharelatex_secrets.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Create random secret keys (twice, once for http auth pass, once for cookie secret). +CRYPTO_RANDOM=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') +sed -i "0,/CRYPTO_RANDOM/s/CRYPTO_RANDOM/$CRYPTO_RANDOM/" /etc/sharelatex/settings.coffee + +CRYPTO_RANDOM=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') +sed -i "0,/CRYPTO_RANDOM/s/CRYPTO_RANDOM/$CRYPTO_RANDOM/" /etc/sharelatex/settings.coffee diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile new file mode 100644 index 0000000000..77e6ea1aba --- /dev/null +++ b/server-ce/Dockerfile @@ -0,0 +1,81 @@ +FROM phusion/baseimage:0.9.16 + +RUN curl -sL https://deb.nodesource.com/setup | sudo bash - +RUN apt-get install -y build-essential nodejs + +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 sharelatex:sharelatex /var/lib/sharelatex; \ + mkdir -p /var/log/sharelatex; \ + chown sharelatex:sharelatex /var/log/sharelatex; + +RUN apt-get install -y git python +RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex + +# zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. +RUN apt-get install -y zlib1g-dev + +RUN cd /var/www/sharelatex; \ + npm install; \ + grunt install; + +# Minify js assets +RUN cd /var/www/sharelatex/web; \ + grunt compile:minify; + +RUN apt-get install -y nginx; +RUN rm /etc/nginx/sites-enabled/default +ADD nginx/nginx.conf /etc/nginx/nginx.conf +ADD nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf + +RUN mkdir /etc/service/nginx +ADD runit/nginx.sh /etc/service/nginx/run + +RUN mkdir /etc/service/chat-sharelatex; \ + mkdir /etc/service/clsi-sharelatex; \ + mkdir /etc/service/docstore-sharelatex; \ + mkdir /etc/service/document-updater-sharelatex; \ + mkdir /etc/service/filestore-sharelatex; \ + mkdir /etc/service/real-time-sharelatex; \ + mkdir /etc/service/spelling-sharelatex; \ + mkdir /etc/service/tags-sharelatex; \ + mkdir /etc/service/track-changes-sharelatex; \ + mkdir /etc/service/web-sharelatex; + +ADD runit/chat-sharelatex.sh /etc/service/chat-sharelatex/run +ADD runit/clsi-sharelatex.sh /etc/service/clsi-sharelatex/run +ADD runit/docstore-sharelatex.sh /etc/service/docstore-sharelatex/run +ADD runit/document-updater-sharelatex.sh /etc/service/document-updater-sharelatex/run +ADD runit/filestore-sharelatex.sh /etc/service/filestore-sharelatex/run +ADD runit/real-time-sharelatex.sh /etc/service/real-time-sharelatex/run +ADD runit/spelling-sharelatex.sh /etc/service/spelling-sharelatex/run +ADD runit/tags-sharelatex.sh /etc/service/tags-sharelatex/run +ADD runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run +ADD runit/web-sharelatex.sh /etc/service/web-sharelatex/run + +RUN mkdir /etc/sharelatex +ADD settings.coffee /etc/sharelatex/settings.coffee + +# phusion/baseimage init script +ADD 00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh +ADD 00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh + +# TexLive +RUN apt-get install -y wget +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 + +ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2014/bin/x86_64-linux/ +RUN tlmgr install latexmk + +# Aspell +RUN apt-get install -y 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 + +ENTRYPOINT ["/sbin/my_init"] \ No newline at end of file diff --git a/server-ce/README.md b/server-ce/README.md new file mode 100644 index 0000000000..ba4eae9155 --- /dev/null +++ b/server-ce/README.md @@ -0,0 +1,70 @@ +ShareLaTeX Docker Image +======================= + +*THIS IS A WORK IN PROGRESS AND THESE INSTRUCTIONS DO NOT WORK YET!* + +The recommended way to install and run ShareLaTeX Community Edition is via Docker: + +``` +$ docker run -d -v /sharelatex-data:/var/lib/sharelatex --net=host --name=sharelatex sharelatex/sharelatex +``` + +This will download the ShareLaTeX image and start it running in the background. + +**Which port does it listen on?**. + +### Mongo and Redis + +The `--net=host` option to docker will allow the ShareLaTeX container to access +ports on the local system. By default it looks for an instance of +[MongoDB](http://www.mongodb.org/) (must be version 2.4 or later) running on port 27017, and +[Redis](http://redis.io/) (must be version 2.6.12 or later) running on port 6379. These are the default ports for +a standard installation of MongoDB and Redis. + +### Persisting and backing up data + +The `-v /sharelatex-data:/var/lib/sharelatex` option in the `run` command tells Docker to mount the local +directory `/sharelatex-data` in the container at `/var/lib/sharelatex`. This is +where ShareLaTeX will store user uploaded files, and allows you to make external backups +of these files, as well as persist them between updates to the ShareLaTeX image. + +### LaTeX environment + +To save bandwidth, the ShareLaTeX image only comes with a minimal install of +TeXLive. To upgrade to a complete TeXLive installation, run the following command: + +``` +$ docker exec sharelatex tlmgr install scheme-full +``` + +Or you can install packages manually as you need by replacing `scheme-full` by +the package name + +### Configuration Options + +You can pass configuration options to ShareLaTeX as environment variables: + +``` +$ docker run -d \ + -v /sharelatex-data:/var/lib/sharelatex \ + --net=host \ + --name=sharelatex \ + --env SHARELATEX_MONGO_URL=mongodb://my.mongo.host/sharelatex \ + sharelatex/sharelatex +``` + +The available configuration parameters are: + +* `SHARELATEX_SITE_URL`: Where your instance of ShareLaTeX is publically available. +This is used in public links, and when connecting over websockets, so much be +configured correctly! +* `SHARELATEX_MONGO_URL`: The URL of the Mongo database to use +* `SHARELATEX_REDIS_HOST`: The host name of the Redis instance to use +* `SHARELATEX_REDIS_PORT`: The port of the Redis instance to use +* `SHARELATEX_REDIS_PASS`: The password to use when connecting to Redis (if applicable) +* `SHARELATEX_SECURE_COOKIE`: Set this to something non-zero to use a secure cookie. + This requires that your ShareLaTeX instance is running behind SSL. + +### Upgrading from older versions + +*TODO: Just stop container, remove 'sharelatex' tag, and run with the new version.* \ No newline at end of file diff --git a/server-ce/nginx/nginx.conf b/server-ce/nginx/nginx.conf new file mode 100644 index 0000000000..03d228c622 --- /dev/null +++ b/server-ce/nginx/nginx.conf @@ -0,0 +1,74 @@ +daemon off; +user www-data; +worker_processes 4; +pid /run/nginx.pid; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + gzip_disable "msie6"; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # nginx-naxsi config + ## + # Uncomment it if you installed nginx-naxsi + ## + + #include /etc/nginx/naxsi_core.rules; + + ## + # nginx-passenger config + ## + # Uncomment it if you installed nginx-passenger + ## + + #passenger_root /usr; + #passenger_ruby /usr/bin/ruby; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} diff --git a/server-ce/nginx/sharelatex.conf b/server-ce/nginx/sharelatex.conf new file mode 100644 index 0000000000..e9d6566ffd --- /dev/null +++ b/server-ce/nginx/sharelatex.conf @@ -0,0 +1,45 @@ +server { + listen 80; + server_name _; # Catch all, see http://nginx.org/en/docs/http/server_names.html + + set $static_path /var/www/sharelatex/web/public; + + location / { + proxy_pass http://localhost:3000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 3m; + proxy_send_timeout 3m; + } + + location /socket.io { + proxy_pass http://localhost:3026; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 3m; + proxy_send_timeout 3m; + } + + location /stylesheets { + expires 1y; + root $static_path/; + } + + location /minjs { + expires 1y; + root $static_path/; + } + + location /img { + expires 1y; + root $static_path/; + } +} diff --git a/server-ce/runit/chat-sharelatex.sh b/server-ce/runit/chat-sharelatex.sh new file mode 100755 index 0000000000..509ff8588e --- /dev/null +++ b/server-ce/runit/chat-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/chat/app.js >> /var/log/sharelatex/chat.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/clsi-sharelatex.sh b/server-ce/runit/clsi-sharelatex.sh new file mode 100755 index 0000000000..59298743c8 --- /dev/null +++ b/server-ce/runit/clsi-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/clsi/app.js >> /var/log/sharelatex/clsi.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/docstore-sharelatex.sh b/server-ce/runit/docstore-sharelatex.sh new file mode 100755 index 0000000000..ba7a96c8d7 --- /dev/null +++ b/server-ce/runit/docstore-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/docstore/app.js >> /var/log/sharelatex/docstore.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/document-updater-sharelatex.sh b/server-ce/runit/document-updater-sharelatex.sh new file mode 100755 index 0000000000..8f692ecdbe --- /dev/null +++ b/server-ce/runit/document-updater-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/document-updater/app.js >> /var/log/sharelatex/document-updater.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/filestore-sharelatex.sh b/server-ce/runit/filestore-sharelatex.sh new file mode 100755 index 0000000000..b02695f747 --- /dev/null +++ b/server-ce/runit/filestore-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/nginx.sh b/server-ce/runit/nginx.sh new file mode 100755 index 0000000000..9eacfb4ff2 --- /dev/null +++ b/server-ce/runit/nginx.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec nginx \ No newline at end of file diff --git a/server-ce/runit/real-time-sharelatex.sh b/server-ce/runit/real-time-sharelatex.sh new file mode 100755 index 0000000000..19aaed457b --- /dev/null +++ b/server-ce/runit/real-time-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /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/runit/spelling-sharelatex.sh b/server-ce/runit/spelling-sharelatex.sh new file mode 100755 index 0000000000..848c6ac7d1 --- /dev/null +++ b/server-ce/runit/spelling-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/spelling/app.js >> /var/log/sharelatex/spelling.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/tags-sharelatex.sh b/server-ce/runit/tags-sharelatex.sh new file mode 100755 index 0000000000..8616c1356c --- /dev/null +++ b/server-ce/runit/tags-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/tags/app.js >> /var/log/sharelatex/tags.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/track-changes-sharelatex.sh b/server-ce/runit/track-changes-sharelatex.sh new file mode 100755 index 0000000000..347d8f021a --- /dev/null +++ b/server-ce/runit/track-changes-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/track-changes/app.js >> /var/log/sharelatex/track-changes.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/web-sharelatex.sh b/server-ce/runit/web-sharelatex.sh new file mode 100755 index 0000000000..b0bda54c81 --- /dev/null +++ b/server-ce/runit/web-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/web/app.js >> /var/log/sharelatex/web.log 2>&1 \ No newline at end of file diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee new file mode 100644 index 0000000000..d4b6987f85 --- /dev/null +++ b/server-ce/settings.coffee @@ -0,0 +1,422 @@ +Path = require('path') + +# These credentials are used for authenticating api requests +# between services that may need to go over public channels +httpAuthUser = "sharelatex" +httpAuthPass = "CRYPTO_RANDOM" # Randomly generated for you +httpAuthUsers = {} +httpAuthUsers[httpAuthUser] = httpAuthPass + +DATA_DIR = '/var/lib/sharelatex/data' +TMP_DIR = '/var/lib/sharelatex/tmp' + +module.exports = + # Databases + # --------- + + # ShareLaTeX's main persistant data store is MongoDB (http://www.mongodb.org/) + # Documentation about the URL connection string format can be found at: + # + # http://docs.mongodb.org/manual/reference/connection-string/ + # + # The following works out of the box with Mongo's default settings: + mongo: + url : process.env["SHARELATEX_MONGO_URL"] or 'mongodb://127.0.0.1/sharelatex' + + # Redis is used in ShareLaTeX for high volume queries, like real-time + # editing, and session management. + # + # The following config will work with Redis's default settings: + redis: + web: redisConfig = + host: process.env["SHARELATEX_REDIS_HOST"] or "localhost" + port: process.env["SHARELATEX_REDIS_PORT"] or "6379" + password: process.env["SHARELATEX_REDIS_PASS"] or "" + fairy: redisConfig + + # The compile server (the clsi) uses a SQL database to cache files and + # meta-data. sqllite is the default, and the load is low enough that this will + # be fine in production (we use sqllite at sharelatex.com). + # + # If you want to configure a different database, see the Sequelize documentation + # for available options: + # + # https://github.com/sequelize/sequelize/wiki/API-Reference-Sequelize#example-usage + # + mysql: + clsi: + database: "clsi" + username: "clsi" + password: "" + dialect: "sqlite" + storage: Path.join(DATA_DIR, "db.sqlite") + + # File storage + # ------------ + + # ShareLaTeX can store binary files like images either locally or in Amazon + # S3. The default is locally: + filestore: + backend: "fs" + stores: + user_files: Path.join(DATA_DIR, "user_files") + + # To use Amazon S3 as a storage backend, comment out the above config, and + # uncomment the following, filling in your key, secret, and bucket name: + # + # filestore: + # backend: "s3" + # stores: + # user_files: "BUCKET_NAME" + # s3: + # key: "AWS_KEY" + # secret: "AWS_SECRET" + # + + # Local disk caching + # ------------------ + path: + # If we ever need to write something to disk (e.g. incoming requests + # that need processing but may be too big for memory), then write + # them to disk here: + dumpFolder: Path.join(TMP_DIR, "dumpFolder") + # Where to write uploads before they are processed + uploadFolder: Path.join(TMP_DIR, "uploads") + # Where to write the project to disk before running LaTeX on it + compilesDir: Path.join(DATA_DIR, "compiles") + # Where to cache downloaded URLs for the CLSI + clsiCacheDir: Path.join(DATA_DIR, "cache") + + # Server Config + # ------------- + + # Where your instance of ShareLaTeX can be found publicly. This is used + # when emails are sent out and in generated links: + siteUrl: siteUrl = process.env["SHARELATEX_SITE_URL"] or 'http://localhost:3000' + + # The websocket layer of ShareLaTeX runs as separate service. + # When running locally or in development, you can point the client to this + # service directly. If you are running behind a reverse proxy (Nginx, etc) + # then websocketsUrl should be the same as siteUrl, with your reverse + # proxy responible for sending websocket traffic to the websocket service + # rather than connecting directly. + websocketsUrl: siteUrl + + # If provided, a sessionSecret is used to sign cookies so that they cannot be + # spoofed. This is recommended. + security: + sessionSecret: "CRYPTO_RANDOM" # This was randomly generated for you + + # These credentials are used for authenticating api requests + # between services that may need to go over public channels + httpAuthUsers: httpAuthUsers + + # 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 + + # 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, + # but should be set to true in production. + cacheStaticAssets: true + + # If you are running ShareLaTeX over https, set this to true to send the + # cookie with a secure flag (recommended). + secureCookie: process.env["SHARELATEX_SECURE_COOKIE"]? + + # If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc) + # then set this to true to allow it to correctly detect the forwarded IP + # address and http/https protocol information. + behindProxy: true + + # Sending Email + # ------------- + # + # You must configure a mail server to be able to send invite emails from + # ShareLaTeX. The config settings are passed to nodemailer. See the nodemailer + # documentation for available options: + # + # http://www.nodemailer.com/docs/transports + # + # email: + # fromAddress: "" + # replyTo: "" + # transport: "SES" + # parameters: + # AWSAccessKeyID: "" + # AWSSecretKey: "" + + # Spell Check Languages + # --------------------- + # + # You must have the corresponding aspell dictionary installed to + # be able to use a language. Run `grunt check:aspell` to check which + # dictionaries you have installed. These should be set for the `code` for + # each language. + languages: [{ + "code":"en", + "name":"English (American)" + },{ + "code":"en_GB", + "name":"English (British)" + },{ + "code":"af", + "name":"Africaans" + },{ + "code":"am", + "name":"Amharic" + },{ + "code":"ar", + "name":"Arabic" + },{ + "code":"hy", + "name":"Armenian" + },{ + "code":"gl", + "name":"Galician" + },{ + "code":"eu", + "name":"Basque" + },{ + "code":"bn", + "name":"Bengali" + },{ + "code":"br", + "name":"Breton" + },{ + "code":"bg", + "name":"Bulgarian" + },{ + "code":"ca", + "name":"Catalan" + },{ + "code":"hr", + "name":"Croatian" + },{ + "code":"cs", + "name":"Czech" + },{ + "code":"da", + "name":"Danish" + },{ + "code":"nl", + "name":"Dutch" + },{ + "code":"eo", + "name":"Esperanto" + },{ + "code":"et", + "name":"Estonian" + },{ + "code":"fo", + "name":"Faroese" + },{ + "code":"fr", + "name":"French" + },{ + "code":"de", + "name":"German" + },{ + "code":"el", + "name":"Greek" + },{ + "code":"gu", + "name":"Gujarati" + },{ + "code":"he", + "name":"Hebrew" + },{ + "code":"hi", + "name":"Hindi" + },{ + "code":"hu", + "name":"Hungarian" + },{ + "code":"is", + "name":"Icelandic" + },{ + "code":"id", + "name":"Indonesian" + },{ + "code":"ga", + "name":"Irish" + },{ + "code":"it", + "name":"Italian" + },{ + "code":"kn", + "name":"Kannada" + },{ + "code":"kk", + "name":"Kazakh" + },{ + "code":"ku", + "name":"Kurdish" + },{ + "code":"lv", + "name":"Latvian" + },{ + "code":"lt", + "name":"Lithuanian" + },{ + "code":"ml", + "name":"Malayalam" + },{ + "code":"mr", + "name":"Marathi" + },{ + "code":"nr", + "name":"Ndebele" + },{ + "code":"ns", + "name":"Northern Sotho" + },{ + "code":"no", + "name":"Norwegian" + },{ + "code":"or", + "name":"Oriya" + },{ + "code":"fa", + "name":"Persian" + },{ + "code":"pl", + "name":"Polish" + },{ + "code":"pt_BR", + "name":"Portuguese (Brazilian)" + },{ + "code":"pt_PT", + "name":"Portuguese (European)" + },{ + "code":"pa", + "name":"Punjabi" + },{ + "code":"ro", + "name":"Romanian" + },{ + "code":"ru", + "name":"Russian" + },{ + "code":"sk", + "name":"Slovak" + },{ + "code":"sl", + "name":"Slovenian" + },{ + "code":"st", + "name":"Southern Sotho" + },{ + "code":"es", + "name":"Spanish" + },{ + "code":"ss", + "name":"Swazi" + },{ + "code":"sv", + "name":"Swedish" + },{ + "code":"tl", + "name":"Tagalog" + },{ + "code":"ta", + "name":"Tamil" + },{ + "code":"te", + "name":"Telugu" + },{ + "code":"ts", + "name":"Tsonga" + },{ + "code":"tn", + "name":"Tswana" + },{ + "code":"uk", + "name":"Ukrainian" + },{ + "code":"hsb", + "name":"Upper Sorbian" + },{ + "code":"uz", + "name":"Uzbek" + },{ + "code":"cy", + "name":"Welsh" + },{ + "code":"xh", + "name":"Xhosa" + },{ + "code":"zu", + "name":"Zulu" + } + ] + + # Service locations + # ----------------- + + # ShareLaTeX is comprised of many small services, which each expose + # an HTTP API running on a different port. Generally you + # can leave these as they are unless you have some other services + # running which conflict, or want to run the web process on port 80. + # internal: + # web: + # port: webPort = 3000 + # host: "localhost" + # documentupdater: + # port: docUpdaterPort = 3003 + # host: "localhost" + # filestore: + # port: filestorePort = 3009 + # host: "localhost" + # chat: + # port: chatPort = 3010 + # host: "localhost" + # tags: + # port: tagsPort = 3012 + # host: "localhost" + # clsi: + # port: clsiPort = 3013 + # host: "localhost" + # trackchanges: + # port: trackchangesPort = 3015 + # host: "localhost" + # docstore: + # port: docstorePort = 3016 + # host: "localhost" + # spelling: + # port: spellingPort = 3005 + # host: "localhost" + + # If you change the above config, or run some services on remote servers, + # you need to tell the other services where to find them: + apis: + web: + url: "http://localhost:3000" + user: httpAuthUser + pass: httpAuthPass + # documentupdater: + # url : "http://localhost:#{docUpdaterPort}" + # clsi: + # url: "http://localhost:#{clsiPort}" + # filestore: + # url: "http://localhost:#{filestorePort}" + # trackchanges: + # url: "http://localhost:#{trackchangesPort}" + # docstore: + # url: "http://localhost:#{docstorePort}" + # tags: + # url: "http://localhost:#{tagsPort}" + # spelling: + # url: "http://localhost:#{spellingPort}" + # chat: + # url: "http://localhost:#{chatPort}" + + +# With lots of incoming and outgoing HTTP connections to different services, +# sometimes long running, it is a good idea to increase the default number +# of sockets that Node will hold open. +http = require('http') +http.globalAgent.maxSockets = 300 +https = require('https') +https.globalAgent.maxSockets = 300 From 906919a86fabccd4f7657ef1b3059cb95f52d0d8 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 9 Feb 2015 16:18:58 +0000 Subject: [PATCH 002/182] Don't rely on --net=host --- server-ce/Dockerfile | 13 +++-- server-ce/README.md | 118 ++++++++++++++++++++++++++++++++------ server-ce/settings.coffee | 6 +- 3 files changed, 114 insertions(+), 23 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 77e6ea1aba..dbf7241c51 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -59,10 +59,6 @@ ADD runit/web-sharelatex.sh /etc/service/web-sharelatex/run RUN mkdir /etc/sharelatex ADD settings.coffee /etc/sharelatex/settings.coffee -# phusion/baseimage init script -ADD 00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh -ADD 00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh - # TexLive RUN apt-get install -y wget RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ @@ -71,6 +67,8 @@ RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ 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/2014/bin/x86_64-linux/ RUN tlmgr install latexmk @@ -78,4 +76,11 @@ RUN tlmgr install latexmk # Aspell RUN apt-get install -y 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 +# phusion/baseimage init script +ADD 00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh +ADD 00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh +ADD 00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress.sh + +EXPOSE 80 + ENTRYPOINT ["/sbin/my_init"] \ No newline at end of file diff --git a/server-ce/README.md b/server-ce/README.md index ba4eae9155..a9a0a729eb 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,32 +1,105 @@ ShareLaTeX Docker Image ======================= -*THIS IS A WORK IN PROGRESS AND THESE INSTRUCTIONS DO NOT WORK YET!* +**Please read this entire file before installing ShareLaTeX via Docker. It's only +short but contains some important information.** The recommended way to install and run ShareLaTeX Community Edition is via Docker: ``` -$ docker run -d -v /sharelatex-data:/var/lib/sharelatex --net=host --name=sharelatex sharelatex/sharelatex +$ docker run -d -v sharelatex:/var/lib/sharelatex --name=sharelatex sharelatex/sharelatex ``` This will download the ShareLaTeX image and start it running in the background. -**Which port does it listen on?**. +To stop ShareLaTeX: + +``` +docker stop sharelatex +``` + +and to start it again: + +``` +docker start sharelatex +``` + +If you want to permanently remove ShareLaTeX from your docker containers: + +``` +docker rm sharelatex +``` + +### Storing Data + +The `-v sharelatex:/var/lib/sharelatex` option in the `run` command tells +Docker to make the host directory `sharelatex` available inside the container for +ShareLaTeX to store data files in. This means that you can back up and access these +files manually outside of the ShareLaTeX container. If you would like to store ShareLaTeX data +in a different location, such as `/home/james/my_data`, just change this parameter: + +``` +$ docker run -d \ + -v /home/james/my_data:/var/lib/sharelatex \ + --name=sharelatex \ + sharelatex/sharelatex +``` + +Do not change the second part of this parameter (after the :). + +This is only where ShareLaTeX stores on-disk data. +Other data is also stored in Mongo and Redis. ### Mongo and Redis -The `--net=host` option to docker will allow the ShareLaTeX container to access -ports on the local system. By default it looks for an instance of -[MongoDB](http://www.mongodb.org/) (must be version 2.4 or later) running on port 27017, and -[Redis](http://redis.io/) (must be version 2.6.12 or later) running on port 6379. These are the default ports for -a standard installation of MongoDB and Redis. +ShareLaTeX depends on [MongoDB](http://www.mongodb.org/) (must be 2.4 or later), and +[Redis](http://redis.io/) (must be version 2.6.12 or later). +These should be running on the host system. -### Persisting and backing up data +By default the ShareLaTeX Docker container looks for these running on the host +machine at port 27017 (for Mongo) and port 6379 (for Redis). These are the defaults +ports for both databases so you shouldn't need to change them. -The `-v /sharelatex-data:/var/lib/sharelatex` option in the `run` command tells Docker to mount the local -directory `/sharelatex-data` in the container at `/var/lib/sharelatex`. This is -where ShareLaTeX will store user uploaded files, and allows you to make external backups -of these files, as well as persist them between updates to the ShareLaTeX image. +If you want to point ShareLaTeX at a database in a different location, you can +configure the container with environment variables. See the **Configuration Options** +section below. + +*Note that `localhost` in the container refers only to the container, so if you +want to access services on the host machine then you should use `dockerhost`.* For example: + +``` +$ docker run -d \ + -v sharelatex:/var/lib/sharelatex \ + --name=sharelatex \ + --env SHARELATEX_MONGO_URL=mongodb://dockerhost/sharelatex \ + sharelatex/sharelatex +``` + +### Backups + +To backup the ShareLaTeX data, you need to backup the directory you have attached +to the container, as above. You also need to backup the Mongo and Redis databases. + +### Running on a different port + +The container listens on port 80 by default so you should be able to access +ShareLaTeX at http://localhost/. If you would like to run ShareLaTeX on a different +port (perhaps you have another service running on port 80, or want to put a proxy +in front of ShareLaTeX), then you can forward port 80 from the Docker container +to any other port with the `-p :80` option. For example, to have ShareLaTeX +listen on port 5000: + +``` +$ docker run -d \ + -v sharelatex:/var/lib/sharelatex \ + --name=sharelatex \ + -p 5000:80 \ + --env SHARELATEX_SITE_URL=http://localhost:5000 \ + sharelatex/sharelatex +``` + +(Note that you also have to update the `SHARELATEX_SITE_URL` parameter so that +it knows where it is publicly available.) ### LaTeX environment @@ -38,7 +111,7 @@ $ docker exec sharelatex tlmgr install scheme-full ``` Or you can install packages manually as you need by replacing `scheme-full` by -the package name +the package name. ### Configuration Options @@ -63,8 +136,21 @@ configured correctly! * `SHARELATEX_REDIS_PORT`: The port of the Redis instance to use * `SHARELATEX_REDIS_PASS`: The password to use when connecting to Redis (if applicable) * `SHARELATEX_SECURE_COOKIE`: Set this to something non-zero to use a secure cookie. - This requires that your ShareLaTeX instance is running behind SSL. + Only use this if your ShareLaTeX instance is running behind a reverse proxy with SSL configured. ### Upgrading from older versions -*TODO: Just stop container, remove 'sharelatex' tag, and run with the new version.* \ No newline at end of file +*Please make sure to back up all Mongo, Redis and on-disk data before upgrading.* + +Stop and remove the currently running ShareLaTeX container: + +``` +$ docker stop sharelatex +$ docker rm sharelatex +``` + +Start a new container with the updated version of ShareLaTeX (to upgrade to version 1.4.0 for example): + +``` +$ docker run -d -v sharelatex:/var/lib/sharelatex --name=sharelatex sharelatex/sharelatex:1.4.0 +``` \ No newline at end of file diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index d4b6987f85..622529068a 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -21,7 +21,7 @@ module.exports = # # The following works out of the box with Mongo's default settings: mongo: - url : process.env["SHARELATEX_MONGO_URL"] or 'mongodb://127.0.0.1/sharelatex' + url : process.env["SHARELATEX_MONGO_URL"] or 'mongodb://dockerhost/sharelatex' # Redis is used in ShareLaTeX for high volume queries, like real-time # editing, and session management. @@ -29,7 +29,7 @@ module.exports = # The following config will work with Redis's default settings: redis: web: redisConfig = - host: process.env["SHARELATEX_REDIS_HOST"] or "localhost" + host: process.env["SHARELATEX_REDIS_HOST"] or "dockerhost" port: process.env["SHARELATEX_REDIS_PORT"] or "6379" password: process.env["SHARELATEX_REDIS_PASS"] or "" fairy: redisConfig @@ -92,7 +92,7 @@ module.exports = # Where your instance of ShareLaTeX can be found publicly. This is used # when emails are sent out and in generated links: - siteUrl: siteUrl = process.env["SHARELATEX_SITE_URL"] or 'http://localhost:3000' + siteUrl: siteUrl = process.env["SHARELATEX_SITE_URL"] or 'http://localhost' # The websocket layer of ShareLaTeX runs as separate service. # When running locally or in development, you can point the client to this From 820b6ad4e832b2d2c012727227d3595a184f7def Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 9 Feb 2015 16:27:44 +0000 Subject: [PATCH 003/182] Add missing file --- server-ce/00_set_docker_host_ipaddress.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 server-ce/00_set_docker_host_ipaddress.sh diff --git a/server-ce/00_set_docker_host_ipaddress.sh b/server-ce/00_set_docker_host_ipaddress.sh new file mode 100755 index 0000000000..afd31b69a1 --- /dev/null +++ b/server-ce/00_set_docker_host_ipaddress.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# See the bottom of http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach +echo "`route -n | awk '/UG[ \t]/{print $2}'` dockerhost" >> /etc/hosts \ No newline at end of file From 47405a0b31151d04be900c6f2b69cbe5c5476e2d Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 10 Feb 2015 16:49:34 +0000 Subject: [PATCH 004/182] Update to use release version of ShareLaTeX --- server-ce/Dockerfile | 16 ++++++++++------ server-ce/README.md | 34 ++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index dbf7241c51..9d750e5a2e 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -1,8 +1,8 @@ FROM phusion/baseimage:0.9.16 +# Install Node.js and Grunt RUN curl -sL https://deb.nodesource.com/setup | sudo bash - RUN apt-get install -y build-essential nodejs - RUN npm install -g grunt-cli # Set up sharelatex user and home directory @@ -12,8 +12,9 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela mkdir -p /var/log/sharelatex; \ chown sharelatex:sharelatex /var/log/sharelatex; +# Install ShareLaTeX RUN apt-get install -y git python -RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex +RUN git clone -b release https://github.com/sharelatex/sharelatex.git /var/www/sharelatex # zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. RUN apt-get install -y zlib1g-dev @@ -25,7 +26,8 @@ RUN cd /var/www/sharelatex; \ # Minify js assets RUN cd /var/www/sharelatex/web; \ grunt compile:minify; - + +# Install Nginx as a reverse proxy RUN apt-get install -y nginx; RUN rm /etc/nginx/sites-enabled/default ADD nginx/nginx.conf /etc/nginx/nginx.conf @@ -33,7 +35,8 @@ ADD nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf RUN mkdir /etc/service/nginx ADD runit/nginx.sh /etc/service/nginx/run - + +# Set up ShareLaTeX services to run automatically on boot RUN mkdir /etc/service/chat-sharelatex; \ mkdir /etc/service/clsi-sharelatex; \ mkdir /etc/service/docstore-sharelatex; \ @@ -56,10 +59,11 @@ ADD runit/tags-sharelatex.sh /etc/service/tags-sharelatex/run ADD runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run ADD runit/web-sharelatex.sh /etc/service/web-sharelatex/run +# Install ShareLaTeX settings file RUN mkdir /etc/sharelatex ADD settings.coffee /etc/sharelatex/settings.coffee -# TexLive +# Install TexLive RUN apt-get install -y wget RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ mkdir /install-tl-unx; \ @@ -73,7 +77,7 @@ RUN rm -r /install-tl-unx; \ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2014/bin/x86_64-linux/ RUN tlmgr install latexmk -# Aspell +# Install Aspell RUN apt-get install -y 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 # phusion/baseimage init script diff --git a/server-ce/README.md b/server-ce/README.md index a9a0a729eb..5f1eea71f2 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -4,13 +4,13 @@ ShareLaTeX Docker Image **Please read this entire file before installing ShareLaTeX via Docker. It's only short but contains some important information.** -The recommended way to install and run ShareLaTeX Community Edition is via Docker: +The recommended way to install and run ShareLaTeX Community Edition is via [Docker](https://www.docker.com/): ``` -$ docker run -d -v sharelatex:/var/lib/sharelatex --name=sharelatex sharelatex/sharelatex +$ docker run -d -v ~/sharelatex_data:/var/lib/sharelatex -p 80 --name=sharelatex sharelatex/sharelatex ``` -This will download the ShareLaTeX image and start it running in the background. +This will download the ShareLaTeX image and start it running in the background on port 80. You should be able to access it at http://localhost/. To stop ShareLaTeX: @@ -32,8 +32,8 @@ docker rm sharelatex ### Storing Data -The `-v sharelatex:/var/lib/sharelatex` option in the `run` command tells -Docker to make the host directory `sharelatex` available inside the container for +The `-v ~/sharelatex_data:/var/lib/sharelatex` option in the `run` command tells +Docker to make the host directory `~/sharelatex_data` available inside the container for ShareLaTeX to store data files in. This means that you can back up and access these files manually outside of the ShareLaTeX container. If you would like to store ShareLaTeX data in a different location, such as `/home/james/my_data`, just change this parameter: @@ -41,6 +41,7 @@ in a different location, such as `/home/james/my_data`, just change this paramet ``` $ docker run -d \ -v /home/james/my_data:/var/lib/sharelatex \ + -p 80 \ --name=sharelatex \ sharelatex/sharelatex ``` @@ -69,7 +70,8 @@ want to access services on the host machine then you should use `dockerhost`.* F ``` $ docker run -d \ - -v sharelatex:/var/lib/sharelatex \ + -v ~/sharelatex_data:/var/lib/sharelatex \ + -p 80 \ --name=sharelatex \ --env SHARELATEX_MONGO_URL=mongodb://dockerhost/sharelatex \ sharelatex/sharelatex @@ -91,15 +93,15 @@ listen on port 5000: ``` $ docker run -d \ - -v sharelatex:/var/lib/sharelatex \ - --name=sharelatex \ + -v ~/sharelatex_data:/var/lib/sharelatex \ -p 5000:80 \ + --name=sharelatex \ --env SHARELATEX_SITE_URL=http://localhost:5000 \ sharelatex/sharelatex ``` -(Note that you also have to update the `SHARELATEX_SITE_URL` parameter so that -it knows where it is publicly available.) +**(Note that you also have to update the `SHARELATEX_SITE_URL` parameter so that +ShareLaTeX knows where to refer to scripts and links that need loading.)** ### LaTeX environment @@ -119,11 +121,11 @@ You can pass configuration options to ShareLaTeX as environment variables: ``` $ docker run -d \ - -v /sharelatex-data:/var/lib/sharelatex \ - --net=host \ - --name=sharelatex \ - --env SHARELATEX_MONGO_URL=mongodb://my.mongo.host/sharelatex \ - sharelatex/sharelatex + -v ~/sharelatex_data:/var/lib/sharelatex \ + -p 80 \ + --name=sharelatex \ + --env SHARELATEX_MONGO_URL=mongodb://my.mongo.host/sharelatex \ + sharelatex/sharelatex ``` The available configuration parameters are: @@ -152,5 +154,5 @@ $ docker rm sharelatex Start a new container with the updated version of ShareLaTeX (to upgrade to version 1.4.0 for example): ``` -$ docker run -d -v sharelatex:/var/lib/sharelatex --name=sharelatex sharelatex/sharelatex:1.4.0 +$ docker run -d -v ~/sharelatex_data:/var/lib/sharelatex --name=sharelatex sharelatex/sharelatex:1.4.0 ``` \ No newline at end of file From e6be54d087d47516d4bcee550af561175cccbb0b Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 11 Feb 2015 13:54:03 +0000 Subject: [PATCH 005/182] Update README.md --- server-ce/README.md | 61 +++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/server-ce/README.md b/server-ce/README.md index 5f1eea71f2..820b2ac49f 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -30,6 +30,39 @@ If you want to permanently remove ShareLaTeX from your docker containers: docker rm sharelatex ``` +### Mongo and Redis + +ShareLaTeX depends on [MongoDB](http://www.mongodb.org/) (must be 2.4 or later), and +[Redis](http://redis.io/) (must be version 2.6.12 or later). +These should be running on the host system. + +By default the ShareLaTeX Docker container looks for these running on the host +machine at port 27017 (for Mongo) and port 6379 (for Redis). These are the defaults +ports for both databases so you shouldn't need to change them. + +Note that Docker containers each come with their own network stack, and Mongo and Redis +often listen by default on `127.0.0.1` which is not accessible on the host +from inside the Docker container. Instead, you should configure Mongo and Redis to +also listen on `172.17.42.1` (or whatever ip iddress the docker0 interface has on your +host). This can be done in `/etc/mongod.conf` and `/etc/redis/redis.conf`. + +If you want to point ShareLaTeX at a database in a different location, you can +configure the container with environment variables. See the **Configuration Options** +section below. + +*Note that `localhost` in the container refers only to the container, so if you +want to access services on the host machine then you should use `dockerhost`. +`dockerhost` refers to the the `172.17.42.1` ip address mentioned above.* For example: + +``` +$ docker run -d \ + -v ~/sharelatex_data:/var/lib/sharelatex \ + -p 80 \ + --name=sharelatex \ + --env SHARELATEX_MONGO_URL=mongodb://dockerhost/sharelatex \ + sharelatex/sharelatex +``` + ### Storing Data The `-v ~/sharelatex_data:/var/lib/sharelatex` option in the `run` command tells @@ -51,32 +84,6 @@ Do not change the second part of this parameter (after the :). This is only where ShareLaTeX stores on-disk data. Other data is also stored in Mongo and Redis. -### Mongo and Redis - -ShareLaTeX depends on [MongoDB](http://www.mongodb.org/) (must be 2.4 or later), and -[Redis](http://redis.io/) (must be version 2.6.12 or later). -These should be running on the host system. - -By default the ShareLaTeX Docker container looks for these running on the host -machine at port 27017 (for Mongo) and port 6379 (for Redis). These are the defaults -ports for both databases so you shouldn't need to change them. - -If you want to point ShareLaTeX at a database in a different location, you can -configure the container with environment variables. See the **Configuration Options** -section below. - -*Note that `localhost` in the container refers only to the container, so if you -want to access services on the host machine then you should use `dockerhost`.* For example: - -``` -$ docker run -d \ - -v ~/sharelatex_data:/var/lib/sharelatex \ - -p 80 \ - --name=sharelatex \ - --env SHARELATEX_MONGO_URL=mongodb://dockerhost/sharelatex \ - sharelatex/sharelatex -``` - ### Backups To backup the ShareLaTeX data, you need to backup the directory you have attached @@ -155,4 +162,4 @@ Start a new container with the updated version of ShareLaTeX (to upgrade to vers ``` $ docker run -d -v ~/sharelatex_data:/var/lib/sharelatex --name=sharelatex sharelatex/sharelatex:1.4.0 -``` \ No newline at end of file +``` From 425823a5eb0add997c0adf916bfae9864045f85f Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 11 Feb 2015 13:56:01 +0000 Subject: [PATCH 006/182] Update README.md --- server-ce/README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/server-ce/README.md b/server-ce/README.md index 820b2ac49f..1b91bf1ff5 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -36,16 +36,30 @@ ShareLaTeX depends on [MongoDB](http://www.mongodb.org/) (must be 2.4 or later), [Redis](http://redis.io/) (must be version 2.6.12 or later). These should be running on the host system. -By default the ShareLaTeX Docker container looks for these running on the host -machine at port 27017 (for Mongo) and port 6379 (for Redis). These are the defaults -ports for both databases so you shouldn't need to change them. - Note that Docker containers each come with their own network stack, and Mongo and Redis often listen by default on `127.0.0.1` which is not accessible on the host from inside the Docker container. Instead, you should configure Mongo and Redis to also listen on `172.17.42.1` (or whatever ip iddress the docker0 interface has on your host). This can be done in `/etc/mongod.conf` and `/etc/redis/redis.conf`. +``` +# /etc/mongod.conf +... +bind_ip = 172.17.42.1 +... +``` + +``` +# /etc/redis/redis.conf +... +bind 172.17.42.1 +... +``` + +By default the ShareLaTeX Docker container looks for these running on the host +machine at port 27017 (for Mongo) and port 6379 (for Redis). These are the defaults +ports for both databases so you shouldn't need to change them. + If you want to point ShareLaTeX at a database in a different location, you can configure the container with environment variables. See the **Configuration Options** section below. From 69104728ad3e8c7e82fe50ec2771f7a9fbfabf03 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 11 Feb 2015 14:34:39 +0000 Subject: [PATCH 007/182] Update README.md --- server-ce/README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server-ce/README.md b/server-ce/README.md index 1b91bf1ff5..011daeb900 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -7,7 +7,11 @@ short but contains some important information.** The recommended way to install and run ShareLaTeX Community Edition is via [Docker](https://www.docker.com/): ``` -$ docker run -d -v ~/sharelatex_data:/var/lib/sharelatex -p 80 --name=sharelatex sharelatex/sharelatex +$ docker run -d \ + -v ~/sharelatex_data:/var/lib/sharelatex \ + -p 5000:80 \ + --name=sharelatex \ + sharelatex/sharelatex ``` This will download the ShareLaTeX image and start it running in the background on port 80. You should be able to access it at http://localhost/. @@ -71,7 +75,7 @@ want to access services on the host machine then you should use `dockerhost`. ``` $ docker run -d \ -v ~/sharelatex_data:/var/lib/sharelatex \ - -p 80 \ + -p 5000:80 \ --name=sharelatex \ --env SHARELATEX_MONGO_URL=mongodb://dockerhost/sharelatex \ sharelatex/sharelatex @@ -143,7 +147,7 @@ You can pass configuration options to ShareLaTeX as environment variables: ``` $ docker run -d \ -v ~/sharelatex_data:/var/lib/sharelatex \ - -p 80 \ + -p 5000:80 \ --name=sharelatex \ --env SHARELATEX_MONGO_URL=mongodb://my.mongo.host/sharelatex \ sharelatex/sharelatex From c0556a3b9e1f0736b97a2f7d3be1ec57bf547d6b Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 11 Feb 2015 14:34:53 +0000 Subject: [PATCH 008/182] Update README.md --- server-ce/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/README.md b/server-ce/README.md index 011daeb900..73b66ff196 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -14,7 +14,7 @@ $ docker run -d \ sharelatex/sharelatex ``` -This will download the ShareLaTeX image and start it running in the background on port 80. You should be able to access it at http://localhost/. +This will download the ShareLaTeX image and start it running in the background on port 5000. You should be able to access it at http://localhost:5000/. To stop ShareLaTeX: From 8512277819e2efc2b05226e59e8bcafaf6ee5710 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 18 Feb 2015 17:08:41 +0000 Subject: [PATCH 009/182] Install unzip in Docker container --- server-ce/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 9d750e5a2e..19d4d82875 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -80,6 +80,9 @@ RUN tlmgr install latexmk # Install Aspell RUN apt-get install -y 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 unzip for file uploads +RUN apt-get install -y unzip + # phusion/baseimage init script ADD 00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh ADD 00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh @@ -87,4 +90,4 @@ ADD 00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress. EXPOSE 80 -ENTRYPOINT ["/sbin/my_init"] \ No newline at end of file +ENTRYPOINT ["/sbin/my_init"] From 5e00d8d3b4df0c3af9cffea4d2c74f1aedf2fb47 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 25 Mar 2015 16:28:06 +0000 Subject: [PATCH 010/182] Update to use latest ShareLaTeX release --- server-ce/Dockerfile | 9 +++++---- server-ce/README.md | 16 ++++++++++++++++ server-ce/settings.coffee | 15 +++++++-------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 19d4d82875..a8d6d9be82 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -59,10 +59,6 @@ ADD runit/tags-sharelatex.sh /etc/service/tags-sharelatex/run ADD runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run ADD runit/web-sharelatex.sh /etc/service/web-sharelatex/run -# Install ShareLaTeX settings file -RUN mkdir /etc/sharelatex -ADD settings.coffee /etc/sharelatex/settings.coffee - # Install TexLive RUN apt-get install -y wget RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ @@ -88,6 +84,11 @@ ADD 00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.s ADD 00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh ADD 00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress.sh +# Install ShareLaTeX settings file +RUN mkdir /etc/sharelatex +ADD settings.coffee /etc/sharelatex/settings.coffee +ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee + EXPOSE 80 ENTRYPOINT ["/sbin/my_init"] diff --git a/server-ce/README.md b/server-ce/README.md index 73b66ff196..2ac12723b6 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -158,6 +158,8 @@ The available configuration parameters are: * `SHARELATEX_SITE_URL`: Where your instance of ShareLaTeX is publically available. This is used in public links, and when connecting over websockets, so much be configured correctly! +* `SHARELATEX_ADMIN_EMAIL`: The email address where users can reach the person who runs the site. +* `SHARELATEX_APP_NAME`: The name to display when talking about the running app. Defaults to 'ShareLaTex (Community Edition)'. * `SHARELATEX_MONGO_URL`: The URL of the Mongo database to use * `SHARELATEX_REDIS_HOST`: The host name of the Redis instance to use * `SHARELATEX_REDIS_PORT`: The port of the Redis instance to use @@ -165,6 +167,20 @@ configured correctly! * `SHARELATEX_SECURE_COOKIE`: Set this to something non-zero to use a secure cookie. Only use this if your ShareLaTeX instance is running behind a reverse proxy with SSL configured. +### Creating and Managing users + +Uun the following command to create your first user and make them an admin: + +``` +$ docker exec sharelatex /bin/bash -c "cd /var/www/sharelatex/web; grunt create-admin-user --email joe@example.com" +``` + +This will create a user with the given email address if they don't already exist, and make them an admin user. You will be given a URL to visit where you can set the password for this user and log in for the first time. + +**Creating normal users** + +Once you are logged in as an admin user, you can visit `/admin/register` on your ShareLaTeX instance and create a new users. If you have an email backend configured in your settings file, the new users will be sent an email with a URL to set their password. If not, you will have to distribute the password reset URLs manually. These are shown when you create a user. + ### Upgrading from older versions *Please make sure to back up all Mongo, Redis and on-disk data before upgrading.* diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 622529068a..440b59f7fb 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -93,14 +93,13 @@ module.exports = # Where your instance of ShareLaTeX can be found publicly. This is used # when emails are sent out and in generated links: siteUrl: siteUrl = process.env["SHARELATEX_SITE_URL"] or 'http://localhost' - - # The websocket layer of ShareLaTeX runs as separate service. - # When running locally or in development, you can point the client to this - # service directly. If you are running behind a reverse proxy (Nginx, etc) - # then websocketsUrl should be the same as siteUrl, with your reverse - # proxy responible for sending websocket traffic to the websocket service - # rather than connecting directly. - websocketsUrl: siteUrl + + # The name this is used to describe your ShareLaTeX Installation + appName: process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX (Community Edition)" + + # The email address which users will be directed to as the main point of + # contact for this installation of ShareLaTeX. + adminEmail: process.env["SHARELATEX_ADMIN_EMAIL"] or "placeholder@example.com" # If provided, a sessionSecret is used to sign cookies so that they cannot be # spoofed. This is recommended. From 195e22b45ec8ad317c79460f1c06f9546ae92276 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 17 Sep 2015 14:07:50 +0000 Subject: [PATCH 011/182] added mongodb migrations added imagemagick make sure release is up to date --- server-ce/99_migrate.sh | 5 +++++ server-ce/Dockerfile | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 server-ce/99_migrate.sh diff --git a/server-ce/99_migrate.sh b/server-ce/99_migrate.sh new file mode 100755 index 0000000000..762aae2806 --- /dev/null +++ b/server-ce/99_migrate.sh @@ -0,0 +1,5 @@ +#!/bin/sh +which node +which grunt +ls -al /var/www/sharelatex/migrations +cd /var/www/sharelatex && grunt migrate -v diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index a8d6d9be82..ff52a33198 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -15,6 +15,7 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela # Install ShareLaTeX RUN apt-get install -y git python RUN git clone -b release https://github.com/sharelatex/sharelatex.git /var/www/sharelatex +RUN cd /var/www/sharelatex && git pull origin release # zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. RUN apt-get install -y zlib1g-dev @@ -28,6 +29,7 @@ RUN cd /var/www/sharelatex/web; \ grunt compile:minify; # Install Nginx as a reverse proxy +run apt-get update RUN apt-get install -y nginx; RUN rm /etc/nginx/sites-enabled/default ADD nginx/nginx.conf /etc/nginx/nginx.conf @@ -70,7 +72,8 @@ RUN echo "selected_scheme scheme-basic" >> /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/2014/bin/x86_64-linux/ +ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2015/bin/x86_64-linux/ +RUN apt-get update RUN tlmgr install latexmk # Install Aspell @@ -79,10 +82,14 @@ RUN apt-get install -y aspell aspell-en aspell-af aspell-am aspell-ar aspell-ar- # Install unzip for file uploads RUN apt-get install -y unzip +# Install imagemagick for image conversions +RUN apt-get install -y imagemagick optipng + # phusion/baseimage init script ADD 00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh ADD 00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh ADD 00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress.sh +ADD 99_migrate.sh /etc/my_init.d/99_migrate.sh # Install ShareLaTeX settings file RUN mkdir /etc/sharelatex From 62908092b9ea672bd06b5a7d8a54590838ece193 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 1 Dec 2015 16:17:15 +0000 Subject: [PATCH 012/182] Added tip for copying the database when upgrading --- server-ce/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server-ce/README.md b/server-ce/README.md index 2ac12723b6..405ba6406f 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -185,7 +185,17 @@ Once you are logged in as an admin user, you can visit `/admin/register` on your *Please make sure to back up all Mongo, Redis and on-disk data before upgrading.* -Stop and remove the currently running ShareLaTeX container: +#### Migrations +Data stored in Mongodb will be automatically migrated to the latest schemea when upgrading docker releases. **This can make downgrades impossible.** One recommended technique is to test the migration first. This can be done by copying the mongodb database and doing a test run against the copied data. + +``` +db.copyDatabase(sharelatex,sharelatex-copy) +# start the container up pointing at the new db +--env SHARELATEX_MONGO_URL=mongodb://dockerhost/sharelatex-copy +``` + +#### Upgrade process +To use the new docker container stop and remove the currently running ShareLaTeX container: ``` $ docker stop sharelatex From 2e779f0ed79acbbf741b15fdff594b71e405bd88 Mon Sep 17 00:00:00 2001 From: mattcollier Date: Mon, 28 Dec 2015 16:27:46 -0500 Subject: [PATCH 013/182] Correct typo. --- server-ce/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/README.md b/server-ce/README.md index 405ba6406f..eac83edd43 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -156,7 +156,7 @@ $ docker run -d \ The available configuration parameters are: * `SHARELATEX_SITE_URL`: Where your instance of ShareLaTeX is publically available. -This is used in public links, and when connecting over websockets, so much be +This is used in public links, and when connecting over websockets, so must be configured correctly! * `SHARELATEX_ADMIN_EMAIL`: The email address where users can reach the person who runs the site. * `SHARELATEX_APP_NAME`: The name to display when talking about the running app. Defaults to 'ShareLaTex (Community Edition)'. From e5a7bf947be2cb464c3c75398b621cd450959784 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 13 Jan 2016 15:10:31 +0000 Subject: [PATCH 014/182] set nginx to 50mb limit which is upper side of what ShareLaTeX can handle --- server-ce/nginx/nginx.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server-ce/nginx/nginx.conf b/server-ce/nginx/nginx.conf index 03d228c622..c4311103b0 100644 --- a/server-ce/nginx/nginx.conf +++ b/server-ce/nginx/nginx.conf @@ -41,6 +41,8 @@ http { gzip on; gzip_disable "msie6"; + client_max_body_size 50m; + # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; From 799c38a64678510e1706cb9b0cf0bba3204b6e44 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 3 Feb 2016 14:56:11 +0000 Subject: [PATCH 015/182] Update README.md --- server-ce/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server-ce/README.md b/server-ce/README.md index eac83edd43..ffda2e1dfb 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -142,7 +142,7 @@ the package name. ### Configuration Options -You can pass configuration options to ShareLaTeX as environment variables: +You can pass the core configuration options to ShareLaTeX as environment variables: ``` $ docker run -d \ @@ -167,6 +167,8 @@ configured correctly! * `SHARELATEX_SECURE_COOKIE`: Set this to something non-zero to use a secure cookie. Only use this if your ShareLaTeX instance is running behind a reverse proxy with SSL configured. +Other settings such as email setup need to be edited in the docker container at /etc/sharelatex/settings.coffee. We realise this is not an ideal solution and are working on a more streamlined settings file approach. + ### Creating and Managing users Uun the following command to create your first user and make them an admin: From ac5dc0938cbc388796e7beb5ed2e6f4181e14bf7 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 9 Feb 2016 12:57:05 +0000 Subject: [PATCH 016/182] Update README.md --- server-ce/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/README.md b/server-ce/README.md index ffda2e1dfb..93e330a74f 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,4 +1,4 @@ -ShareLaTeX Docker Image +ShareLaTeX Comunity Docker Image ======================= **Please read this entire file before installing ShareLaTeX via Docker. It's only From 4ce4cc596ff9be80c952e44ff3a3012fcd4fdf8a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 8 Mar 2016 16:05:42 +0000 Subject: [PATCH 017/182] change localhost to 127.0.0.1 which should help with ipv6 --- server-ce/nginx/sharelatex.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-ce/nginx/sharelatex.conf b/server-ce/nginx/sharelatex.conf index e9d6566ffd..0111797967 100644 --- a/server-ce/nginx/sharelatex.conf +++ b/server-ce/nginx/sharelatex.conf @@ -5,7 +5,7 @@ server { set $static_path /var/www/sharelatex/web/public; location / { - proxy_pass http://localhost:3000; + proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; @@ -17,7 +17,7 @@ server { } location /socket.io { - proxy_pass http://localhost:3026; + proxy_pass http://127.0.0.1:3026; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; From 07ed8854aad4dd81a0a5d954432ed47bb1cb607e Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 6 Apr 2016 15:42:01 +0000 Subject: [PATCH 018/182] add session secret as env varx --- server-ce/settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 440b59f7fb..e2ee828a79 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -104,7 +104,7 @@ module.exports = # If provided, a sessionSecret is used to sign cookies so that they cannot be # spoofed. This is recommended. security: - sessionSecret: "CRYPTO_RANDOM" # This was randomly generated for you + sessionSecret: process.env["SHARELATEX_SESSION_SECRET"] or "CRYPTO_RANDOM" # This was randomly generated for you # These credentials are used for authenticating api requests # between services that may need to go over public channels From 30c9dba44e23804be9ac6354a994e0f5adfd4860 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 6 Apr 2016 17:07:59 +0100 Subject: [PATCH 019/182] made email and ldap configurable from env vars --- server-ce/settings.coffee | 107 +++++++++++++++++++++++++++++++------- 1 file changed, 87 insertions(+), 20 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 440b59f7fb..f385becb12 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -10,7 +10,8 @@ httpAuthUsers[httpAuthUser] = httpAuthPass DATA_DIR = '/var/lib/sharelatex/data' TMP_DIR = '/var/lib/sharelatex/tmp' -module.exports = +settings = + # Databases # --------- @@ -60,6 +61,7 @@ module.exports = backend: "fs" stores: user_files: Path.join(DATA_DIR, "user_files") + template_files: Path.join(DATA_DIR, "template_files") # To use Amazon S3 as a storage backend, comment out the above config, and # uncomment the following, filling in your key, secret, and bucket name: @@ -97,6 +99,11 @@ module.exports = # The name this is used to describe your ShareLaTeX Installation appName: process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX (Community Edition)" + + nav: + title: process.env["SHARELATEX_NAV_TITLE"] or process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX Comunity Edition" + + # The email address which users will be directed to as the main point of # contact for this installation of ShareLaTeX. adminEmail: process.env["SHARELATEX_ADMIN_EMAIL"] or "placeholder@example.com" @@ -104,7 +111,7 @@ module.exports = # If provided, a sessionSecret is used to sign cookies so that they cannot be # spoofed. This is recommended. security: - sessionSecret: "CRYPTO_RANDOM" # This was randomly generated for you + sessionSecret: process.env["SHARELATEX_SESSION_SECRET"] or "CRYPTO_RANDOM" # This was randomly generated for you # These credentials are used for authenticating api requests # between services that may need to go over public channels @@ -127,29 +134,13 @@ module.exports = # If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc) # then set this to true to allow it to correctly detect the forwarded IP # address and http/https protocol information. - behindProxy: true + behindProxy: process.env["SHARELATEX_BEHIND_PROXY"] or false - # Sending Email - # ------------- - # - # You must configure a mail server to be able to send invite emails from - # ShareLaTeX. The config settings are passed to nodemailer. See the nodemailer - # documentation for available options: - # - # http://www.nodemailer.com/docs/transports - # - # email: - # fromAddress: "" - # replyTo: "" - # transport: "SES" - # parameters: - # AWSAccessKeyID: "" - # AWSSecretKey: "" # Spell Check Languages # --------------------- # - # You must have the corresponding aspell dictionary installed to + # You must have the corresponding aspell dictionary installed to # be able to use a language. Run `grunt check:aspell` to check which # dictionaries you have installed. These should be set for the `code` for # each language. @@ -386,6 +377,9 @@ module.exports = # spelling: # port: spellingPort = 3005 # host: "localhost" + # templates: + # port: templatesPort = 3007 + # host: "localhost" # If you change the above config, or run some services on remote servers, # you need to tell the other services where to find them: @@ -410,7 +404,78 @@ module.exports = # url: "http://localhost:#{spellingPort}" # chat: # url: "http://localhost:#{chatPort}" + # templates: + # url: "http://localhost:#{templatesPort}" + + +#### OPTIONAL CONFIGERABLE SETTINGS + + +# Sending Email +# ------------- +# +# You must configure a mail server to be able to send invite emails from +# ShareLaTeX. The config settings are passed to nodemailer. See the nodemailer +# documentation for available options: +# +# http://www.nodemailer.com/docs/transports + + +if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] + settings.email: + fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] + replyTo: process.env["SHARELATEX_EMAIL_REPLY_TO"] or "" + parameters: + #AWS Creds + AWSAccessKeyID: process.env["SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID"] + AWSSecretKey: process.env["SHARELATEX_EMAIL_AWS_SES_SECRET_KEY"] + + #SMTP Creds + host: process.env["SHARELATEX_EMAIL_SMTP_HOST"] + port: process.env["SHARELATEX_EMAIL_SMTP_PORT"], + secure: process.env["SHARELATEX_EMAIL_SMTP_SECURE"] + auth: + user: process.env["SHARELATEX_EMAIL_SMTP_USER"] + pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"] + + +# Password Settings +# ----------- +# These restrict the passwords users can use when registering +# opts are from http://antelle.github.io/passfield +if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] + + settings.passwordStrengthOptions: + pattern: process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or "aA$3" + length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] or 50} + + +# LDAP - SERVER PRO ONLY +# ---------- +# Settings below use a working LDAP test server kindly provided by forumsys.com +# When testing with forumsys.com use username = einstein and password = password + + +if process.env["SHARELATEX_LDAP_HOST"] + settings.ldap : + host: process.env["SHARELATEX_LDAP_HOST"] + dn: process.env["SHARELATEX_LDAP_DN"] + baseSearch: process.env["SHARELATEX_LDAP_BASE_SEARCH"] + filter: process.env["SHARELATEX_LDAP_FILTER"] + failMessage: process.env["SHARELATEX_LDAP_FAIL_MESSAGE"] or 'LDAP User Fail' + fieldName: process.env["SHARELATEX_LDAP_FIELD_NAME"] or 'LDAP User' + placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] or 'LDAP User ID' + emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail' + anonymous: process.env["SHARELATEX_LDAP_ANONYMOUS"] or false + adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"] + adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] + + + + + + # With lots of incoming and outgoing HTTP connections to different services, # sometimes long running, it is a good idea to increase the default number @@ -419,3 +484,5 @@ http = require('http') http.globalAgent.maxSockets = 300 https = require('https') https.globalAgent.maxSockets = 300 + +module.exports = settings \ No newline at end of file From 98a0c1cdf1c81ad3aca88aaec454b36a728b9411 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 6 Apr 2016 17:10:43 +0100 Subject: [PATCH 020/182] added tls as env vars --- server-ce/settings.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index f385becb12..165d4c16d0 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -469,9 +469,11 @@ if process.env["SHARELATEX_LDAP_HOST"] emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail' anonymous: process.env["SHARELATEX_LDAP_ANONYMOUS"] or false adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"] - adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] - - + adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] + starttls: process.env["SHARELATEX_LDAP_TLS"] or false + tlsOptions: + rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] or false + ca: process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] # e.g.'/etc/ldap/ca_certs.pem' From 9e77f28bf6da9175d18962b9f5ced63510ec9f05 Mon Sep 17 00:00:00 2001 From: Vincent von Hof Date: Wed, 20 Apr 2016 12:54:11 +0200 Subject: [PATCH 021/182] Fix a typo in README.md nothing here...moving on --- server-ce/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/README.md b/server-ce/README.md index 93e330a74f..af2b50a377 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,4 +1,4 @@ -ShareLaTeX Comunity Docker Image +ShareLaTeX Community Docker Image ======================= **Please read this entire file before installing ShareLaTeX via Docker. It's only From e994ac8f1f514090eee5291c526ff5212feca64b Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Wed, 20 Apr 2016 21:55:47 -0300 Subject: [PATCH 022/182] add support for grunt build --- server-ce/Dockerfile | 11 ++++++++-- server-ce/Gruntfile.coffee | 38 +++++++++++++++++++++++++++++++++ server-ce/git-revision.js | 22 +++++++++++++++++++ server-ce/package.json | 11 ++++++++++ server-ce/services.js | 43 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 server-ce/Gruntfile.coffee create mode 100644 server-ce/git-revision.js create mode 100644 server-ce/package.json create mode 100644 server-ce/services.js diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index ff52a33198..7d813bd5d5 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -14,15 +14,22 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela # Install ShareLaTeX RUN apt-get install -y git python -RUN git clone -b release https://github.com/sharelatex/sharelatex.git /var/www/sharelatex -RUN cd /var/www/sharelatex && git pull origin release +RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex # zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. RUN apt-get install -y zlib1g-dev + +ADD services.js /var/www/sharelatex/config/services.js +ADD package.json /var/www/package.json +ADD git-revision.js /var/www/git-revision.js +RUN cd /var/www && npm install + RUN cd /var/www/sharelatex; \ npm install; \ grunt install; + +RUN cd /var/www && node git-revision > revisions.txt # Minify js assets RUN cd /var/www/sharelatex/web; \ diff --git a/server-ce/Gruntfile.coffee b/server-ce/Gruntfile.coffee new file mode 100644 index 0000000000..0f1d222059 --- /dev/null +++ b/server-ce/Gruntfile.coffee @@ -0,0 +1,38 @@ +services = require('./services') + +module.exports = (grunt) -> + + tag = grunt.option("tag") or 'latest' + repos = [] + for service in services + url = service.repo.split('/') + owner = url[3] + repo = url[4].replace('.git','') + repos.push "/repos/#{owner}/#{repo}/git/refs/heads/#{service.version}" + + grunt.initConfig + docker_io: + default_options: + options: + dockerFileLocation: '.' + buildName: 'sharelatex' + tag: grunt.option('tag') or 'latest' + push: grunt.option('push') or false + force: true + + github: + combinedRevisions: + options: + #oAuth: + # access_token: '' + concat: true + src: repos + dest: 'version/' + tag + '.json' + + grunt.loadNpmTasks 'grunt-docker-io' + grunt.loadNpmTasks 'grunt-github-api' + + grunt.registerTask 'build', ['docker_io', 'github'] + grunt.registerTask 'gitrev', ['github'] + + grunt.registerTask 'default', ['build'] diff --git a/server-ce/git-revision.js b/server-ce/git-revision.js new file mode 100644 index 0000000000..89359cea2e --- /dev/null +++ b/server-ce/git-revision.js @@ -0,0 +1,22 @@ +var simple = require('simple-git'); +var services = require('./sharelatex/config/services'); +const fs = require('fs'); + +function print_latest(repoDir) { + git = simple(repoDir); + opt = []; + opt['max-count'] = 1; + git.log(opt, function(err, log) { + if (!err) { + console.log(repoDir + ',' + log.latest.hash); + } + }) +} + +for (id in services) { + service = services[id]; + dirPath = __dirname + '/sharelatex/'+service.name; + if (fs.existsSync(dirPath)) { + print_latest(dirPath); + } +} diff --git a/server-ce/package.json b/server-ce/package.json new file mode 100644 index 0000000000..329169d96d --- /dev/null +++ b/server-ce/package.json @@ -0,0 +1,11 @@ +{ + "name": "none", + "author": "none", + "description": "none", + "dependencies": { + "grunt": "^0.4.5", + "grunt-docker-io": "^0.7.0", + "simple-git": "^1.32.1", + "grunt-github-api": "^0.2.3" + } +} diff --git a/server-ce/services.js b/server-ce/services.js new file mode 100644 index 0000000000..be4da8698a --- /dev/null +++ b/server-ce/services.js @@ -0,0 +1,43 @@ +module.exports = + +[{ + name: "web", + repo: "https://github.com/sharelatex/web-sharelatex.git", + version: "master" +}, { + name: "real-time", + repo: "https://github.com/sharelatex/real-time-sharelatex.git", + version: "master" +}, { + name: "document-updater", + repo: "https://github.com/sharelatex/document-updater-sharelatex.git", + version: "master" +}, { + name: "clsi", + repo: "https://github.com/sharelatex/clsi-sharelatex.git", + version: "master" +}, { + name: "filestore", + repo: "https://github.com/sharelatex/filestore-sharelatex.git", + version: "master" +}, { + name: "track-changes", + repo: "https://github.com/sharelatex/track-changes-sharelatex.git", + version: "master" +}, { + name: "docstore", + repo: "https://github.com/sharelatex/docstore-sharelatex.git", + version: "master" +}, { + name: "chat", + repo: "https://github.com/sharelatex/chat-sharelatex.git", + version: "master" +}, { + name: "tags", + repo: "https://github.com/sharelatex/tags-sharelatex.git", + version: "master" +}, { + name: "spelling", + repo: "https://github.com/sharelatex/spelling-sharelatex.git", + version: "master" +}] From 5fe0deab6dff1b29ccd6ff6fb8d2d43734731d00 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 28 Apr 2016 12:01:30 +0100 Subject: [PATCH 023/182] recommend mongodb 3.x --- server-ce/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/README.md b/server-ce/README.md index af2b50a377..e1a0c228b3 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -36,7 +36,7 @@ docker rm sharelatex ### Mongo and Redis -ShareLaTeX depends on [MongoDB](http://www.mongodb.org/) (must be 2.4 or later), and +ShareLaTeX depends on [MongoDB](http://www.mongodb.org/) (must be 2.4 or later, 3.x is recommended), and [Redis](http://redis.io/) (must be version 2.6.12 or later). These should be running on the host system. From 3e7595f3f2784e9dd63c4991a2fa0bacc6baf3eb Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 20 Apr 2016 21:55:47 -0300 Subject: [PATCH 024/182] add support for grunt build --- server-ce/Dockerfile | 11 ++++++++-- server-ce/Gruntfile.coffee | 38 +++++++++++++++++++++++++++++++++ server-ce/git-revision.js | 22 +++++++++++++++++++ server-ce/package.json | 11 ++++++++++ server-ce/services.js | 43 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 server-ce/Gruntfile.coffee create mode 100644 server-ce/git-revision.js create mode 100644 server-ce/package.json create mode 100644 server-ce/services.js diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index ff52a33198..7d813bd5d5 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -14,15 +14,22 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela # Install ShareLaTeX RUN apt-get install -y git python -RUN git clone -b release https://github.com/sharelatex/sharelatex.git /var/www/sharelatex -RUN cd /var/www/sharelatex && git pull origin release +RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex # zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. RUN apt-get install -y zlib1g-dev + +ADD services.js /var/www/sharelatex/config/services.js +ADD package.json /var/www/package.json +ADD git-revision.js /var/www/git-revision.js +RUN cd /var/www && npm install + RUN cd /var/www/sharelatex; \ npm install; \ grunt install; + +RUN cd /var/www && node git-revision > revisions.txt # Minify js assets RUN cd /var/www/sharelatex/web; \ diff --git a/server-ce/Gruntfile.coffee b/server-ce/Gruntfile.coffee new file mode 100644 index 0000000000..0f1d222059 --- /dev/null +++ b/server-ce/Gruntfile.coffee @@ -0,0 +1,38 @@ +services = require('./services') + +module.exports = (grunt) -> + + tag = grunt.option("tag") or 'latest' + repos = [] + for service in services + url = service.repo.split('/') + owner = url[3] + repo = url[4].replace('.git','') + repos.push "/repos/#{owner}/#{repo}/git/refs/heads/#{service.version}" + + grunt.initConfig + docker_io: + default_options: + options: + dockerFileLocation: '.' + buildName: 'sharelatex' + tag: grunt.option('tag') or 'latest' + push: grunt.option('push') or false + force: true + + github: + combinedRevisions: + options: + #oAuth: + # access_token: '' + concat: true + src: repos + dest: 'version/' + tag + '.json' + + grunt.loadNpmTasks 'grunt-docker-io' + grunt.loadNpmTasks 'grunt-github-api' + + grunt.registerTask 'build', ['docker_io', 'github'] + grunt.registerTask 'gitrev', ['github'] + + grunt.registerTask 'default', ['build'] diff --git a/server-ce/git-revision.js b/server-ce/git-revision.js new file mode 100644 index 0000000000..89359cea2e --- /dev/null +++ b/server-ce/git-revision.js @@ -0,0 +1,22 @@ +var simple = require('simple-git'); +var services = require('./sharelatex/config/services'); +const fs = require('fs'); + +function print_latest(repoDir) { + git = simple(repoDir); + opt = []; + opt['max-count'] = 1; + git.log(opt, function(err, log) { + if (!err) { + console.log(repoDir + ',' + log.latest.hash); + } + }) +} + +for (id in services) { + service = services[id]; + dirPath = __dirname + '/sharelatex/'+service.name; + if (fs.existsSync(dirPath)) { + print_latest(dirPath); + } +} diff --git a/server-ce/package.json b/server-ce/package.json new file mode 100644 index 0000000000..329169d96d --- /dev/null +++ b/server-ce/package.json @@ -0,0 +1,11 @@ +{ + "name": "none", + "author": "none", + "description": "none", + "dependencies": { + "grunt": "^0.4.5", + "grunt-docker-io": "^0.7.0", + "simple-git": "^1.32.1", + "grunt-github-api": "^0.2.3" + } +} diff --git a/server-ce/services.js b/server-ce/services.js new file mode 100644 index 0000000000..be4da8698a --- /dev/null +++ b/server-ce/services.js @@ -0,0 +1,43 @@ +module.exports = + +[{ + name: "web", + repo: "https://github.com/sharelatex/web-sharelatex.git", + version: "master" +}, { + name: "real-time", + repo: "https://github.com/sharelatex/real-time-sharelatex.git", + version: "master" +}, { + name: "document-updater", + repo: "https://github.com/sharelatex/document-updater-sharelatex.git", + version: "master" +}, { + name: "clsi", + repo: "https://github.com/sharelatex/clsi-sharelatex.git", + version: "master" +}, { + name: "filestore", + repo: "https://github.com/sharelatex/filestore-sharelatex.git", + version: "master" +}, { + name: "track-changes", + repo: "https://github.com/sharelatex/track-changes-sharelatex.git", + version: "master" +}, { + name: "docstore", + repo: "https://github.com/sharelatex/docstore-sharelatex.git", + version: "master" +}, { + name: "chat", + repo: "https://github.com/sharelatex/chat-sharelatex.git", + version: "master" +}, { + name: "tags", + repo: "https://github.com/sharelatex/tags-sharelatex.git", + version: "master" +}, { + name: "spelling", + repo: "https://github.com/sharelatex/spelling-sharelatex.git", + version: "master" +}] From 9ae564b1051e18e9999e2953bbf15468e8c1563b Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 2 May 2016 23:55:53 +0000 Subject: [PATCH 025/182] add baseDir for Dockerfile --- server-ce/Dockerfile | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 7d813bd5d5..2f9766efaa 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -1,5 +1,7 @@ FROM phusion/baseimage:0.9.16 +ENV baseDir . + # Install Node.js and Grunt RUN curl -sL https://deb.nodesource.com/setup | sudo bash - RUN apt-get install -y build-essential nodejs @@ -20,9 +22,9 @@ RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex RUN apt-get install -y zlib1g-dev -ADD services.js /var/www/sharelatex/config/services.js -ADD package.json /var/www/package.json -ADD git-revision.js /var/www/git-revision.js +ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js +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; \ @@ -39,11 +41,11 @@ RUN cd /var/www/sharelatex/web; \ run apt-get update RUN apt-get install -y nginx; RUN rm /etc/nginx/sites-enabled/default -ADD nginx/nginx.conf /etc/nginx/nginx.conf -ADD nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf +ADD ${baseDir}/nginx/nginx.conf /etc/nginx/nginx.conf +ADD ${baseDir}/nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf RUN mkdir /etc/service/nginx -ADD runit/nginx.sh /etc/service/nginx/run +ADD ${baseDir}/runit/nginx.sh /etc/service/nginx/run # Set up ShareLaTeX services to run automatically on boot RUN mkdir /etc/service/chat-sharelatex; \ @@ -57,16 +59,16 @@ RUN mkdir /etc/service/chat-sharelatex; \ mkdir /etc/service/track-changes-sharelatex; \ mkdir /etc/service/web-sharelatex; -ADD runit/chat-sharelatex.sh /etc/service/chat-sharelatex/run -ADD runit/clsi-sharelatex.sh /etc/service/clsi-sharelatex/run -ADD runit/docstore-sharelatex.sh /etc/service/docstore-sharelatex/run -ADD runit/document-updater-sharelatex.sh /etc/service/document-updater-sharelatex/run -ADD runit/filestore-sharelatex.sh /etc/service/filestore-sharelatex/run -ADD runit/real-time-sharelatex.sh /etc/service/real-time-sharelatex/run -ADD runit/spelling-sharelatex.sh /etc/service/spelling-sharelatex/run -ADD runit/tags-sharelatex.sh /etc/service/tags-sharelatex/run -ADD runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run -ADD runit/web-sharelatex.sh /etc/service/web-sharelatex/run +ADD ${baseDir}/runit/chat-sharelatex.sh /etc/service/chat-sharelatex/run +ADD ${baseDir}/runit/clsi-sharelatex.sh /etc/service/clsi-sharelatex/run +ADD ${baseDir}/runit/docstore-sharelatex.sh /etc/service/docstore-sharelatex/run +ADD ${baseDir}/runit/document-updater-sharelatex.sh /etc/service/document-updater-sharelatex/run +ADD ${baseDir}/runit/filestore-sharelatex.sh /etc/service/filestore-sharelatex/run +ADD ${baseDir}/runit/real-time-sharelatex.sh /etc/service/real-time-sharelatex/run +ADD ${baseDir}/runit/spelling-sharelatex.sh /etc/service/spelling-sharelatex/run +ADD ${baseDir}/runit/tags-sharelatex.sh /etc/service/tags-sharelatex/run +ADD ${baseDir}/runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run +ADD ${baseDir}/runit/web-sharelatex.sh /etc/service/web-sharelatex/run # Install TexLive RUN apt-get install -y wget @@ -93,14 +95,14 @@ RUN apt-get install -y unzip RUN apt-get install -y imagemagick optipng # phusion/baseimage init script -ADD 00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh -ADD 00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh -ADD 00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress.sh -ADD 99_migrate.sh /etc/my_init.d/99_migrate.sh +ADD ${baseDir}/00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh +ADD ${baseDir}/00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh +ADD ${baseDir}/00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress.sh +ADD ${baseDir}/99_migrate.sh /etc/my_init.d/99_migrate.sh # Install ShareLaTeX settings file RUN mkdir /etc/sharelatex -ADD settings.coffee /etc/sharelatex/settings.coffee +ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee EXPOSE 80 From b4f2eeec7fa882e35c8402d48e2378e0e54eebd4 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 9 May 2016 16:08:51 +0100 Subject: [PATCH 026/182] recommend debian/ubuntu --- server-ce/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server-ce/README.md b/server-ce/README.md index e1a0c228b3..5d6956d7f6 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -34,6 +34,9 @@ If you want to permanently remove ShareLaTeX from your docker containers: docker rm sharelatex ``` +### Operating systems +We recommend a debian based operating system such as Ubuntu for ShareLaTeX, this is what the software has been developed using and most people use when running ShareLaTeX. + ### Mongo and Redis ShareLaTeX depends on [MongoDB](http://www.mongodb.org/) (must be 2.4 or later, 3.x is recommended), and From 7eebc60aa59e07c863cb052d17de30bffe178c9f Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 11:30:25 +0100 Subject: [PATCH 027/182] added docker and and templates options for server pro --- server-ce/settings.coffee | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 165d4c16d0..06d34c567a 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -451,6 +451,15 @@ if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELA length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] or 50} + + +####################### +# ShareLaTeX Server Pro +####################### + + + + # LDAP - SERVER PRO ONLY # ---------- # Settings below use a working LDAP test server kindly provided by forumsys.com @@ -475,6 +484,26 @@ if process.env["SHARELATEX_LDAP_HOST"] rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] or false ca: process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] # e.g.'/etc/ldap/ca_certs.pem' +# Compiler +# -------- + +if process.env["DOCKER_IN_DOCKER"] + clsi: + commandRunner: "docker-runner-sharelatex" + docker: + image: "sharelatex-texlive" + env: + PATH: process.env["COMPILER_PATH"] or "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + user: "tex" + + +# Templates +# --------- +if process.env["SHARELATEX_TEMPLATES_USER_ID"] + templates: + mountPointUrl: "/templates" + user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"] + From fc11c63ac196b8742a17e68d2fa1f46b6786be2f Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 11:37:43 +0100 Subject: [PATCH 028/182] add git ignore --- server-ce/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 server-ce/.gitignore diff --git a/server-ce/.gitignore b/server-ce/.gitignore new file mode 100644 index 0000000000..c2658d7d1b --- /dev/null +++ b/server-ce/.gitignore @@ -0,0 +1 @@ +node_modules/ From 82e00ce700c74f115d53b82767b87e3a66c468eb Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 23 May 2016 11:38:09 +0000 Subject: [PATCH 029/182] ignore api-data --- server-ce/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/.gitignore b/server-ce/.gitignore index c2658d7d1b..84b9efb392 100644 --- a/server-ce/.gitignore +++ b/server-ce/.gitignore @@ -1 +1,2 @@ node_modules/ +api-data From f33d82088e7e7e4bc2eb99cd50bb4cfff6f43bec Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 12:39:06 +0100 Subject: [PATCH 030/182] use dir of versions not version --- server-ce/Gruntfile.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/Gruntfile.coffee b/server-ce/Gruntfile.coffee index 0f1d222059..fad7fc82da 100644 --- a/server-ce/Gruntfile.coffee +++ b/server-ce/Gruntfile.coffee @@ -27,7 +27,7 @@ module.exports = (grunt) -> # access_token: '' concat: true src: repos - dest: 'version/' + tag + '.json' + dest: 'versions/' + tag + '.json' grunt.loadNpmTasks 'grunt-docker-io' grunt.loadNpmTasks 'grunt-github-api' From ba2ef4f6bda035f07f519a624149fa3f81ffc5dd Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 12:43:26 +0100 Subject: [PATCH 031/182] move init scripts to init dir --- server-ce/Dockerfile | 8 ++++---- .../{ => init_scripts}/00_make_sharelatex_data_dirs.sh | 0 .../{ => init_scripts}/00_regen_sharelatex_secrets.sh | 0 .../{ => init_scripts}/00_set_docker_host_ipaddress.sh | 0 server-ce/{ => init_scripts}/99_migrate.sh | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename server-ce/{ => init_scripts}/00_make_sharelatex_data_dirs.sh (100%) rename server-ce/{ => init_scripts}/00_regen_sharelatex_secrets.sh (100%) rename server-ce/{ => init_scripts}/00_set_docker_host_ipaddress.sh (100%) rename server-ce/{ => init_scripts}/99_migrate.sh (100%) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 2f9766efaa..ca42eb7fc3 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -95,10 +95,10 @@ RUN apt-get install -y unzip RUN apt-get install -y imagemagick optipng # phusion/baseimage init script -ADD ${baseDir}/00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh -ADD ${baseDir}/00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh -ADD ${baseDir}/00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress.sh -ADD ${baseDir}/99_migrate.sh /etc/my_init.d/99_migrate.sh +ADD ${baseDir}/init_scripts/00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh +ADD ${baseDir}/init_scripts/00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh +ADD ${baseDir}/init_scripts/00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress.sh +ADD ${baseDir}/init_scripts/99_migrate.sh /etc/my_init.d/99_migrate.sh # Install ShareLaTeX settings file RUN mkdir /etc/sharelatex diff --git a/server-ce/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh similarity index 100% rename from server-ce/00_make_sharelatex_data_dirs.sh rename to server-ce/init_scripts/00_make_sharelatex_data_dirs.sh diff --git a/server-ce/00_regen_sharelatex_secrets.sh b/server-ce/init_scripts/00_regen_sharelatex_secrets.sh similarity index 100% rename from server-ce/00_regen_sharelatex_secrets.sh rename to server-ce/init_scripts/00_regen_sharelatex_secrets.sh diff --git a/server-ce/00_set_docker_host_ipaddress.sh b/server-ce/init_scripts/00_set_docker_host_ipaddress.sh similarity index 100% rename from server-ce/00_set_docker_host_ipaddress.sh rename to server-ce/init_scripts/00_set_docker_host_ipaddress.sh diff --git a/server-ce/99_migrate.sh b/server-ce/init_scripts/99_migrate.sh similarity index 100% rename from server-ce/99_migrate.sh rename to server-ce/init_scripts/99_migrate.sh From 5759c381b1e78eb99c61a827eaa34d164e1392ae Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 12:51:49 +0100 Subject: [PATCH 032/182] create templates dir --- server-ce/Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index ca42eb7fc3..006c9503f8 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -12,7 +12,11 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela mkdir -p /var/lib/sharelatex; \ chown sharelatex:sharelatex /var/lib/sharelatex; \ mkdir -p /var/log/sharelatex; \ - chown sharelatex:sharelatex /var/log/sharelatex; + chown sharelatex:sharelatex /var/log/sharelatex; \ + mkdir -p /var/lib/sharelatex/data/template_files; \ + chown sharelatex:sharelatex /var/lib/sharelatex/data/template_files; + + # Install ShareLaTeX RUN apt-get install -y git python @@ -57,7 +61,11 @@ RUN mkdir /etc/service/chat-sharelatex; \ mkdir /etc/service/spelling-sharelatex; \ mkdir /etc/service/tags-sharelatex; \ mkdir /etc/service/track-changes-sharelatex; \ - mkdir /etc/service/web-sharelatex; + mkdir /etc/service/web-sharelatex; + + + + ADD ${baseDir}/runit/chat-sharelatex.sh /etc/service/chat-sharelatex/run ADD ${baseDir}/runit/clsi-sharelatex.sh /etc/service/clsi-sharelatex/run From c852ff16d7f6491d57c2beb0c201f121ce23fa2b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 13:26:45 +0100 Subject: [PATCH 033/182] fixed bad coffeescript in settings file --- server-ce/settings.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index f479c13350..765c6c3354 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -423,7 +423,7 @@ settings = if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] - settings.email: + settings.email = fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] replyTo: process.env["SHARELATEX_EMAIL_REPLY_TO"] or "" parameters: @@ -446,7 +446,7 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] # opts are from http://antelle.github.io/passfield if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] - settings.passwordStrengthOptions: + settings.passwordStrengthOptions = pattern: process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or "aA$3" length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] or 50} @@ -467,7 +467,7 @@ if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELA if process.env["SHARELATEX_LDAP_HOST"] - settings.ldap : + settings.ldap = host: process.env["SHARELATEX_LDAP_HOST"] dn: process.env["SHARELATEX_LDAP_DN"] baseSearch: process.env["SHARELATEX_LDAP_BASE_SEARCH"] @@ -486,7 +486,6 @@ if process.env["SHARELATEX_LDAP_HOST"] # Compiler # -------- - if process.env["DOCKER_IN_DOCKER"] clsi: commandRunner: "docker-runner-sharelatex" From 35105269636ed23cf31f63e8cebf82bad4ab77bf Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 14:27:24 +0100 Subject: [PATCH 034/182] added strace and time --- server-ce/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 006c9503f8..c7081288f4 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -25,6 +25,9 @@ RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex # zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. RUN apt-get install -y zlib1g-dev +RUN apt-get install -y time +RUN apt-get install -y strace + ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js ADD ${baseDir}/package.json /var/www/package.json @@ -64,9 +67,6 @@ RUN mkdir /etc/service/chat-sharelatex; \ mkdir /etc/service/web-sharelatex; - - - ADD ${baseDir}/runit/chat-sharelatex.sh /etc/service/chat-sharelatex/run ADD ${baseDir}/runit/clsi-sharelatex.sh /etc/service/clsi-sharelatex/run ADD ${baseDir}/runit/docstore-sharelatex.sh /etc/service/docstore-sharelatex/run From a5d1c45c539c452289be9ab5fb082ebebf0d66cf Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 12:12:26 +0100 Subject: [PATCH 035/182] added missing ldap settings --- server-ce/settings.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 765c6c3354..7e4f88a327 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -480,7 +480,11 @@ if process.env["SHARELATEX_LDAP_HOST"] adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"] adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] starttls: process.env["SHARELATEX_LDAP_TLS"] or false - tlsOptions: + nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"] + lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] + + if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] + settings.ldap.tlsOptions = rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] or false ca: process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] # e.g.'/etc/ldap/ca_certs.pem' From 291602996be8e58ec5b672cc100316d502f47bc6 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 15:47:13 +0100 Subject: [PATCH 036/182] moved guide to official wiki --- server-ce/README.md | 215 +------------------------------------------- 1 file changed, 3 insertions(+), 212 deletions(-) diff --git a/server-ce/README.md b/server-ce/README.md index 5d6956d7f6..e5980183ac 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,214 +1,5 @@ -ShareLaTeX Community Docker Image -======================= +## Install +Please see the (offical wiki for install guides)[https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions] -**Please read this entire file before installing ShareLaTeX via Docker. It's only -short but contains some important information.** -The recommended way to install and run ShareLaTeX Community Edition is via [Docker](https://www.docker.com/): - -``` -$ docker run -d \ - -v ~/sharelatex_data:/var/lib/sharelatex \ - -p 5000:80 \ - --name=sharelatex \ - sharelatex/sharelatex -``` - -This will download the ShareLaTeX image and start it running in the background on port 5000. You should be able to access it at http://localhost:5000/. - -To stop ShareLaTeX: - -``` -docker stop sharelatex -``` - -and to start it again: - -``` -docker start sharelatex -``` - -If you want to permanently remove ShareLaTeX from your docker containers: - -``` -docker rm sharelatex -``` - -### Operating systems -We recommend a debian based operating system such as Ubuntu for ShareLaTeX, this is what the software has been developed using and most people use when running ShareLaTeX. - -### Mongo and Redis - -ShareLaTeX depends on [MongoDB](http://www.mongodb.org/) (must be 2.4 or later, 3.x is recommended), and -[Redis](http://redis.io/) (must be version 2.6.12 or later). -These should be running on the host system. - -Note that Docker containers each come with their own network stack, and Mongo and Redis -often listen by default on `127.0.0.1` which is not accessible on the host -from inside the Docker container. Instead, you should configure Mongo and Redis to -also listen on `172.17.42.1` (or whatever ip iddress the docker0 interface has on your -host). This can be done in `/etc/mongod.conf` and `/etc/redis/redis.conf`. - -``` -# /etc/mongod.conf -... -bind_ip = 172.17.42.1 -... -``` - -``` -# /etc/redis/redis.conf -... -bind 172.17.42.1 -... -``` - -By default the ShareLaTeX Docker container looks for these running on the host -machine at port 27017 (for Mongo) and port 6379 (for Redis). These are the defaults -ports for both databases so you shouldn't need to change them. - -If you want to point ShareLaTeX at a database in a different location, you can -configure the container with environment variables. See the **Configuration Options** -section below. - -*Note that `localhost` in the container refers only to the container, so if you -want to access services on the host machine then you should use `dockerhost`. -`dockerhost` refers to the the `172.17.42.1` ip address mentioned above.* For example: - -``` -$ docker run -d \ - -v ~/sharelatex_data:/var/lib/sharelatex \ - -p 5000:80 \ - --name=sharelatex \ - --env SHARELATEX_MONGO_URL=mongodb://dockerhost/sharelatex \ - sharelatex/sharelatex -``` - -### Storing Data - -The `-v ~/sharelatex_data:/var/lib/sharelatex` option in the `run` command tells -Docker to make the host directory `~/sharelatex_data` available inside the container for -ShareLaTeX to store data files in. This means that you can back up and access these -files manually outside of the ShareLaTeX container. If you would like to store ShareLaTeX data -in a different location, such as `/home/james/my_data`, just change this parameter: - -``` -$ docker run -d \ - -v /home/james/my_data:/var/lib/sharelatex \ - -p 80 \ - --name=sharelatex \ - sharelatex/sharelatex -``` - -Do not change the second part of this parameter (after the :). - -This is only where ShareLaTeX stores on-disk data. -Other data is also stored in Mongo and Redis. - -### Backups - -To backup the ShareLaTeX data, you need to backup the directory you have attached -to the container, as above. You also need to backup the Mongo and Redis databases. - -### Running on a different port - -The container listens on port 80 by default so you should be able to access -ShareLaTeX at http://localhost/. If you would like to run ShareLaTeX on a different -port (perhaps you have another service running on port 80, or want to put a proxy -in front of ShareLaTeX), then you can forward port 80 from the Docker container -to any other port with the `-p :80` option. For example, to have ShareLaTeX -listen on port 5000: - -``` -$ docker run -d \ - -v ~/sharelatex_data:/var/lib/sharelatex \ - -p 5000:80 \ - --name=sharelatex \ - --env SHARELATEX_SITE_URL=http://localhost:5000 \ - sharelatex/sharelatex -``` - -**(Note that you also have to update the `SHARELATEX_SITE_URL` parameter so that -ShareLaTeX knows where to refer to scripts and links that need loading.)** - -### LaTeX environment - -To save bandwidth, the ShareLaTeX image only comes with a minimal install of -TeXLive. To upgrade to a complete TeXLive installation, run the following command: - -``` -$ docker exec sharelatex tlmgr install scheme-full -``` - -Or you can install packages manually as you need by replacing `scheme-full` by -the package name. - -### Configuration Options - -You can pass the core configuration options to ShareLaTeX as environment variables: - -``` -$ docker run -d \ - -v ~/sharelatex_data:/var/lib/sharelatex \ - -p 5000:80 \ - --name=sharelatex \ - --env SHARELATEX_MONGO_URL=mongodb://my.mongo.host/sharelatex \ - sharelatex/sharelatex -``` - -The available configuration parameters are: - -* `SHARELATEX_SITE_URL`: Where your instance of ShareLaTeX is publically available. -This is used in public links, and when connecting over websockets, so must be -configured correctly! -* `SHARELATEX_ADMIN_EMAIL`: The email address where users can reach the person who runs the site. -* `SHARELATEX_APP_NAME`: The name to display when talking about the running app. Defaults to 'ShareLaTex (Community Edition)'. -* `SHARELATEX_MONGO_URL`: The URL of the Mongo database to use -* `SHARELATEX_REDIS_HOST`: The host name of the Redis instance to use -* `SHARELATEX_REDIS_PORT`: The port of the Redis instance to use -* `SHARELATEX_REDIS_PASS`: The password to use when connecting to Redis (if applicable) -* `SHARELATEX_SECURE_COOKIE`: Set this to something non-zero to use a secure cookie. - Only use this if your ShareLaTeX instance is running behind a reverse proxy with SSL configured. - -Other settings such as email setup need to be edited in the docker container at /etc/sharelatex/settings.coffee. We realise this is not an ideal solution and are working on a more streamlined settings file approach. - -### Creating and Managing users - -Uun the following command to create your first user and make them an admin: - -``` -$ docker exec sharelatex /bin/bash -c "cd /var/www/sharelatex/web; grunt create-admin-user --email joe@example.com" -``` - -This will create a user with the given email address if they don't already exist, and make them an admin user. You will be given a URL to visit where you can set the password for this user and log in for the first time. - -**Creating normal users** - -Once you are logged in as an admin user, you can visit `/admin/register` on your ShareLaTeX instance and create a new users. If you have an email backend configured in your settings file, the new users will be sent an email with a URL to set their password. If not, you will have to distribute the password reset URLs manually. These are shown when you create a user. - -### Upgrading from older versions - -*Please make sure to back up all Mongo, Redis and on-disk data before upgrading.* - -#### Migrations -Data stored in Mongodb will be automatically migrated to the latest schemea when upgrading docker releases. **This can make downgrades impossible.** One recommended technique is to test the migration first. This can be done by copying the mongodb database and doing a test run against the copied data. - -``` -db.copyDatabase(sharelatex,sharelatex-copy) -# start the container up pointing at the new db ---env SHARELATEX_MONGO_URL=mongodb://dockerhost/sharelatex-copy -``` - -#### Upgrade process -To use the new docker container stop and remove the currently running ShareLaTeX container: - -``` -$ docker stop sharelatex -$ docker rm sharelatex -``` - -Start a new container with the updated version of ShareLaTeX (to upgrade to version 1.4.0 for example): - -``` -$ docker run -d -v ~/sharelatex_data:/var/lib/sharelatex --name=sharelatex sharelatex/sharelatex:1.4.0 -``` +The docker files can be built with grunt. We do this as there are some other tasks which are done using grunt such as marking the versions of each repo used. From 28add83bca3521350a14686968e1010e977afb2b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 15:47:46 +0100 Subject: [PATCH 037/182] Update README.md --- server-ce/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/README.md b/server-ce/README.md index e5980183ac..0b11b2b198 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,5 +1,5 @@ ## Install -Please see the (offical wiki for install guides)[https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions] +Please see the [offical wiki for install guides](https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions) The docker files can be built with grunt. We do this as there are some other tasks which are done using grunt such as marking the versions of each repo used. From 252cbed435b96003f66704ca0335e69633ad295c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 15:48:02 +0100 Subject: [PATCH 038/182] Update README.md --- server-ce/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/README.md b/server-ce/README.md index 0b11b2b198..04a117bcb7 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,5 +1,6 @@ ## Install Please see the [offical wiki for install guides](https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions) +## Building image The docker files can be built with grunt. We do this as there are some other tasks which are done using grunt such as marking the versions of each repo used. From 879a23c8573f1c83bb78077fec80d7fdcddc5de7 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 16:43:08 +0100 Subject: [PATCH 039/182] fix templates & clsi set dynamically. and more robust bool vals from env vars --- server-ce/settings.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 7e4f88a327..2e2c738acb 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -476,22 +476,22 @@ if process.env["SHARELATEX_LDAP_HOST"] fieldName: process.env["SHARELATEX_LDAP_FIELD_NAME"] or 'LDAP User' placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] or 'LDAP User ID' emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail' - anonymous: process.env["SHARELATEX_LDAP_ANONYMOUS"] or false + anonymous: process.env["SHARELATEX_LDAP_ANONYMOUS"] == "true" adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"] adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] - starttls: process.env["SHARELATEX_LDAP_TLS"] or false + starttls: process.env["SHARELATEX_LDAP_TLS"] == "true" nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"] lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] settings.ldap.tlsOptions = - rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] or false + rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true" ca: process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] # e.g.'/etc/ldap/ca_certs.pem' # Compiler # -------- -if process.env["DOCKER_IN_DOCKER"] - clsi: +if process.env["DOCKER_IN_DOCKER"] == "true" + settings.clsi = commandRunner: "docker-runner-sharelatex" docker: image: "sharelatex-texlive" @@ -503,7 +503,7 @@ if process.env["DOCKER_IN_DOCKER"] # Templates # --------- if process.env["SHARELATEX_TEMPLATES_USER_ID"] - templates: + settings.templates = mountPointUrl: "/templates" user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"] From 61b8e67447874bfa8d83d4e8e6ec537a5526f19e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 26 May 2016 11:01:21 +0100 Subject: [PATCH 040/182] build latex first for faster images and compile clsi synctex --- server-ce/Dockerfile | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index c7081288f4..7fd51f7e01 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -2,6 +2,15 @@ FROM phusion/baseimage:0.9.16 ENV baseDir . +# Install TexLive +RUN apt-get install -y wget +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 + # Install Node.js and Grunt RUN curl -sL https://deb.nodesource.com/setup | sudo bash - RUN apt-get install -y build-essential nodejs @@ -17,7 +26,6 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela chown sharelatex:sharelatex /var/lib/sharelatex/data/template_files; - # Install ShareLaTeX RUN apt-get install -y git python RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex @@ -44,6 +52,9 @@ RUN cd /var/www && node git-revision > revisions.txt RUN cd /var/www/sharelatex/web; \ grunt compile:minify; +RUN cd /var/www/sharelatex/clsi; \ + grunt compile:bin + # Install Nginx as a reverse proxy run apt-get update RUN apt-get install -y nginx; @@ -78,14 +89,8 @@ ADD ${baseDir}/runit/tags-sharelatex.sh /etc/service/tags-sharelatex ADD ${baseDir}/runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run ADD ${baseDir}/runit/web-sharelatex.sh /etc/service/web-sharelatex/run -# Install TexLive -RUN apt-get install -y wget -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 + RUN rm -r /install-tl-unx; \ rm install-tl-unx.tar.gz @@ -113,6 +118,8 @@ RUN mkdir /etc/sharelatex ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee + + EXPOSE 80 ENTRYPOINT ["/sbin/my_init"] From 93ae1e015ff6cb2dd9a3eb165bab948c74db8bf8 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 26 May 2016 11:22:51 +0100 Subject: [PATCH 041/182] build things that don't change at the start for quicker build time --- server-ce/Dockerfile | 53 +++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 7fd51f7e01..9cfd8edc51 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -2,6 +2,10 @@ FROM phusion/baseimage:0.9.16 ENV baseDir . +RUN apt-get update +RUN curl -sL https://deb.nodesource.com/setup | sudo bash - +RUN apt-get install -y build-essential nodejs + # Install TexLive RUN apt-get install -y wget RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ @@ -12,10 +16,26 @@ RUN echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile; \ /install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile # Install Node.js and Grunt -RUN curl -sL https://deb.nodesource.com/setup | sudo bash - -RUN apt-get install -y build-essential nodejs RUN npm install -g grunt-cli +# Install Aspell +RUN apt-get install -y 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 unzip for file uploads +RUN apt-get install -y unzip + +# Install imagemagick for image conversions +RUN apt-get install -y imagemagick optipng + +# zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. +RUN apt-get install -y zlib1g-dev + +RUN apt-get install -y time +RUN apt-get install -y strace +RUN apt-get install -y nginx +RUN apt-get install -y git +RUN apt-get install -y python + # Set up sharelatex user and home directory RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex; \ mkdir -p /var/lib/sharelatex; \ @@ -27,16 +47,8 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela # Install ShareLaTeX -RUN apt-get install -y git python RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex -# zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. -RUN apt-get install -y zlib1g-dev - -RUN apt-get install -y time -RUN apt-get install -y strace - - ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js ADD ${baseDir}/package.json /var/www/package.json ADD ${baseDir}/git-revision.js /var/www/git-revision.js @@ -55,13 +67,6 @@ RUN cd /var/www/sharelatex/web; \ RUN cd /var/www/sharelatex/clsi; \ grunt compile:bin -# Install Nginx as a reverse proxy -run apt-get update -RUN apt-get install -y 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 - RUN mkdir /etc/service/nginx ADD ${baseDir}/runit/nginx.sh /etc/service/nginx/run @@ -89,7 +94,9 @@ ADD ${baseDir}/runit/tags-sharelatex.sh /etc/service/tags-sharelatex ADD ${baseDir}/runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run ADD ${baseDir}/runit/web-sharelatex.sh /etc/service/web-sharelatex/run - +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 RUN rm -r /install-tl-unx; \ rm install-tl-unx.tar.gz @@ -98,15 +105,6 @@ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local RUN apt-get update RUN tlmgr install latexmk -# Install Aspell -RUN apt-get install -y 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 unzip for file uploads -RUN apt-get install -y unzip - -# Install imagemagick for image conversions -RUN apt-get install -y imagemagick optipng - # phusion/baseimage init script ADD ${baseDir}/init_scripts/00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh ADD ${baseDir}/init_scripts/00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh @@ -119,7 +117,6 @@ ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee - EXPOSE 80 ENTRYPOINT ["/sbin/my_init"] From 9646654c481bfee3a504ab718e1b76fa47b2da21 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 27 May 2016 12:12:28 +0100 Subject: [PATCH 042/182] put apt-get installs on same line and set $TEX_LIVE_DOCKER_IMAGE via env var --- server-ce/Dockerfile | 20 +++----------------- server-ce/settings.coffee | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 9cfd8edc51..929528f274 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -4,10 +4,11 @@ ENV baseDir . RUN apt-get update RUN curl -sL https://deb.nodesource.com/setup | sudo bash - -RUN apt-get install -y build-essential nodejs +RUN apt-get install -y build-essential wget nodejs unzip time imagemagick optipng strace nginx git python zlib1g-dev; \ + install -y 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 TexLive -RUN apt-get install -y wget 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 @@ -18,23 +19,8 @@ RUN echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile; \ # Install Node.js and Grunt RUN npm install -g grunt-cli -# Install Aspell -RUN apt-get install -y 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 unzip for file uploads -RUN apt-get install -y unzip -# Install imagemagick for image conversions -RUN apt-get install -y imagemagick optipng - -# zlib1g-dev is needed to compile the synctex binaries in the CLSI during `grunt install`. -RUN apt-get install -y zlib1g-dev - -RUN apt-get install -y time -RUN apt-get install -y strace -RUN apt-get install -y nginx -RUN apt-get install -y git -RUN apt-get install -y python # Set up sharelatex user and home directory RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex; \ diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 2e2c738acb..f3066da8ed 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -494,7 +494,7 @@ if process.env["DOCKER_IN_DOCKER"] == "true" settings.clsi = commandRunner: "docker-runner-sharelatex" docker: - image: "sharelatex-texlive" + image: process.env["TEX_LIVE_DOCKER_IMAGE"] env: PATH: process.env["COMPILER_PATH"] or "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" user: "tex" From ab61d05e4af5dd4e9833d6739bf1d9b46f45f103 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 27 May 2016 12:55:18 +0100 Subject: [PATCH 043/182] run as www-data --- server-ce/Dockerfile | 6 +++--- server-ce/runit/chat-sharelatex.sh | 2 +- server-ce/runit/clsi-sharelatex.sh | 2 +- server-ce/runit/docstore-sharelatex.sh | 2 +- server-ce/runit/document-updater-sharelatex.sh | 2 +- server-ce/runit/filestore-sharelatex.sh | 2 +- server-ce/runit/real-time-sharelatex.sh | 2 +- server-ce/runit/spelling-sharelatex.sh | 2 +- server-ce/runit/tags-sharelatex.sh | 2 +- server-ce/runit/track-changes-sharelatex.sh | 2 +- server-ce/runit/web-sharelatex.sh | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 929528f274..eac17b83c1 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -25,11 +25,11 @@ 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 sharelatex:sharelatex /var/lib/sharelatex; \ + chown www-data:www-data /var/lib/sharelatex; \ mkdir -p /var/log/sharelatex; \ - chown sharelatex:sharelatex /var/log/sharelatex; \ + chown www-data:www-data /var/log/sharelatex; \ mkdir -p /var/lib/sharelatex/data/template_files; \ - chown sharelatex:sharelatex /var/lib/sharelatex/data/template_files; + chown www-data:www-data /var/lib/sharelatex/data/template_files; # Install ShareLaTeX diff --git a/server-ce/runit/chat-sharelatex.sh b/server-ce/runit/chat-sharelatex.sh index 509ff8588e..1b8533bb86 100755 --- a/server-ce/runit/chat-sharelatex.sh +++ b/server-ce/runit/chat-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/chat/app.js >> /var/log/sharelatex/chat.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/chat/app.js >> /var/log/sharelatex/chat.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/clsi-sharelatex.sh b/server-ce/runit/clsi-sharelatex.sh index 59298743c8..1c6974cd2a 100755 --- a/server-ce/runit/clsi-sharelatex.sh +++ b/server-ce/runit/clsi-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/clsi/app.js >> /var/log/sharelatex/clsi.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/clsi/app.js >> /var/log/sharelatex/clsi.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/docstore-sharelatex.sh b/server-ce/runit/docstore-sharelatex.sh index ba7a96c8d7..0de82ccf20 100755 --- a/server-ce/runit/docstore-sharelatex.sh +++ b/server-ce/runit/docstore-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/docstore/app.js >> /var/log/sharelatex/docstore.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/docstore/app.js >> /var/log/sharelatex/docstore.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/document-updater-sharelatex.sh b/server-ce/runit/document-updater-sharelatex.sh index 8f692ecdbe..274b7f9998 100755 --- a/server-ce/runit/document-updater-sharelatex.sh +++ b/server-ce/runit/document-updater-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/document-updater/app.js >> /var/log/sharelatex/document-updater.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/document-updater/app.js >> /var/log/sharelatex/document-updater.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/filestore-sharelatex.sh b/server-ce/runit/filestore-sharelatex.sh index b02695f747..e0858c01ce 100755 --- a/server-ce/runit/filestore-sharelatex.sh +++ b/server-ce/runit/filestore-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/real-time-sharelatex.sh b/server-ce/runit/real-time-sharelatex.sh index 19aaed457b..c57d1d489e 100755 --- a/server-ce/runit/real-time-sharelatex.sh +++ b/server-ce/runit/real-time-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /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/node /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/runit/spelling-sharelatex.sh b/server-ce/runit/spelling-sharelatex.sh index 848c6ac7d1..4466bcfcf5 100755 --- a/server-ce/runit/spelling-sharelatex.sh +++ b/server-ce/runit/spelling-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/spelling/app.js >> /var/log/sharelatex/spelling.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/spelling/app.js >> /var/log/sharelatex/spelling.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/tags-sharelatex.sh b/server-ce/runit/tags-sharelatex.sh index 8616c1356c..a5630ed4ff 100755 --- a/server-ce/runit/tags-sharelatex.sh +++ b/server-ce/runit/tags-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/tags/app.js >> /var/log/sharelatex/tags.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/tags/app.js >> /var/log/sharelatex/tags.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/track-changes-sharelatex.sh b/server-ce/runit/track-changes-sharelatex.sh index 347d8f021a..aeb812ef38 100755 --- a/server-ce/runit/track-changes-sharelatex.sh +++ b/server-ce/runit/track-changes-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/track-changes/app.js >> /var/log/sharelatex/track-changes.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/track-changes/app.js >> /var/log/sharelatex/track-changes.log 2>&1 \ No newline at end of file diff --git a/server-ce/runit/web-sharelatex.sh b/server-ce/runit/web-sharelatex.sh index b0bda54c81..053a55a326 100755 --- a/server-ce/runit/web-sharelatex.sh +++ b/server-ce/runit/web-sharelatex.sh @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser sharelatex /usr/bin/node /var/www/sharelatex/web/app.js >> /var/log/sharelatex/web.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/web/app.js >> /var/log/sharelatex/web.log 2>&1 \ No newline at end of file From 9760850d87b264cda62c62754c976f680195770b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 27 May 2016 13:12:22 +0100 Subject: [PATCH 044/182] one line the apt-get --- server-ce/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index eac17b83c1..e3ca178741 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -4,8 +4,7 @@ ENV baseDir . RUN apt-get update RUN curl -sL https://deb.nodesource.com/setup | sudo bash - -RUN apt-get install -y build-essential wget nodejs unzip time imagemagick optipng strace nginx git python zlib1g-dev; \ - install -y 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 +RUN apt-get install -y build-essential wget nodejs unzip time imagemagick optipng strace nginx git python zlib1g-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 TexLive From 4560a5ded1ffb9da484e7a841891b5a560372ecf Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 27 May 2016 15:46:51 +0100 Subject: [PATCH 045/182] run everything as www-data --- .../00_make_sharelatex_data_dirs.sh | 17 ++++++++++------- server-ce/settings.coffee | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh index f8d424f201..f48a95fde7 100755 --- a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh @@ -1,21 +1,24 @@ #!/bin/sh mkdir -p /var/lib/sharelatex/data -chown sharelatex:sharelatex /var/lib/sharelatex/data +chown www-data:www-data /var/lib/sharelatex/data mkdir -p /var/lib/sharelatex/data/user_files -chown sharelatex:sharelatex /var/lib/sharelatex/data/user_files +chown www-data:www-data /var/lib/sharelatex/data/user_files mkdir -p /var/lib/sharelatex/data/compiles -chown sharelatex:sharelatex /var/lib/sharelatex/data/compiles +chown www-data:www-data /var/lib/sharelatex/data/compiles mkdir -p /var/lib/sharelatex/data/cache -chown sharelatex:sharelatex /var/lib/sharelatex/data/cache +chown www-data:www-data /var/lib/sharelatex/data/cache mkdir -p /var/lib/sharelatex/tmp -chown sharelatex:sharelatex /var/lib/sharelatex/tmp +chown www-data:www-data /var/lib/sharelatex/tmp mkdir -p /var/lib/sharelatex/tmp/uploads -chown sharelatex:sharelatex /var/lib/sharelatex/tmp/uploads +chown www-data:www-data /var/lib/sharelatex/tmp/uploads mkdir -p /var/lib/sharelatex/tmp/dumpFolder -chown sharelatex:sharelatex /var/lib/sharelatex/tmp/dumpFolder \ No newline at end of file +chown www-data:www-data /var/lib/sharelatex/tmp/dumpFolder + + +chown www-data:www-data /var/lib/sharelatex/data/db.sqlite \ No newline at end of file diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index f3066da8ed..f6d48b3dc4 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -497,7 +497,7 @@ if process.env["DOCKER_IN_DOCKER"] == "true" image: process.env["TEX_LIVE_DOCKER_IMAGE"] env: PATH: process.env["COMPILER_PATH"] or "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - user: "tex" + user: "www-data" # Templates From 2c53672dbd5af99ea05778dafa2b7c19367d7ef6 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 31 May 2016 14:15:24 +0000 Subject: [PATCH 046/182] install qpdf v6 --- server-ce/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index e3ca178741..91fa6e4c4d 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -4,8 +4,12 @@ ENV baseDir . RUN apt-get update RUN curl -sL https://deb.nodesource.com/setup | sudo bash - -RUN apt-get install -y build-essential wget nodejs unzip time imagemagick optipng strace nginx git python zlib1g-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 +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 +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 TexLive RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ @@ -19,8 +23,6 @@ RUN echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile; \ 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; \ @@ -105,3 +107,4 @@ ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee EXPOSE 80 ENTRYPOINT ["/sbin/my_init"] + From 8a25755b8a949687de4a09cdbda68f017619e13a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 31 May 2016 15:16:31 +0100 Subject: [PATCH 047/182] set synctexBaseDir: () -> "/compile" if using docker in docker --- server-ce/Dockerfile | 2 ++ server-ce/settings.coffee | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 91fa6e4c4d..d7ca93d357 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -106,5 +106,7 @@ ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee EXPOSE 80 +WORKDIR / + ENTRYPOINT ["/sbin/my_init"] diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index f6d48b3dc4..e1b5c2ca5e 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -499,6 +499,10 @@ if process.env["DOCKER_IN_DOCKER"] == "true" PATH: process.env["COMPILER_PATH"] or "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" user: "www-data" + if !settings.path? + settings.path = {} + settings.path.synctexBaseDir = () -> "/compile" + # Templates # --------- From 73e4b42df72e2f867d33b76a488db059f02747e9 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 31 May 2016 15:21:26 +0100 Subject: [PATCH 048/182] use SANDBOXED_COMPILES not DOCKER_IN_DOCKER --- server-ce/settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index e1b5c2ca5e..55c964012b 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -490,7 +490,7 @@ if process.env["SHARELATEX_LDAP_HOST"] # Compiler # -------- -if process.env["DOCKER_IN_DOCKER"] == "true" +if process.env["SANDBOXED_COMPILES"] == "true" settings.clsi = commandRunner: "docker-runner-sharelatex" docker: From 2870b6a460e9edfc94f031eb82557a4557530371 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 31 May 2016 16:37:50 +0100 Subject: [PATCH 049/182] try cicule ci --- server-ce/circle.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 server-ce/circle.yml diff --git a/server-ce/circle.yml b/server-ce/circle.yml new file mode 100644 index 0000000000..6df3bd992e --- /dev/null +++ b/server-ce/circle.yml @@ -0,0 +1,13 @@ +# circle.yml +machine: + services: + - docker + +dependencies: + pre: + - grunt + +test: + post: + - docker run -d -v --name=sharelatex -p 5000:80 -; sleep 20 + - curl --retry 10 --retry-delay 5 -v http://localhost:5000/status From dad3a74a7f2bf10f17d1ffd80c90ce5261290894 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Thu, 9 Jun 2016 11:36:00 +0000 Subject: [PATCH 050/182] add grunt cut task --- server-ce/.gitignore | 1 + server-ce/Gruntfile.coffee | 7 +++++++ server-ce/package.json | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server-ce/.gitignore b/server-ce/.gitignore index 84b9efb392..023b43469e 100644 --- a/server-ce/.gitignore +++ b/server-ce/.gitignore @@ -1,2 +1,3 @@ node_modules/ api-data +versions/ diff --git a/server-ce/Gruntfile.coffee b/server-ce/Gruntfile.coffee index fad7fc82da..502fc13c36 100644 --- a/server-ce/Gruntfile.coffee +++ b/server-ce/Gruntfile.coffee @@ -3,6 +3,7 @@ services = require('./services') module.exports = (grunt) -> tag = grunt.option("tag") or 'latest' + to = grunt.option("to") or 'latest' repos = [] for service in services url = service.repo.split('/') @@ -29,10 +30,16 @@ module.exports = (grunt) -> src: repos dest: 'versions/' + tag + '.json' + rename: + main: + files: [{ src: ['versions/latest.json'], dest: 'versions/' + to + '.json'}] + grunt.loadNpmTasks 'grunt-docker-io' grunt.loadNpmTasks 'grunt-github-api' + grunt.loadNpmTasks 'grunt-contrib-rename' grunt.registerTask 'build', ['docker_io', 'github'] grunt.registerTask 'gitrev', ['github'] + grunt.registerTask 'cut', ['rename'] grunt.registerTask 'default', ['build'] diff --git a/server-ce/package.json b/server-ce/package.json index 329169d96d..e1efb9b159 100644 --- a/server-ce/package.json +++ b/server-ce/package.json @@ -4,8 +4,9 @@ "description": "none", "dependencies": { "grunt": "^0.4.5", + "grunt-contrib-rename": "0.0.3", "grunt-docker-io": "^0.7.0", - "simple-git": "^1.32.1", - "grunt-github-api": "^0.2.3" + "grunt-github-api": "^0.2.3", + "simple-git": "^1.32.1" } } From a40360feafe6483b9592c7d2c80999065a6ccc9a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 9 Jun 2016 16:21:54 +0100 Subject: [PATCH 051/182] allow header and footer to be configured via env vars --- server-ce/settings.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 55c964012b..1f782a68c6 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -136,6 +136,14 @@ settings = # address and http/https protocol information. behindProxy: process.env["SHARELATEX_BEHIND_PROXY"] or false + if process.env["SHARELATEX_LEFT_FOOTER"] + left_footer: process.env["SHARELATEX_LEFT_FOOTER"] + + if process.env["SHARELATEX_RIGHT_FOOTER"] + right_footer: process.env["SHARELATEX_RIGHT_FOOTER"] + + if process.env["SHARELATEX_HEADER"] + header: process.env["SHARELATEX_HEADER"] # Spell Check Languages # --------------------- From 342ab43c6b09a19dcaaff19ad1b6f10c5644fbaf Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 9 Jun 2016 16:22:27 +0100 Subject: [PATCH 052/182] point to texlive 2016 --- server-ce/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index d7ca93d357..097de9a123 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -88,7 +88,7 @@ ADD ${baseDir}/nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf 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/2015/bin/x86_64-linux/ +ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2016/bin/x86_64-linux/ RUN apt-get update RUN tlmgr install latexmk From 1519329dac84a21a530ac4f14f0e05971cafdbb5 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 9 Jun 2016 18:29:27 +0100 Subject: [PATCH 053/182] move left_footer and co to bottom of settings file --- server-ce/settings.coffee | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 1f782a68c6..0b0242e7fb 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -134,17 +134,9 @@ settings = # If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc) # then set this to true to allow it to correctly detect the forwarded IP # address and http/https protocol information. + behindProxy: process.env["SHARELATEX_BEHIND_PROXY"] or false - if process.env["SHARELATEX_LEFT_FOOTER"] - left_footer: process.env["SHARELATEX_LEFT_FOOTER"] - - if process.env["SHARELATEX_RIGHT_FOOTER"] - right_footer: process.env["SHARELATEX_RIGHT_FOOTER"] - - if process.env["SHARELATEX_HEADER"] - header: process.env["SHARELATEX_HEADER"] - # Spell Check Languages # --------------------- # @@ -419,6 +411,16 @@ settings = #### OPTIONAL CONFIGERABLE SETTINGS +if process.env["SHARELATEX_LEFT_FOOTER"]? + settings.left_footer = process.env["SHARELATEX_LEFT_FOOTER"] + +if process.env["SHARELATEX_RIGHT_FOOTER"]? + settings.right_footer = process.env["SHARELATEX_RIGHT_FOOTER"] + +if process.env["SHARELATEX_HEADER"]? + settingsheader = process.env["SHARELATEX_HEADER"] + + # Sending Email # ------------- # From 8b8dbb588c4670dcb5817de75800024ca62830f3 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 15 Jun 2016 17:08:21 +0100 Subject: [PATCH 054/182] remove grunfile and circule.yml file, consolodate in server pro --- server-ce/Gruntfile.coffee | 45 -------------------------------------- server-ce/README.md | 6 +---- server-ce/circle.yml | 13 ----------- 3 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 server-ce/Gruntfile.coffee delete mode 100644 server-ce/circle.yml diff --git a/server-ce/Gruntfile.coffee b/server-ce/Gruntfile.coffee deleted file mode 100644 index 502fc13c36..0000000000 --- a/server-ce/Gruntfile.coffee +++ /dev/null @@ -1,45 +0,0 @@ -services = require('./services') - -module.exports = (grunt) -> - - tag = grunt.option("tag") or 'latest' - to = grunt.option("to") or 'latest' - repos = [] - for service in services - url = service.repo.split('/') - owner = url[3] - repo = url[4].replace('.git','') - repos.push "/repos/#{owner}/#{repo}/git/refs/heads/#{service.version}" - - grunt.initConfig - docker_io: - default_options: - options: - dockerFileLocation: '.' - buildName: 'sharelatex' - tag: grunt.option('tag') or 'latest' - push: grunt.option('push') or false - force: true - - github: - combinedRevisions: - options: - #oAuth: - # access_token: '' - concat: true - src: repos - dest: 'versions/' + tag + '.json' - - rename: - main: - files: [{ src: ['versions/latest.json'], dest: 'versions/' + to + '.json'}] - - grunt.loadNpmTasks 'grunt-docker-io' - grunt.loadNpmTasks 'grunt-github-api' - grunt.loadNpmTasks 'grunt-contrib-rename' - - grunt.registerTask 'build', ['docker_io', 'github'] - grunt.registerTask 'gitrev', ['github'] - grunt.registerTask 'cut', ['rename'] - - grunt.registerTask 'default', ['build'] diff --git a/server-ce/README.md b/server-ce/README.md index 04a117bcb7..8e5cd84b8e 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,6 +1,2 @@ ## Install -Please see the [offical wiki for install guides](https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions) - -## Building image - -The docker files can be built with grunt. We do this as there are some other tasks which are done using grunt such as marking the versions of each repo used. +Please see the [offical wiki for install guides](https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions) \ No newline at end of file diff --git a/server-ce/circle.yml b/server-ce/circle.yml deleted file mode 100644 index 6df3bd992e..0000000000 --- a/server-ce/circle.yml +++ /dev/null @@ -1,13 +0,0 @@ -# circle.yml -machine: - services: - - docker - -dependencies: - pre: - - grunt - -test: - post: - - docker run -d -v --name=sharelatex -p 5000:80 -; sleep 20 - - curl --retry 10 --retry-delay 5 -v http://localhost:5000/status From e4cb26b58997f97fc57098e4ccafeb5ac1500a9b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 15 Jun 2016 17:08:48 +0100 Subject: [PATCH 055/182] fix spelling mistake with community --- server-ce/settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 0b0242e7fb..e5b775e298 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -101,7 +101,7 @@ settings = nav: - title: process.env["SHARELATEX_NAV_TITLE"] or process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX Comunity Edition" + title: process.env["SHARELATEX_NAV_TITLE"] or process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX Community Edition" # The email address which users will be directed to as the main point of From ce9659a43b00cdd36ae756fe7cc453a7c30c98af Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 17 Jun 2016 12:34:38 +0100 Subject: [PATCH 056/182] settings.header ! settingsheader --- server-ce/settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index e5b775e298..e813342ebd 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -418,7 +418,7 @@ if process.env["SHARELATEX_RIGHT_FOOTER"]? settings.right_footer = process.env["SHARELATEX_RIGHT_FOOTER"] if process.env["SHARELATEX_HEADER"]? - settingsheader = process.env["SHARELATEX_HEADER"] + settings.header = process.env["SHARELATEX_HEADER"] # Sending Email From 19179086f0926886ad4521648cfb5a4dfb681c7c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 17 Jun 2016 13:05:03 +0100 Subject: [PATCH 057/182] parse left and right footers as json --- server-ce/settings.coffee | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index e813342ebd..9e81e644a1 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -410,15 +410,22 @@ settings = #### OPTIONAL CONFIGERABLE SETTINGS - if process.env["SHARELATEX_LEFT_FOOTER"]? - settings.left_footer = process.env["SHARELATEX_LEFT_FOOTER"] + try + settings.nav.left_footer = JSON.parse(process.env["SHARELATEX_LEFT_FOOTER"]) + catch e + console.error("could not parse SHARELATEX_LEFT_FOOTER, not valid JSON") if process.env["SHARELATEX_RIGHT_FOOTER"]? - settings.right_footer = process.env["SHARELATEX_RIGHT_FOOTER"] + settings.nav.right_footer = process.env["SHARELATEX_RIGHT_FOOTER"] + try + settings.nav.right_footer = JSON.parse(process.env["SHARELATEX_RIGHT_FOOTER"]) + catch e + console.error("could not parse SHARELATEX_RIGHT_FOOTER, not valid JSON") + if process.env["SHARELATEX_HEADER"]? - settings.header = process.env["SHARELATEX_HEADER"] + settings.nav.header = process.env["SHARELATEX_HEADER"] # Sending Email From 3061c5d41a387a08b0b022f60c4f9f037e0257fd Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 22 Jun 2016 11:47:17 +0100 Subject: [PATCH 058/182] parse ca paths as json --- server-ce/settings.coffee | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 9e81e644a1..bfcf232267 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -422,7 +422,12 @@ if process.env["SHARELATEX_RIGHT_FOOTER"]? settings.nav.right_footer = JSON.parse(process.env["SHARELATEX_RIGHT_FOOTER"]) catch e console.error("could not parse SHARELATEX_RIGHT_FOOTER, not valid JSON") - + +if process.env["SHARELATEX_HEADER_IMAGE_URL"]? + settings.nav.custom_logo = process.env["SHARELATEX_HEADER_IMAGE_URL"] + +settings.nav.custom_logo = "http://www.bbc.co.uk/news/special/2015/newsspec_10857/bbc_news_logo.png" + if process.env["SHARELATEX_HEADER"]? settings.nav.header = process.env["SHARELATEX_HEADER"] @@ -501,9 +506,21 @@ if process.env["SHARELATEX_LDAP_HOST"] lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] + try + ca = JSON.parse(process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"]) + catch e + console.error "could not parse SHARELATEX_LDAP_TLS_OPTS_CA_PATH, invalid JSON" + + if typeof(ca) == 'string' + ca_paths = [ca] + else if typeof(ca) == 'object' && ca.length? + ca_paths = ca + else + console.error "problem parsing SHARELATEX_LDAP_TLS_OPTS_CA_PATH" + settings.ldap.tlsOptions = rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true" - ca: process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] # e.g.'/etc/ldap/ca_certs.pem' + ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem' # Compiler # -------- From ba493c73224d8facf635f55f5a7c838a4c0f9f1e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 22 Jun 2016 11:56:29 +0100 Subject: [PATCH 059/182] remove debugging line --- server-ce/settings.coffee | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index bfcf232267..b610bad137 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -426,9 +426,6 @@ if process.env["SHARELATEX_RIGHT_FOOTER"]? if process.env["SHARELATEX_HEADER_IMAGE_URL"]? settings.nav.custom_logo = process.env["SHARELATEX_HEADER_IMAGE_URL"] -settings.nav.custom_logo = "http://www.bbc.co.uk/news/special/2015/newsspec_10857/bbc_news_logo.png" - - if process.env["SHARELATEX_HEADER"]? settings.nav.header = process.env["SHARELATEX_HEADER"] @@ -510,7 +507,7 @@ if process.env["SHARELATEX_LDAP_HOST"] ca = JSON.parse(process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"]) catch e console.error "could not parse SHARELATEX_LDAP_TLS_OPTS_CA_PATH, invalid JSON" - + if typeof(ca) == 'string' ca_paths = [ca] else if typeof(ca) == 'object' && ca.length? From 88246ebd8e6a4669e29e41c4f2c3afb4a13ebbaa Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 23 Jun 2016 16:47:56 +0100 Subject: [PATCH 060/182] set smtp auth to null if not set --- server-ce/settings.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index b610bad137..a5c590edab 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -454,9 +454,11 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] host: process.env["SHARELATEX_EMAIL_SMTP_HOST"] port: process.env["SHARELATEX_EMAIL_SMTP_PORT"], secure: process.env["SHARELATEX_EMAIL_SMTP_SECURE"] - auth: - user: process.env["SHARELATEX_EMAIL_SMTP_USER"] - pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"] + +if process.env["SHARELATEX_EMAIL_SMTP_USER"] or process.env["SHARELATEX_EMAIL_SMTP_PASS"] + settings.email.parameters.auth = + user: process.env["SHARELATEX_EMAIL_SMTP_USER"] + pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"] # Password Settings From 11fd4bd479424266eeea51d56a4297351014d1ed Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 23 Jun 2016 16:48:05 +0100 Subject: [PATCH 061/182] set references to undefined so its not used yet --- server-ce/settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index a5c590edab..5fb1050505 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -388,6 +388,7 @@ settings = url: "http://localhost:3000" user: httpAuthUser pass: httpAuthPass + references:undefined # documentupdater: # url : "http://localhost:#{docUpdaterPort}" # clsi: From 3d116334e04cefe085e274992873a9cb8ec3d7c4 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Thu, 23 Jun 2016 22:07:30 +0000 Subject: [PATCH 062/182] touch sqlite file if it does not exist --- server-ce/init_scripts/00_make_sharelatex_data_dirs.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh index f48a95fde7..6269f1b2a9 100755 --- a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh @@ -20,5 +20,8 @@ chown www-data:www-data /var/lib/sharelatex/tmp/uploads mkdir -p /var/lib/sharelatex/tmp/dumpFolder chown www-data:www-data /var/lib/sharelatex/tmp/dumpFolder +if [ ! -e "/var/lib/sharelatex/data/db.sqlite" ]; then + touch /var/lib/sharelatex/data/db.sqlite +fi -chown www-data:www-data /var/lib/sharelatex/data/db.sqlite \ No newline at end of file +chown www-data:www-data /var/lib/sharelatex/data/db.sqlite From 330fe90a9a12be46217c8df9ce6ea813c2ad0382 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 14:06:50 +0100 Subject: [PATCH 063/182] don't call notifications --- server-ce/settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 5fb1050505..94fd2939b4 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -389,6 +389,8 @@ settings = user: httpAuthUser pass: httpAuthPass references:undefined + notifications:undefined + # documentupdater: # url : "http://localhost:#{docUpdaterPort}" # clsi: From 4a81192f709115138a1f6e60256a275183e83826 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 27 Jun 2016 14:50:46 +0100 Subject: [PATCH 064/182] added SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH and SHARELATEX_EMAIL_SMTP_IGNORE_TLS --- server-ce/settings.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 94fd2939b4..c7e9d1e873 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -443,7 +443,7 @@ if process.env["SHARELATEX_HEADER"]? # http://www.nodemailer.com/docs/transports -if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] +if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? settings.email = fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] @@ -457,12 +457,16 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] host: process.env["SHARELATEX_EMAIL_SMTP_HOST"] port: process.env["SHARELATEX_EMAIL_SMTP_PORT"], secure: process.env["SHARELATEX_EMAIL_SMTP_SECURE"] + ignoreTLS: process.env["SHARELATEX_EMAIL_SMTP_IGNORE_TLS"] -if process.env["SHARELATEX_EMAIL_SMTP_USER"] or process.env["SHARELATEX_EMAIL_SMTP_PASS"] +if process.env["SHARELATEX_EMAIL_SMTP_USER"]? or process.env["SHARELATEX_EMAIL_SMTP_PASS"]? settings.email.parameters.auth = - user: process.env["SHARELATEX_EMAIL_SMTP_USER"] - pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"] + user: process.env["SHARELATEX_EMAIL_SMTP_USER"] + pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"] +if process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]? + settings.email.parameters.tls = + rejectUnauthorized: process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"] # Password Settings # ----------- From 926e6fee41cc4a7de230a243ea51b01fdd4d578c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 27 Jun 2016 15:19:43 +0100 Subject: [PATCH 065/182] don't try and put properties on email if basic email is not configured --- server-ce/settings.coffee | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index c7e9d1e873..fe4b9303a1 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -459,14 +459,14 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? secure: process.env["SHARELATEX_EMAIL_SMTP_SECURE"] ignoreTLS: process.env["SHARELATEX_EMAIL_SMTP_IGNORE_TLS"] -if process.env["SHARELATEX_EMAIL_SMTP_USER"]? or process.env["SHARELATEX_EMAIL_SMTP_PASS"]? - settings.email.parameters.auth = - user: process.env["SHARELATEX_EMAIL_SMTP_USER"] - pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"] + if process.env["SHARELATEX_EMAIL_SMTP_USER"]? or process.env["SHARELATEX_EMAIL_SMTP_PASS"]? + settings.email.parameters.auth = + user: process.env["SHARELATEX_EMAIL_SMTP_USER"] + pass: process.env["SHARELATEX_EMAIL_SMTP_PASS"] -if process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]? - settings.email.parameters.tls = - rejectUnauthorized: process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"] + if process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]? + settings.email.parameters.tls = + rejectUnauthorized: process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"] # Password Settings # ----------- From 5786162e0934ab252886fc05b42e33256260212e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 28 Jun 2016 10:07:50 +0100 Subject: [PATCH 066/182] added learn wiki option and parse helper method --- server-ce/settings.coffee | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index fe4b9303a1..b396d37f66 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -7,6 +7,16 @@ httpAuthPass = "CRYPTO_RANDOM" # Randomly generated for you httpAuthUsers = {} httpAuthUsers[httpAuthUser] = httpAuthPass +parse = (option)-> + if option? + try + opt = JSON.parse(option) + return opt + catch err + console.error "problem parsing #{option}, invalid JSON" + return undefined + + DATA_DIR = '/var/lib/sharelatex/data' TMP_DIR = '/var/lib/sharelatex/tmp' @@ -456,9 +466,9 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? #SMTP Creds host: process.env["SHARELATEX_EMAIL_SMTP_HOST"] port: process.env["SHARELATEX_EMAIL_SMTP_PORT"], - secure: process.env["SHARELATEX_EMAIL_SMTP_SECURE"] - ignoreTLS: process.env["SHARELATEX_EMAIL_SMTP_IGNORE_TLS"] - + secure: parse(process.env["SHARELATEX_EMAIL_SMTP_SECURE"]) + ignoreTLS: parse(process.env["SHARELATEX_EMAIL_SMTP_IGNORE_TLS"]) + if process.env["SHARELATEX_EMAIL_SMTP_USER"]? or process.env["SHARELATEX_EMAIL_SMTP_PASS"]? settings.email.parameters.auth = user: process.env["SHARELATEX_EMAIL_SMTP_USER"] @@ -466,7 +476,7 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? if process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]? settings.email.parameters.tls = - rejectUnauthorized: process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"] + rejectUnauthorized: parse(process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]) # Password Settings # ----------- @@ -504,10 +514,10 @@ if process.env["SHARELATEX_LDAP_HOST"] fieldName: process.env["SHARELATEX_LDAP_FIELD_NAME"] or 'LDAP User' placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] or 'LDAP User ID' emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail' - anonymous: process.env["SHARELATEX_LDAP_ANONYMOUS"] == "true" + anonymous: parse(process.env["SHARELATEX_LDAP_ANONYMOUS"]) adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"] adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] - starttls: process.env["SHARELATEX_LDAP_TLS"] == "true" + starttls: parse(process.env["SHARELATEX_LDAP_TLS"]) nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"] lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] @@ -552,6 +562,10 @@ if process.env["SHARELATEX_TEMPLATES_USER_ID"] user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"] +# /Learn +# ------- +if process.env["SHARELATEX_PROXY_LEARN"]? + settings.proxyLearn = parse(process.env["SHARELATEX_PROXY_LEARN"]) From d58ebb2dd488c13a36275267cd4718926284e75f Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 28 Jun 2016 17:08:00 +0100 Subject: [PATCH 067/182] added custom footer for email option --- server-ce/settings.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index b396d37f66..e2f25ad934 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -469,6 +469,10 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? secure: parse(process.env["SHARELATEX_EMAIL_SMTP_SECURE"]) ignoreTLS: parse(process.env["SHARELATEX_EMAIL_SMTP_IGNORE_TLS"]) + + templates: + customFooter: process.env["SHARELATEX_CUSTOM_EMAIL_FOOTER"] + if process.env["SHARELATEX_EMAIL_SMTP_USER"]? or process.env["SHARELATEX_EMAIL_SMTP_PASS"]? settings.email.parameters.auth = user: process.env["SHARELATEX_EMAIL_SMTP_USER"] @@ -477,6 +481,7 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? if process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]? settings.email.parameters.tls = rejectUnauthorized: parse(process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]) + # Password Settings # ----------- From 60bfe17f2ce6f456b3906ae4c42831a39a12a21b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 30 Jun 2016 16:47:13 +0100 Subject: [PATCH 068/182] move install latexmk and path higher up --- server-ce/Dockerfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 097de9a123..dba9ac2066 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -19,6 +19,14 @@ RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ 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/2016/bin/x86_64-linux/ +RUN tlmgr install latexmk + + # Install Node.js and Grunt RUN npm install -g grunt-cli @@ -34,7 +42,7 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela # Install ShareLaTeX -RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex +RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex #random_change ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js ADD ${baseDir}/package.json /var/www/package.json @@ -85,13 +93,6 @@ 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 -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/2016/bin/x86_64-linux/ -RUN apt-get update -RUN tlmgr install latexmk - # phusion/baseimage init script ADD ${baseDir}/init_scripts/00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh ADD ${baseDir}/init_scripts/00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh From cb459a94b97d85a462da993ec36143967971521c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 30 Jun 2016 16:47:23 +0100 Subject: [PATCH 069/182] add permissions change for templates dir --- server-ce/init_scripts/00_make_sharelatex_data_dirs.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh index 6269f1b2a9..49e5b7ba6d 100755 --- a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh @@ -11,6 +11,9 @@ chown www-data:www-data /var/lib/sharelatex/data/compiles mkdir -p /var/lib/sharelatex/data/cache chown www-data:www-data /var/lib/sharelatex/data/cache +mkdir -p /var/lib/sharelatex/data/templates +chown www-data:www-data /var/lib/sharelatex/data/templates + mkdir -p /var/lib/sharelatex/tmp chown www-data:www-data /var/lib/sharelatex/tmp From 3d33e5bc985a916879679ca8681fb73fd0216398 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 30 Jun 2016 16:47:35 +0100 Subject: [PATCH 070/182] add echo for finished migrations in --- server-ce/init_scripts/99_migrate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/init_scripts/99_migrate.sh b/server-ce/init_scripts/99_migrate.sh index 762aae2806..d062496581 100755 --- a/server-ce/init_scripts/99_migrate.sh +++ b/server-ce/init_scripts/99_migrate.sh @@ -3,3 +3,4 @@ which node which grunt ls -al /var/www/sharelatex/migrations cd /var/www/sharelatex && grunt migrate -v +echo "All migrations finished" From 11667b379c38c14081fe6c1e15ac0ec4955f6dc1 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 14 Jul 2016 16:50:11 +0100 Subject: [PATCH 071/182] added dump folder and template files fix to init script --- server-ce/init_scripts/00_make_sharelatex_data_dirs.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh index 49e5b7ba6d..6085a087da 100755 --- a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh @@ -11,8 +11,11 @@ chown www-data:www-data /var/lib/sharelatex/data/compiles mkdir -p /var/lib/sharelatex/data/cache chown www-data:www-data /var/lib/sharelatex/data/cache -mkdir -p /var/lib/sharelatex/data/templates -chown www-data:www-data /var/lib/sharelatex/data/templates +mkdir -p /var/lib/sharelatex/data/template_files +chown www-data:www-data /var/lib/sharelatex/data/template_files + +mkdir -p /var/lib/sharelatex/tmp/dumpFolder +chown www-data:www-data /var/lib/sharelatex/tmp/dumpFolder mkdir -p /var/lib/sharelatex/tmp chown www-data:www-data /var/lib/sharelatex/tmp From 7818af50ba8fc7299d085e020cb55457ef4699a2 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 3 Aug 2016 16:21:44 +0100 Subject: [PATCH 072/182] add contacts to services.js --- server-ce/services.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server-ce/services.js b/server-ce/services.js index be4da8698a..3614b2c020 100644 --- a/server-ce/services.js +++ b/server-ce/services.js @@ -40,4 +40,8 @@ module.exports = name: "spelling", repo: "https://github.com/sharelatex/spelling-sharelatex.git", version: "master" +}, { + name: "contacts", + repo: "https://github.com/sharelatex/contacts-sharelatex.git", + version: "master" }] From 67cc868c4bec13987418c128aefe9e556e0b4077 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 3 Aug 2016 16:22:10 +0100 Subject: [PATCH 073/182] add template links SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS to config file --- server-ce/settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index e2f25ad934..86d49e39ec 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -565,6 +565,8 @@ if process.env["SHARELATEX_TEMPLATES_USER_ID"] settings.templates = mountPointUrl: "/templates" user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"] + + settings.templateLinks: parse(process.env["SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS"]) # /Learn From 81d99e968ffc43f476abeef5b655042b970af9f2 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 3 Aug 2016 16:22:17 +0100 Subject: [PATCH 074/182] add logrotate --- server-ce/Dockerfile | 2 ++ server-ce/logrotate/sharelatex | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 server-ce/logrotate/sharelatex diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index dba9ac2066..41aaa7e20c 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -6,6 +6,8 @@ RUN apt-get update RUN curl -sL https://deb.nodesource.com/setup | 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 +ADD logrotate/sharelatex /etc/logrotate.d/sharelatex + 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 diff --git a/server-ce/logrotate/sharelatex b/server-ce/logrotate/sharelatex new file mode 100644 index 0000000000..efc51cc6c9 --- /dev/null +++ b/server-ce/logrotate/sharelatex @@ -0,0 +1,9 @@ +/var/log/sharelatex/*.log { + daily + missingok + rotate 5 + compress + copytruncate + notifempty + create 644 root adm +} \ No newline at end of file From 37142832280cb88b7df0610cc9f5b7cfeb0f391a Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Thu, 4 Aug 2016 13:19:33 +0000 Subject: [PATCH 075/182] cleaned up settings file and added refernces option in --- server-ce/settings.coffee | 274 ++++++++++++-------------------------- 1 file changed, 82 insertions(+), 192 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index e2f25ad934..3bbed39856 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -155,270 +155,146 @@ settings = # dictionaries you have installed. These should be set for the `code` for # each language. languages: [{ - "code":"en", - "name":"English (American)" + "code":"en", "name":"English (American)" },{ - "code":"en_GB", - "name":"English (British)" + "code":"en_GB", "name":"English (British)" },{ - "code":"af", - "name":"Africaans" + "code":"af", "name":"Africaans" },{ - "code":"am", - "name":"Amharic" + "code":"am", "name":"Amharic" },{ - "code":"ar", - "name":"Arabic" + "code":"ar", "name":"Arabic" },{ - "code":"hy", - "name":"Armenian" + "code":"hy", "name":"Armenian" },{ - "code":"gl", - "name":"Galician" + "code":"gl", "name":"Galician" },{ - "code":"eu", - "name":"Basque" + "code":"eu", "name":"Basque" },{ - "code":"bn", - "name":"Bengali" + "code":"bn", "name":"Bengali" },{ - "code":"br", - "name":"Breton" + "code":"br", "name":"Breton" },{ - "code":"bg", - "name":"Bulgarian" + "code":"bg", "name":"Bulgarian" },{ - "code":"ca", - "name":"Catalan" + "code":"ca", "name":"Catalan" },{ - "code":"hr", - "name":"Croatian" + "code":"hr", "name":"Croatian" },{ - "code":"cs", - "name":"Czech" + "code":"cs", "name":"Czech" },{ - "code":"da", - "name":"Danish" + "code":"da", "name":"Danish" },{ - "code":"nl", - "name":"Dutch" + "code":"nl", "name":"Dutch" },{ - "code":"eo", - "name":"Esperanto" + "code":"eo", "name":"Esperanto" },{ - "code":"et", - "name":"Estonian" + "code":"et", "name":"Estonian" },{ - "code":"fo", - "name":"Faroese" + "code":"fo", "name":"Faroese" },{ - "code":"fr", - "name":"French" + "code":"fr", "name":"French" },{ - "code":"de", - "name":"German" + "code":"de", "name":"German" },{ - "code":"el", - "name":"Greek" + "code":"el", "name":"Greek" },{ - "code":"gu", - "name":"Gujarati" + "code":"gu", "name":"Gujarati" },{ - "code":"he", - "name":"Hebrew" + "code":"he", "name":"Hebrew" },{ - "code":"hi", - "name":"Hindi" + "code":"hi", "name":"Hindi" },{ - "code":"hu", - "name":"Hungarian" + "code":"hu", "name":"Hungarian" },{ - "code":"is", - "name":"Icelandic" + "code":"is", "name":"Icelandic" },{ - "code":"id", - "name":"Indonesian" + "code":"id", "name":"Indonesian" },{ - "code":"ga", - "name":"Irish" + "code":"ga", "name":"Irish" },{ - "code":"it", - "name":"Italian" + "code":"it", "name":"Italian" },{ - "code":"kn", - "name":"Kannada" + "code":"kn", "name":"Kannada" },{ - "code":"kk", - "name":"Kazakh" + "code":"kk", "name":"Kazakh" },{ - "code":"ku", - "name":"Kurdish" + "code":"ku", "name":"Kurdish" },{ - "code":"lv", - "name":"Latvian" + "code":"lv", "name":"Latvian" },{ - "code":"lt", - "name":"Lithuanian" + "code":"lt", "name":"Lithuanian" },{ - "code":"ml", - "name":"Malayalam" + "code":"ml", "name":"Malayalam" },{ - "code":"mr", - "name":"Marathi" + "code":"mr", "name":"Marathi" },{ - "code":"nr", - "name":"Ndebele" + "code":"nr", "name":"Ndebele" },{ - "code":"ns", - "name":"Northern Sotho" + "code":"ns", "name":"Northern Sotho" },{ - "code":"no", - "name":"Norwegian" + "code":"no", "name":"Norwegian" },{ - "code":"or", - "name":"Oriya" + "code":"or", "name":"Oriya" },{ - "code":"fa", - "name":"Persian" + "code":"fa", "name":"Persian" },{ - "code":"pl", - "name":"Polish" + "code":"pl", "name":"Polish" },{ - "code":"pt_BR", - "name":"Portuguese (Brazilian)" + "code":"pt_BR", "name":"Portuguese (Brazilian)" },{ - "code":"pt_PT", - "name":"Portuguese (European)" + "code":"pt_PT", "name":"Portuguese (European)" },{ - "code":"pa", - "name":"Punjabi" + "code":"pa", "name":"Punjabi" },{ - "code":"ro", - "name":"Romanian" + "code":"ro", "name":"Romanian" },{ - "code":"ru", - "name":"Russian" + "code":"ru", "name":"Russian" },{ - "code":"sk", - "name":"Slovak" + "code":"sk", "name":"Slovak" },{ - "code":"sl", - "name":"Slovenian" + "code":"sl", "name":"Slovenian" },{ - "code":"st", - "name":"Southern Sotho" + "code":"st", "name":"Southern Sotho" },{ - "code":"es", - "name":"Spanish" + "code":"es", "name":"Spanish" },{ - "code":"ss", - "name":"Swazi" + "code":"ss", "name":"Swazi" },{ - "code":"sv", - "name":"Swedish" + "code":"sv", "name":"Swedish" },{ - "code":"tl", - "name":"Tagalog" + "code":"tl", "name":"Tagalog" },{ - "code":"ta", - "name":"Tamil" + "code":"ta", "name":"Tamil" },{ - "code":"te", - "name":"Telugu" + "code":"te", "name":"Telugu" },{ - "code":"ts", - "name":"Tsonga" + "code":"ts", "name":"Tsonga" },{ - "code":"tn", - "name":"Tswana" + "code":"tn", "name":"Tswana" },{ - "code":"uk", - "name":"Ukrainian" + "code":"uk", "name":"Ukrainian" },{ - "code":"hsb", - "name":"Upper Sorbian" + "code":"hsb", "name":"Upper Sorbian" },{ - "code":"uz", - "name":"Uzbek" + "code":"uz", "name":"Uzbek" },{ - "code":"cy", - "name":"Welsh" + "code":"cy", "name":"Welsh" },{ - "code":"xh", - "name":"Xhosa" + "code":"xh", "name":"Xhosa" },{ - "code":"zu", - "name":"Zulu" + "code":"zu", "name":"Zulu" } ] - - # Service locations - # ----------------- - # ShareLaTeX is comprised of many small services, which each expose - # an HTTP API running on a different port. Generally you - # can leave these as they are unless you have some other services - # running which conflict, or want to run the web process on port 80. - # internal: - # web: - # port: webPort = 3000 - # host: "localhost" - # documentupdater: - # port: docUpdaterPort = 3003 - # host: "localhost" - # filestore: - # port: filestorePort = 3009 - # host: "localhost" - # chat: - # port: chatPort = 3010 - # host: "localhost" - # tags: - # port: tagsPort = 3012 - # host: "localhost" - # clsi: - # port: clsiPort = 3013 - # host: "localhost" - # trackchanges: - # port: trackchangesPort = 3015 - # host: "localhost" - # docstore: - # port: docstorePort = 3016 - # host: "localhost" - # spelling: - # port: spellingPort = 3005 - # host: "localhost" - # templates: - # port: templatesPort = 3007 - # host: "localhost" - - # If you change the above config, or run some services on remote servers, - # you need to tell the other services where to find them: apis: web: url: "http://localhost:3000" user: httpAuthUser pass: httpAuthPass - references:undefined + references:{} notifications:undefined - # documentupdater: - # url : "http://localhost:#{docUpdaterPort}" - # clsi: - # url: "http://localhost:#{clsiPort}" - # filestore: - # url: "http://localhost:#{filestorePort}" - # trackchanges: - # url: "http://localhost:#{trackchangesPort}" - # docstore: - # url: "http://localhost:#{docstorePort}" - # tags: - # url: "http://localhost:#{tagsPort}" - # spelling: - # url: "http://localhost:#{spellingPort}" - # chat: - # url: "http://localhost:#{chatPort}" - # templates: - # url: "http://localhost:#{templatesPort}" #### OPTIONAL CONFIGERABLE SETTINGS @@ -440,7 +316,10 @@ if process.env["SHARELATEX_HEADER_IMAGE_URL"]? settings.nav.custom_logo = process.env["SHARELATEX_HEADER_IMAGE_URL"] if process.env["SHARELATEX_HEADER"]? - settings.nav.header = process.env["SHARELATEX_HEADER"] + settings.nav.header = process.env["SHARELATEX_HEADER_NAV_LINKS"] + +# if process.env["SHARELATEX_PROXY_LEARN"]? +# settings.nav.header.push({text: "help", class: "subdued", dropdown: [{text: "documentation", url: "/learn"}] }) # Sending Email @@ -500,7 +379,9 @@ if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELA # ShareLaTeX Server Pro ####################### - +if parse(process.env["SHARELATEX_IS_SERVER_PRO"]) == true + settings.apis.references = + url: "http://localhost:3040" # LDAP - SERVER PRO ONLY @@ -565,6 +446,8 @@ if process.env["SHARELATEX_TEMPLATES_USER_ID"] settings.templates = mountPointUrl: "/templates" user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"] + + settings.templateLinks = parse(process.env["SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS"]) # /Learn @@ -573,6 +456,12 @@ if process.env["SHARELATEX_PROXY_LEARN"]? settings.proxyLearn = parse(process.env["SHARELATEX_PROXY_LEARN"]) +# /References +# ----------- +if process.env["SHARELATEX_ELASTICSEARCH_URL"]? + settings.references.elasticsearch = + host: process.env["SHARELATEX_ELASTICSEARCH_URL"] + # With lots of incoming and outgoing HTTP connections to different services, # sometimes long running, it is a good idea to increase the default number @@ -583,3 +472,4 @@ https = require('https') https.globalAgent.maxSockets = 300 module.exports = settings + From 507c0dc65689ba516cfd64f889e74cfc3a2b3f0d Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 5 Aug 2016 11:59:39 +0100 Subject: [PATCH 076/182] cleaned up dockerfile more, removing undded things --- server-ce/Dockerfile | 51 ++++--------------- .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 server-ce/runit/{nginx.sh => nginx/run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 12 files changed, 9 insertions(+), 42 deletions(-) rename server-ce/runit/{chat-sharelatex.sh => chat-sharelatex/run.sh} (100%) rename server-ce/runit/{clsi-sharelatex.sh => clsi-sharelatex/run.sh} (100%) rename server-ce/runit/{docstore-sharelatex.sh => docstore-sharelatex/run.sh} (100%) rename server-ce/runit/{document-updater-sharelatex.sh => document-updater-sharelatex/run.sh} (100%) rename server-ce/runit/{filestore-sharelatex.sh => filestore-sharelatex/run.sh} (100%) rename server-ce/runit/{nginx.sh => nginx/run.sh} (100%) rename server-ce/runit/{real-time-sharelatex.sh => real-time-sharelatex/run.sh} (100%) rename server-ce/runit/{spelling-sharelatex.sh => spelling-sharelatex/run.sh} (100%) rename server-ce/runit/{tags-sharelatex.sh => tags-sharelatex/run.sh} (100%) rename server-ce/runit/{track-changes-sharelatex.sh => track-changes-sharelatex/run.sh} (100%) rename server-ce/runit/{web-sharelatex.sh => web-sharelatex/run.sh} (100%) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 41aaa7e20c..240404ca65 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -21,18 +21,14 @@ RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ 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/2016/bin/x86_64-linux/ RUN tlmgr install latexmk - -# Install Node.js and Grunt 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; \ @@ -43,6 +39,15 @@ RUN adduser --system --group --home /var/www/sharelatex --no-create-home sharela chown www-data:www-data /var/lib/sharelatex/data/template_files; +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 + +COPY {baseDir}/init_scripts /etc/my_init.d/ + + # Install ShareLaTeX RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex #random_change @@ -64,45 +69,7 @@ RUN cd /var/www/sharelatex/web; \ RUN cd /var/www/sharelatex/clsi; \ grunt compile:bin -RUN mkdir /etc/service/nginx -ADD ${baseDir}/runit/nginx.sh /etc/service/nginx/run - -# Set up ShareLaTeX services to run automatically on boot -RUN mkdir /etc/service/chat-sharelatex; \ - mkdir /etc/service/clsi-sharelatex; \ - mkdir /etc/service/docstore-sharelatex; \ - mkdir /etc/service/document-updater-sharelatex; \ - mkdir /etc/service/filestore-sharelatex; \ - mkdir /etc/service/real-time-sharelatex; \ - mkdir /etc/service/spelling-sharelatex; \ - mkdir /etc/service/tags-sharelatex; \ - mkdir /etc/service/track-changes-sharelatex; \ - mkdir /etc/service/web-sharelatex; - - -ADD ${baseDir}/runit/chat-sharelatex.sh /etc/service/chat-sharelatex/run -ADD ${baseDir}/runit/clsi-sharelatex.sh /etc/service/clsi-sharelatex/run -ADD ${baseDir}/runit/docstore-sharelatex.sh /etc/service/docstore-sharelatex/run -ADD ${baseDir}/runit/document-updater-sharelatex.sh /etc/service/document-updater-sharelatex/run -ADD ${baseDir}/runit/filestore-sharelatex.sh /etc/service/filestore-sharelatex/run -ADD ${baseDir}/runit/real-time-sharelatex.sh /etc/service/real-time-sharelatex/run -ADD ${baseDir}/runit/spelling-sharelatex.sh /etc/service/spelling-sharelatex/run -ADD ${baseDir}/runit/tags-sharelatex.sh /etc/service/tags-sharelatex/run -ADD ${baseDir}/runit/track-changes-sharelatex.sh /etc/service/track-changes-sharelatex/run -ADD ${baseDir}/runit/web-sharelatex.sh /etc/service/web-sharelatex/run - -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 - -# phusion/baseimage init script -ADD ${baseDir}/init_scripts/00_regen_sharelatex_secrets.sh /etc/my_init.d/00_regen_sharelatex_secrets.sh -ADD ${baseDir}/init_scripts/00_make_sharelatex_data_dirs.sh /etc/my_init.d/00_make_sharelatex_data_dirs.sh -ADD ${baseDir}/init_scripts/00_set_docker_host_ipaddress.sh /etc/my_init.d/00_set_docker_host_ipaddress.sh -ADD ${baseDir}/init_scripts/99_migrate.sh /etc/my_init.d/99_migrate.sh - # Install ShareLaTeX settings file -RUN mkdir /etc/sharelatex ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee diff --git a/server-ce/runit/chat-sharelatex.sh b/server-ce/runit/chat-sharelatex/run.sh similarity index 100% rename from server-ce/runit/chat-sharelatex.sh rename to server-ce/runit/chat-sharelatex/run.sh diff --git a/server-ce/runit/clsi-sharelatex.sh b/server-ce/runit/clsi-sharelatex/run.sh similarity index 100% rename from server-ce/runit/clsi-sharelatex.sh rename to server-ce/runit/clsi-sharelatex/run.sh diff --git a/server-ce/runit/docstore-sharelatex.sh b/server-ce/runit/docstore-sharelatex/run.sh similarity index 100% rename from server-ce/runit/docstore-sharelatex.sh rename to server-ce/runit/docstore-sharelatex/run.sh diff --git a/server-ce/runit/document-updater-sharelatex.sh b/server-ce/runit/document-updater-sharelatex/run.sh similarity index 100% rename from server-ce/runit/document-updater-sharelatex.sh rename to server-ce/runit/document-updater-sharelatex/run.sh diff --git a/server-ce/runit/filestore-sharelatex.sh b/server-ce/runit/filestore-sharelatex/run.sh similarity index 100% rename from server-ce/runit/filestore-sharelatex.sh rename to server-ce/runit/filestore-sharelatex/run.sh diff --git a/server-ce/runit/nginx.sh b/server-ce/runit/nginx/run.sh similarity index 100% rename from server-ce/runit/nginx.sh rename to server-ce/runit/nginx/run.sh diff --git a/server-ce/runit/real-time-sharelatex.sh b/server-ce/runit/real-time-sharelatex/run.sh similarity index 100% rename from server-ce/runit/real-time-sharelatex.sh rename to server-ce/runit/real-time-sharelatex/run.sh diff --git a/server-ce/runit/spelling-sharelatex.sh b/server-ce/runit/spelling-sharelatex/run.sh similarity index 100% rename from server-ce/runit/spelling-sharelatex.sh rename to server-ce/runit/spelling-sharelatex/run.sh diff --git a/server-ce/runit/tags-sharelatex.sh b/server-ce/runit/tags-sharelatex/run.sh similarity index 100% rename from server-ce/runit/tags-sharelatex.sh rename to server-ce/runit/tags-sharelatex/run.sh diff --git a/server-ce/runit/track-changes-sharelatex.sh b/server-ce/runit/track-changes-sharelatex/run.sh similarity index 100% rename from server-ce/runit/track-changes-sharelatex.sh rename to server-ce/runit/track-changes-sharelatex/run.sh diff --git a/server-ce/runit/web-sharelatex.sh b/server-ce/runit/web-sharelatex/run.sh similarity index 100% rename from server-ce/runit/web-sharelatex.sh rename to server-ce/runit/web-sharelatex/run.sh From 023289ef290eecd8efdb17450913baa540b78300 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Fri, 5 Aug 2016 11:05:06 +0000 Subject: [PATCH 077/182] added log rotate and locked down docupdater version for moment --- server-ce/Dockerfile | 2 +- server-ce/services.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 41aaa7e20c..c29e55c3d7 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get update RUN curl -sL https://deb.nodesource.com/setup | 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 -ADD logrotate/sharelatex /etc/logrotate.d/sharelatex +ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex 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 diff --git a/server-ce/services.js b/server-ce/services.js index 3614b2c020..ed590505cc 100644 --- a/server-ce/services.js +++ b/server-ce/services.js @@ -11,7 +11,7 @@ module.exports = }, { name: "document-updater", repo: "https://github.com/sharelatex/document-updater-sharelatex.git", - version: "master" + version: "75c84e2" }, { name: "clsi", repo: "https://github.com/sharelatex/clsi-sharelatex.git", From 40c4f281c155dac87dcb1a89917959116694f7c1 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 5 Aug 2016 15:18:13 +0100 Subject: [PATCH 078/182] fixed init.d copy --- server-ce/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 09b47ab367..f31c08aabe 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -45,7 +45,7 @@ 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 -COPY {baseDir}/init_scripts /etc/my_init.d/ +COPY {baseDir}/init_scripts/ /etc/my_init.d/ # Install ShareLaTeX From dcdc56cbe2c02649036f38d7e6156dd6d240a1fa Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 5 Aug 2016 15:18:35 +0100 Subject: [PATCH 079/182] added runit --- server-ce/runit/notifications-sharelatex/run.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 server-ce/runit/notifications-sharelatex/run.sh diff --git a/server-ce/runit/notifications-sharelatex/run.sh b/server-ce/runit/notifications-sharelatex/run.sh new file mode 100755 index 0000000000..6d1629152c --- /dev/null +++ b/server-ce/runit/notifications-sharelatex/run.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/notifcations/app.js >> /var/log/sharelatex/notifcations.log 2>&1 \ No newline at end of file From 511054423ef6d4a5bd3a0d6ea702e261696f187e Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Fri, 5 Aug 2016 14:22:42 +0000 Subject: [PATCH 080/182] added dollar to base path --- server-ce/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index f31c08aabe..63a584ad6d 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -45,7 +45,7 @@ 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 -COPY {baseDir}/init_scripts/ /etc/my_init.d/ +COPY ${baseDir}/init_scripts/ /etc/my_init.d/ # Install ShareLaTeX From 66dcbb9b96b7bd94ff47beeb525d11c035558d77 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Wed, 21 Sep 2016 12:47:07 +0000 Subject: [PATCH 081/182] move settings file to early on --- server-ce/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 63a584ad6d..cd53f43be7 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -13,6 +13,10 @@ RUN wget https://s3.amazonaws.com/sharelatex-random-files/qpdf-6.0.0.tar.gz && t WORKDIR /opt/qpdf-6.0.0 RUN ./configure && make && make install && ldconfig +# Install ShareLaTeX settings file +ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee +ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee + # Install TexLive RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ mkdir /install-tl-unx; \ @@ -69,9 +73,6 @@ RUN cd /var/www/sharelatex/web; \ RUN cd /var/www/sharelatex/clsi; \ grunt compile:bin -# Install ShareLaTeX settings file -ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee -ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee EXPOSE 80 From cb90144ae5d995a986d810982eea053f320fda80 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 21 Sep 2016 15:24:07 +0100 Subject: [PATCH 082/182] moved run.sh to run --- server-ce/runit/chat-sharelatex/{run.sh => run} | 0 server-ce/runit/clsi-sharelatex/{run.sh => run} | 0 server-ce/runit/docstore-sharelatex/{run.sh => run} | 0 server-ce/runit/document-updater-sharelatex/{run.sh => run} | 0 server-ce/runit/filestore-sharelatex/{run.sh => run} | 0 server-ce/runit/nginx/{run.sh => run} | 0 server-ce/runit/notifications-sharelatex/{run.sh => run} | 0 server-ce/runit/real-time-sharelatex/{run.sh => run} | 0 server-ce/runit/spelling-sharelatex/{run.sh => run} | 0 server-ce/runit/tags-sharelatex/{run.sh => run} | 0 server-ce/runit/track-changes-sharelatex/{run.sh => run} | 0 server-ce/runit/web-sharelatex/{run.sh => run} | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename server-ce/runit/chat-sharelatex/{run.sh => run} (100%) rename server-ce/runit/clsi-sharelatex/{run.sh => run} (100%) rename server-ce/runit/docstore-sharelatex/{run.sh => run} (100%) rename server-ce/runit/document-updater-sharelatex/{run.sh => run} (100%) rename server-ce/runit/filestore-sharelatex/{run.sh => run} (100%) rename server-ce/runit/nginx/{run.sh => run} (100%) rename server-ce/runit/notifications-sharelatex/{run.sh => run} (100%) rename server-ce/runit/real-time-sharelatex/{run.sh => run} (100%) rename server-ce/runit/spelling-sharelatex/{run.sh => run} (100%) rename server-ce/runit/tags-sharelatex/{run.sh => run} (100%) rename server-ce/runit/track-changes-sharelatex/{run.sh => run} (100%) rename server-ce/runit/web-sharelatex/{run.sh => run} (100%) diff --git a/server-ce/runit/chat-sharelatex/run.sh b/server-ce/runit/chat-sharelatex/run similarity index 100% rename from server-ce/runit/chat-sharelatex/run.sh rename to server-ce/runit/chat-sharelatex/run diff --git a/server-ce/runit/clsi-sharelatex/run.sh b/server-ce/runit/clsi-sharelatex/run similarity index 100% rename from server-ce/runit/clsi-sharelatex/run.sh rename to server-ce/runit/clsi-sharelatex/run diff --git a/server-ce/runit/docstore-sharelatex/run.sh b/server-ce/runit/docstore-sharelatex/run similarity index 100% rename from server-ce/runit/docstore-sharelatex/run.sh rename to server-ce/runit/docstore-sharelatex/run diff --git a/server-ce/runit/document-updater-sharelatex/run.sh b/server-ce/runit/document-updater-sharelatex/run similarity index 100% rename from server-ce/runit/document-updater-sharelatex/run.sh rename to server-ce/runit/document-updater-sharelatex/run diff --git a/server-ce/runit/filestore-sharelatex/run.sh b/server-ce/runit/filestore-sharelatex/run similarity index 100% rename from server-ce/runit/filestore-sharelatex/run.sh rename to server-ce/runit/filestore-sharelatex/run diff --git a/server-ce/runit/nginx/run.sh b/server-ce/runit/nginx/run similarity index 100% rename from server-ce/runit/nginx/run.sh rename to server-ce/runit/nginx/run diff --git a/server-ce/runit/notifications-sharelatex/run.sh b/server-ce/runit/notifications-sharelatex/run similarity index 100% rename from server-ce/runit/notifications-sharelatex/run.sh rename to server-ce/runit/notifications-sharelatex/run diff --git a/server-ce/runit/real-time-sharelatex/run.sh b/server-ce/runit/real-time-sharelatex/run similarity index 100% rename from server-ce/runit/real-time-sharelatex/run.sh rename to server-ce/runit/real-time-sharelatex/run diff --git a/server-ce/runit/spelling-sharelatex/run.sh b/server-ce/runit/spelling-sharelatex/run similarity index 100% rename from server-ce/runit/spelling-sharelatex/run.sh rename to server-ce/runit/spelling-sharelatex/run diff --git a/server-ce/runit/tags-sharelatex/run.sh b/server-ce/runit/tags-sharelatex/run similarity index 100% rename from server-ce/runit/tags-sharelatex/run.sh rename to server-ce/runit/tags-sharelatex/run diff --git a/server-ce/runit/track-changes-sharelatex/run.sh b/server-ce/runit/track-changes-sharelatex/run similarity index 100% rename from server-ce/runit/track-changes-sharelatex/run.sh rename to server-ce/runit/track-changes-sharelatex/run diff --git a/server-ce/runit/web-sharelatex/run.sh b/server-ce/runit/web-sharelatex/run similarity index 100% rename from server-ce/runit/web-sharelatex/run.sh rename to server-ce/runit/web-sharelatex/run From e98a23759c061a610090d202cf4b3e2f39d8ef2a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 21 Sep 2016 16:59:37 +0100 Subject: [PATCH 083/182] install texcount on default image --- server-ce/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index cd53f43be7..d9a4b36e49 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -30,6 +30,7 @@ RUN rm -r /install-tl-unx; \ ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2016/bin/x86_64-linux/ RUN tlmgr install latexmk +RUN tlmgr install texcount RUN npm install -g grunt-cli From b32cdab053aff2d1a8287dfa2df8aa2586d06951 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 21 Sep 2016 17:54:46 +0100 Subject: [PATCH 084/182] spell check notifications --- server-ce/runit/notifications-sharelatex/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/runit/notifications-sharelatex/run b/server-ce/runit/notifications-sharelatex/run index 6d1629152c..12b3457f2c 100755 --- a/server-ce/runit/notifications-sharelatex/run +++ b/server-ce/runit/notifications-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/notifcations/app.js >> /var/log/sharelatex/notifcations.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/notifications/app.js >> /var/log/sharelatex/notifications.log 2>&1 \ No newline at end of file From ea7f7af88d595686df221f040777a08db5d2d467 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Wed, 21 Sep 2016 17:09:23 +0000 Subject: [PATCH 085/182] added notificaitons service --- server-ce/services.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server-ce/services.js b/server-ce/services.js index ed590505cc..3dcb1df7da 100644 --- a/server-ce/services.js +++ b/server-ce/services.js @@ -44,4 +44,8 @@ module.exports = name: "contacts", repo: "https://github.com/sharelatex/contacts-sharelatex.git", version: "master" +}, { + name: "notifications", + repo: "https://github.com/sharelatex/notifications-sharelatex.git", + version: "master" }] From 046faae5900579824f3a86f26c74b59ff0e8a00d Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Wed, 21 Sep 2016 17:09:53 +0000 Subject: [PATCH 086/182] added contacts runit --- server-ce/runit/contacts-sharelatex.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 server-ce/runit/contacts-sharelatex.sh diff --git a/server-ce/runit/contacts-sharelatex.sh b/server-ce/runit/contacts-sharelatex.sh new file mode 100755 index 0000000000..29b513cb97 --- /dev/null +++ b/server-ce/runit/contacts-sharelatex.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/contacts/app.js >> /var/log/sharelatex/contacts 2>&1 From 22a3225e70faf42b38ac7728827358affc9e194d Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Wed, 21 Sep 2016 17:10:27 +0000 Subject: [PATCH 087/182] added check db init script --- server-ce/init_scripts/98_check_db_access.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 server-ce/init_scripts/98_check_db_access.sh diff --git a/server-ce/init_scripts/98_check_db_access.sh b/server-ce/init_scripts/98_check_db_access.sh new file mode 100755 index 0000000000..a90adba84f --- /dev/null +++ b/server-ce/init_scripts/98_check_db_access.sh @@ -0,0 +1,5 @@ +#!/bin/sh +echo "Checking can connect to mongo and redis" +cd /var/www/sharelatex && grunt check:redis +cd /var/www/sharelatex && grunt check:mongo +echo "All checks passed" From 1fe4b894d542e597c90a9e88672fc07d36ad045e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 3 Oct 2016 16:54:11 +0100 Subject: [PATCH 088/182] set clsi home to tmp which fixed luatex bug --- server-ce/settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 3bbed39856..799cb73121 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -432,6 +432,7 @@ if process.env["SANDBOXED_COMPILES"] == "true" docker: image: process.env["TEX_LIVE_DOCKER_IMAGE"] env: + HOME: "/tmp" PATH: process.env["COMPILER_PATH"] or "/usr/local/texlive/2015/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" user: "www-data" From 6db09c2c15f9c7b584d0188fc5092e80a1032a9c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 13 Oct 2016 14:21:33 +0100 Subject: [PATCH 089/182] added textEncoding for email option --- server-ce/settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 799cb73121..c9d99521bd 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -348,7 +348,7 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? secure: parse(process.env["SHARELATEX_EMAIL_SMTP_SECURE"]) ignoreTLS: parse(process.env["SHARELATEX_EMAIL_SMTP_IGNORE_TLS"]) - + textEncoding: process.env["SHARELATEX_EMAIL_TEXT_ENCODING"] templates: customFooter: process.env["SHARELATEX_CUSTOM_EMAIL_FOOTER"] From 227666087c89aeee8abfcb0de97d52e0ba4633b8 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 21 Oct 2016 15:43:58 +0100 Subject: [PATCH 090/182] don't show register when external auth is used --- server-ce/package.json | 3 ++- server-ce/settings.coffee | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server-ce/package.json b/server-ce/package.json index e1efb9b159..d3c19d112f 100644 --- a/server-ce/package.json +++ b/server-ce/package.json @@ -7,6 +7,7 @@ "grunt-contrib-rename": "0.0.3", "grunt-docker-io": "^0.7.0", "grunt-github-api": "^0.2.3", - "simple-git": "^1.32.1" + "simple-git": "^1.32.1", + "underscore": "^1.8.3" } } diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index c9d99521bd..81395d8b2e 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -1,4 +1,5 @@ Path = require('path') +_ = require("underscore") # These credentials are used for authenticating api requests # between services that may need to go over public channels @@ -391,6 +392,7 @@ if parse(process.env["SHARELATEX_IS_SERVER_PRO"]) == true if process.env["SHARELATEX_LDAP_HOST"] + settings.externalAuth = true settings.ldap = host: process.env["SHARELATEX_LDAP_HOST"] dn: process.env["SHARELATEX_LDAP_DN"] @@ -424,6 +426,9 @@ if process.env["SHARELATEX_LDAP_HOST"] rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true" ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem' +if settings.externalAuth + settings.nav.header = _.filter settings.nav.header, (button)-> button.url != "/register" + # Compiler # -------- if process.env["SANDBOXED_COMPILES"] == "true" From fa55d8017e992405601721d602962af4976f0617 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 3 Nov 2016 11:18:34 +0000 Subject: [PATCH 091/182] remove underscore from settings.coffee --- server-ce/settings.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 81395d8b2e..2ecd4295f4 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -1,5 +1,4 @@ Path = require('path') -_ = require("underscore") # These credentials are used for authenticating api requests # between services that may need to go over public channels @@ -427,8 +426,13 @@ if process.env["SHARELATEX_LDAP_HOST"] ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem' if settings.externalAuth - settings.nav.header = _.filter settings.nav.header, (button)-> button.url != "/register" + results = [] + for button in settings.nav.header + if button.url != "/register" + results.push(button) + settings.nav.header = results + # Compiler # -------- if process.env["SANDBOXED_COMPILES"] == "true" From 8be95a5169b590c84f885f62b2528e1ea2dcff22 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 3 Nov 2016 16:28:25 +0000 Subject: [PATCH 092/182] Use the ? operator --- server-ce/settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 2ecd4295f4..57d3c22c0d 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -416,7 +416,7 @@ if process.env["SHARELATEX_LDAP_HOST"] if typeof(ca) == 'string' ca_paths = [ca] - else if typeof(ca) == 'object' && ca.length? + else if typeof(ca) == 'object' && ca?.length? ca_paths = ca else console.error "problem parsing SHARELATEX_LDAP_TLS_OPTS_CA_PATH" From f1ce0b406829423567a796e46760341c6d49db96 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 4 Nov 2016 15:14:33 +0000 Subject: [PATCH 093/182] check that nav.header is configured --- server-ce/settings.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 57d3c22c0d..691de1d9f4 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -425,14 +425,14 @@ if process.env["SHARELATEX_LDAP_HOST"] rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true" ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem' -if settings.externalAuth +if settings.externalAuth and settings?.nav?.header? results = [] for button in settings.nav.header if button.url != "/register" results.push(button) settings.nav.header = results - + # Compiler # -------- if process.env["SANDBOXED_COMPILES"] == "true" From 494839591adbb5ca916f09b4a4db9f40555ac848 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 8 Nov 2016 22:37:31 +0000 Subject: [PATCH 094/182] added default features --- server-ce/settings.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 691de1d9f4..50d12acfdb 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -295,7 +295,14 @@ settings = references:{} notifications:undefined - + defaultFeatures: + collaborators: -1 + dropbox: true + versioning: true + compileTimeout: 180 + compileGroup: "standard" + references: true + templates: true #### OPTIONAL CONFIGERABLE SETTINGS From 2042575b86cb495dab23703360f1ae31f26b9324 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 14 Nov 2016 15:40:18 +0000 Subject: [PATCH 095/182] Add saml config options --- server-ce/settings.coffee | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 691de1d9f4..85f87677f5 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -425,6 +425,65 @@ if process.env["SHARELATEX_LDAP_HOST"] rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true" ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem' +if process.env["SHARELATEX_SAML_ENTRYPOINT"] + # NOTE: see https://github.com/bergie/passport-saml/blob/master/README.md for docs of `server` options + settings.externalAuth = true + settings.saml = + server: + # strings + entryPoint: process.env["SHARELATEX_SAML_ENTRYPOINT"] + callbackUrl: process.env["SHARELATEX_SAML_CALLBACK_URL"] + issuer: process.env["SHARELATEX_SAML_ISSUER"] + cert: process.env["SHARELATEX_SAML_CERT"] + privateCert: process.env["SHARELATEX_SAML_PRIVATE_CERT"] + decryptionPvk: process.env["SHARELATEX_SAML_DECRYPTION_PVK"] + signatureAlgorithm: process.env["SHARELATEX_SAML_SIGNATURE_ALGORITHM"] + identifierFormat: process.env["SHARELATEX_SAML_IDENTIFIER_FORMAT"] + attributeConsumingServiceIndex: process.env["SHARELATEX_SAML_ATTRIBUTE_CONSUMING_SERVICE_INDEX"] + authnContext: process.env["SHARELATEX_SAML_AUTHN_CONTEXT"] + authnRequestBinding: process.env["SHARELATEX_SAML_AUTHN_REQUEST_BINDING"] + validateInResponseTo: process.env["SHARELATEX_SAML_VALIDATE_IN_RESPONSE_TO"] + cacheProvider: process.env["SHARELATEX_SAML_CACHE_PROVIDER"] + logoutUrl: process.env["SHARELATEX_SAML_LOGOUT_URL"] + additionalLogoutParams: process.env["SHARELATEX_SAML_ADDITIONAL_LOGOUT_PARAMS"] + logoutCallbackUrl: process.env["SHARELATEX_SAML_LOGOUT_CALLBACK_URL"] + disableRequestedAuthnContext: process.env["SHARELATEX_SAML_DISABLE_REQUESTED_AUTHN_CONTEXT"] == 'true' + forceAuthn: process.env["SHARELATEX_SAML_FORCE_AUTHN"] == 'true' + skipRequestCompression: process.env["SHARELATEX_SAML_SKIP_REQUEST_COMPRESSION"] == 'true' + acceptedClockSkewMs: ( + if _saml_skew = process.env["SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS"] + try + parseInt(_saml_skew) + catch e + console.error "Cannot parse SHARELATEX_SAML_ACCEPTED_CLOCK_SKEW_MS" + else + undefined + ) + requestIdExpirationPeriodMs: ( + if _saml_exiration = process.env["SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS"] + try + parseInt(_saml_expiration) + catch e + console.error "Cannot parse SHARELATEX_SAML_REQUEST_ID_EXPIRATION_PERIOD_MS" + else + undefined + ) + + identityServiceName: process.env["SHARELATEX_SAML_IDENTITY_SERVICE_NAME"] + + if _saml_additionalParams = process.env["SHARELATEX_SAML_ADDITIONAL_PARAMS"] + try + settings.saml.server.additionalAuthorizeParams = JSON.parse(_saml_additionalParams) + catch e + console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_PARAMS" + + if _saml_additionalAuthorizeParams = process.env["SHARELATEX_SAML_ADDITIONAL_AUTHORIZE_PARAMS"] + try + settings.saml.server.additionalAuthorizeParams = JSON.parse(_saml_additionalAuthorizeParams ) + catch e + console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_PARAMS" + + if settings.externalAuth and settings?.nav?.header? results = [] for button in settings.nav.header From 1c3f8451436ab192d9206727b23aa1fb499e7ba2 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 14 Nov 2016 15:46:12 +0000 Subject: [PATCH 096/182] Refactor. --- server-ce/settings.coffee | 44 +++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 9d8fcef66b..8ac6e34307 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -436,6 +436,7 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] # NOTE: see https://github.com/bergie/passport-saml/blob/master/README.md for docs of `server` options settings.externalAuth = true settings.saml = + identityServiceName: process.env["SHARELATEX_SAML_IDENTITY_SERVICE_NAME"] server: # strings entryPoint: process.env["SHARELATEX_SAML_ENTRYPOINT"] @@ -452,7 +453,6 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] validateInResponseTo: process.env["SHARELATEX_SAML_VALIDATE_IN_RESPONSE_TO"] cacheProvider: process.env["SHARELATEX_SAML_CACHE_PROVIDER"] logoutUrl: process.env["SHARELATEX_SAML_LOGOUT_URL"] - additionalLogoutParams: process.env["SHARELATEX_SAML_ADDITIONAL_LOGOUT_PARAMS"] logoutCallbackUrl: process.env["SHARELATEX_SAML_LOGOUT_CALLBACK_URL"] disableRequestedAuthnContext: process.env["SHARELATEX_SAML_DISABLE_REQUESTED_AUTHN_CONTEXT"] == 'true' forceAuthn: process.env["SHARELATEX_SAML_FORCE_AUTHN"] == 'true' @@ -475,21 +475,33 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] else undefined ) - - identityServiceName: process.env["SHARELATEX_SAML_IDENTITY_SERVICE_NAME"] - - if _saml_additionalParams = process.env["SHARELATEX_SAML_ADDITIONAL_PARAMS"] - try - settings.saml.server.additionalAuthorizeParams = JSON.parse(_saml_additionalParams) - catch e - console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_PARAMS" - - if _saml_additionalAuthorizeParams = process.env["SHARELATEX_SAML_ADDITIONAL_AUTHORIZE_PARAMS"] - try - settings.saml.server.additionalAuthorizeParams = JSON.parse(_saml_additionalAuthorizeParams ) - catch e - console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_PARAMS" - + additionalParams: ( + if _saml_additionalParams = process.env["SHARELATEX_SAML_ADDITIONAL_PARAMS"] + try + JSON.parse(_saml_additionalParams) + catch e + console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_PARAMS" + else + undefined + ) + additionalAuthorizeParams: ( + if _saml_additionalAuthorizeParams = process.env["SHARELATEX_SAML_ADDITIONAL_AUTHORIZE_PARAMS"] + try + JSON.parse(_saml_additionalAuthorizeParams ) + catch e + console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_AUTHORIZE_PARAMS" + else + undefined + ) + additionalLogoutParams: ( + if _saml_additionalLogoutParams = process.env["SHARELATEX_SAML_ADDITIONAL_LOGOUT_PARAMS"] + try + JSON.parse(_saml_additionalLogoutParams ) + catch e + console.error "Cannot parse SHARELATEX_SAML_ADDITIONAL_LOGOUT_PARAMS" + else + undefined + ) if settings.externalAuth and settings?.nav?.header? results = [] From 4de0d3538446cab7d46788ee89cffcd69f939361 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 23 Nov 2016 10:37:35 +0000 Subject: [PATCH 097/182] Add saml emailFieldName option --- server-ce/settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 8ac6e34307..b2113c1d91 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -437,6 +437,7 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] settings.externalAuth = true settings.saml = identityServiceName: process.env["SHARELATEX_SAML_IDENTITY_SERVICE_NAME"] + emailFieldName: process.env["SHARELATEX_SAML_EMAIL_FIELD_NAME"] server: # strings entryPoint: process.env["SHARELATEX_SAML_ENTRYPOINT"] From 8a8ac600d1d879cb2626b60ada46a5a0424a3952 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 23 Nov 2016 14:13:37 +0000 Subject: [PATCH 098/182] Add options for saml firstName and lastName fields. --- server-ce/settings.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index b2113c1d91..2bb169d8dc 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -437,7 +437,9 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] settings.externalAuth = true settings.saml = identityServiceName: process.env["SHARELATEX_SAML_IDENTITY_SERVICE_NAME"] - emailFieldName: process.env["SHARELATEX_SAML_EMAIL_FIELD_NAME"] + emailField: process.env["SHARELATEX_SAML_EMAIL_FIELD"] || process.env["SHARELATEX_SAML_EMAIL_FIELD_NAME"] + firstNameField: process.env["SHARELATEX_SAML_FIRST_NAME_FIELD"] + lastNameField: process.env["SHARELATEX_SAML_LAST_NAME_FIELD"] server: # strings entryPoint: process.env["SHARELATEX_SAML_ENTRYPOINT"] From 06c9ebdd7262e63512d47df7f7fedd59766d4a91 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 2 Dec 2016 15:12:57 +0000 Subject: [PATCH 099/182] Add `updateUserDetailsOnLogin` options to ldap and saml. --- server-ce/settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 2bb169d8dc..1397930cfc 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -414,6 +414,7 @@ if process.env["SHARELATEX_LDAP_HOST"] starttls: parse(process.env["SHARELATEX_LDAP_TLS"]) nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"] lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] + updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true' if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] try @@ -436,6 +437,7 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] # NOTE: see https://github.com/bergie/passport-saml/blob/master/README.md for docs of `server` options settings.externalAuth = true settings.saml = + updateUserDetailsOnLogin: process.env["SHARELATEX_SAML_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true' identityServiceName: process.env["SHARELATEX_SAML_IDENTITY_SERVICE_NAME"] emailField: process.env["SHARELATEX_SAML_EMAIL_FIELD"] || process.env["SHARELATEX_SAML_EMAIL_FIELD_NAME"] firstNameField: process.env["SHARELATEX_SAML_FIRST_NAME_FIELD"] From 799cca1d6d970dbfd17507ab093055207b03ec84 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 09:22:31 +0000 Subject: [PATCH 100/182] Update to new ldap config --- server-ce/settings.coffee | 126 +++++++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 15 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 1397930cfc..683b674036 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -397,24 +397,116 @@ if parse(process.env["SHARELATEX_IS_SERVER_PRO"]) == true # When testing with forumsys.com use username = einstein and password = password +# if process.env["SHARELATEX_LDAP_HOST"] +# settings.externalAuth = true +# settings.ldap = +# host: process.env["SHARELATEX_LDAP_HOST"] +# dn: process.env["SHARELATEX_LDAP_DN"] +# baseSearch: process.env["SHARELATEX_LDAP_BASE_SEARCH"] +# filter: process.env["SHARELATEX_LDAP_FILTER"] +# failMessage: process.env["SHARELATEX_LDAP_FAIL_MESSAGE"] or 'LDAP User Fail' +# fieldName: process.env["SHARELATEX_LDAP_FIELD_NAME"] or 'LDAP User' +# placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] or 'LDAP User ID' +# emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail' +# anonymous: parse(process.env["SHARELATEX_LDAP_ANONYMOUS"]) +# adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"] +# adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] +# starttls: parse(process.env["SHARELATEX_LDAP_TLS"]) +# nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"] +# lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] +# updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true' + +# if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] +# try +# ca = JSON.parse(process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"]) +# catch e +# console.error "could not parse SHARELATEX_LDAP_TLS_OPTS_CA_PATH, invalid JSON" + +# if typeof(ca) == 'string' +# ca_paths = [ca] +# else if typeof(ca) == 'object' && ca?.length? +# ca_paths = ca +# else +# console.error "problem parsing SHARELATEX_LDAP_TLS_OPTS_CA_PATH" + +# settings.ldap.tlsOptions = +# rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true" +# ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem' + + + + +# LDAP - SERVER PRO ONLY +# ---------- + if process.env["SHARELATEX_LDAP_HOST"] + console.error """ +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# +# WARNING: The LDAP configuration format has changed in version 0.5.1 +# See https://github.com/sharelatex/sharelatex/wiki/Server-Pro:-LDAP-Config +# +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +""" + +if process.env["SHARELATEX_LDAP_URL"] settings.externalAuth = true settings.ldap = - host: process.env["SHARELATEX_LDAP_HOST"] - dn: process.env["SHARELATEX_LDAP_DN"] - baseSearch: process.env["SHARELATEX_LDAP_BASE_SEARCH"] - filter: process.env["SHARELATEX_LDAP_FILTER"] - failMessage: process.env["SHARELATEX_LDAP_FAIL_MESSAGE"] or 'LDAP User Fail' - fieldName: process.env["SHARELATEX_LDAP_FIELD_NAME"] or 'LDAP User' - placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] or 'LDAP User ID' - emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail' - anonymous: parse(process.env["SHARELATEX_LDAP_ANONYMOUS"]) - adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"] - adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] - starttls: parse(process.env["SHARELATEX_LDAP_TLS"]) - nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"] - lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] + server: + url: process.env["SHARELATEX_LDAP_URL"] + bindDn: process.env["SHARELATEX_LDAP_BIND_DN"] + bindCredentials: process.env["SHARELATEX_LDAP_BIND_CREDENTIALS"] + bindProperty: process.env["SHARELATEX_LDAP_BIND_PROPERTY"] + searchBase: process.env["SHARELATEX_LDAP_SEARCHBASE"] + searchScope: process.env["SHARELATEX_LDAP_SEARCH_SCOPE"] + searchFilter: process.env["SHARELATEX_LDAP_SEARCH_FILTER"] + searchAttributes: ( + if _ldap_search_attribs = process.env["SHARELATEX_LDAP_SEARCH_ATTRIBUTES"] + try + JSON.parse(_ldap_search_attribs) + catch + console.error "could not parse SHARELATEX_LDAP_SEARCH_ATTRIBUTES" + else + undefined + ) + groupDnProperty: process.env["SHARELATEX_LDAP_GROUP_DN_PROPERTY"] + groupSearchBase: process.env["SHARELATEX_LDAP_GROUP_SEARCH_BASE"] + groupSearchScope: process.env["SHARELATEX_LDAP_GROUP_SEARCH_SCOPE"] + groupSearchFilter: process.env["SHARELATEX_LDAP_GROUP_SEARCH_FILTER"] # + groupSearchAttributes: ( + if _ldap_group_search_attribs = process.env["SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES"] + try + JSON.parse(_ldap_group_search_attribs) + catch + console.error "could not parse SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES" + else + undefined + ) + cache: process.env["SHARELATEX_LDAP_CACHE"] == 'true' + timeout: ( + if _ldap_timeout = process.env["SHARELATEX_LDAP_TIMEOUT"] + try + parseInt(_ldap_timeout) + catch e + console.error "Cannot parse SHARELATEX_LDAP_TIMEOUT" + else + undefined + ) + connectTimeout: ( + if _ldap_connect_timeout = process.env["SHARELATEX_LDAP_CONNECT_TIMEOUT"] + try + parseInt(_ldap_connect_timeout) + catch e + console.error "Cannot parse SHARELATEX_CONNECTLDAP_TIMEOUT" + else + undefined + ) + emailAtt: process.env["SHARELATEX_LDAP_"] + nameAtt: process.env["SHARELATEX_LDAP_"] + lastNameAtt: process.env["SHARELATEX_LDAP_"] updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true' + placeholder: process.env["SHARELATEX_LDAP_"] + starttls: process.env["SHARELATEX_LDAP_TLS"] == 'true' if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] try @@ -429,10 +521,14 @@ if process.env["SHARELATEX_LDAP_HOST"] else console.error "problem parsing SHARELATEX_LDAP_TLS_OPTS_CA_PATH" - settings.ldap.tlsOptions = + settings.ldap.server.tlsOptions = rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true" ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem' + + + + if process.env["SHARELATEX_SAML_ENTRYPOINT"] # NOTE: see https://github.com/bergie/passport-saml/blob/master/README.md for docs of `server` options settings.externalAuth = true From 779bbfa2613deb37f58620156cfa4ee8c8086fbb Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 10:40:43 +0000 Subject: [PATCH 101/182] Remove the starttls option --- server-ce/settings.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 683b674036..db943f45bb 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -506,7 +506,6 @@ if process.env["SHARELATEX_LDAP_URL"] lastNameAtt: process.env["SHARELATEX_LDAP_"] updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true' placeholder: process.env["SHARELATEX_LDAP_"] - starttls: process.env["SHARELATEX_LDAP_TLS"] == 'true' if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] try From 6e99800298e7a321b1fd9df7b11c64b9203903c5 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 11:01:01 +0000 Subject: [PATCH 102/182] Fix ldap settings --- server-ce/settings.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index db943f45bb..06778973e5 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -452,6 +452,11 @@ if process.env["SHARELATEX_LDAP_HOST"] if process.env["SHARELATEX_LDAP_URL"] settings.externalAuth = true settings.ldap = + emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] + nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"] + lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] + updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true' + placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] server: url: process.env["SHARELATEX_LDAP_URL"] bindDn: process.env["SHARELATEX_LDAP_BIND_DN"] @@ -472,7 +477,7 @@ if process.env["SHARELATEX_LDAP_URL"] groupDnProperty: process.env["SHARELATEX_LDAP_GROUP_DN_PROPERTY"] groupSearchBase: process.env["SHARELATEX_LDAP_GROUP_SEARCH_BASE"] groupSearchScope: process.env["SHARELATEX_LDAP_GROUP_SEARCH_SCOPE"] - groupSearchFilter: process.env["SHARELATEX_LDAP_GROUP_SEARCH_FILTER"] # + groupSearchFilter: process.env["SHARELATEX_LDAP_GROUP_SEARCH_FILTER"] groupSearchAttributes: ( if _ldap_group_search_attribs = process.env["SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES"] try @@ -501,11 +506,6 @@ if process.env["SHARELATEX_LDAP_URL"] else undefined ) - emailAtt: process.env["SHARELATEX_LDAP_"] - nameAtt: process.env["SHARELATEX_LDAP_"] - lastNameAtt: process.env["SHARELATEX_LDAP_"] - updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true' - placeholder: process.env["SHARELATEX_LDAP_"] if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] try From bef595eced87ca5ed1046eff9265d48cbcd12ea9 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 11:13:20 +0000 Subject: [PATCH 103/182] Add error var --- server-ce/settings.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 06778973e5..6c41616556 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -469,7 +469,7 @@ if process.env["SHARELATEX_LDAP_URL"] if _ldap_search_attribs = process.env["SHARELATEX_LDAP_SEARCH_ATTRIBUTES"] try JSON.parse(_ldap_search_attribs) - catch + catch e console.error "could not parse SHARELATEX_LDAP_SEARCH_ATTRIBUTES" else undefined @@ -482,7 +482,7 @@ if process.env["SHARELATEX_LDAP_URL"] if _ldap_group_search_attribs = process.env["SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES"] try JSON.parse(_ldap_group_search_attribs) - catch + catch e console.error "could not parse SHARELATEX_LDAP_GROUP_SEARCH_ATTRIBUTES" else undefined From 17d2d4561ddfe59e5c2272924afb400ba358ce22 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 12:34:08 +0000 Subject: [PATCH 104/182] Fix daft typos --- server-ce/settings.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 6c41616556..14a5c0d49f 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -462,7 +462,7 @@ if process.env["SHARELATEX_LDAP_URL"] bindDn: process.env["SHARELATEX_LDAP_BIND_DN"] bindCredentials: process.env["SHARELATEX_LDAP_BIND_CREDENTIALS"] bindProperty: process.env["SHARELATEX_LDAP_BIND_PROPERTY"] - searchBase: process.env["SHARELATEX_LDAP_SEARCHBASE"] + searchBase: process.env["SHARELATEX_LDAP_SEARCH_BASE"] searchScope: process.env["SHARELATEX_LDAP_SEARCH_SCOPE"] searchFilter: process.env["SHARELATEX_LDAP_SEARCH_FILTER"] searchAttributes: ( @@ -502,7 +502,7 @@ if process.env["SHARELATEX_LDAP_URL"] try parseInt(_ldap_connect_timeout) catch e - console.error "Cannot parse SHARELATEX_CONNECTLDAP_TIMEOUT" + console.error "Cannot parse SHARELATEX_LDAP_CONNECT_TIMEOUT" else undefined ) From eadfb316b499a2b0930ff0cffcc493f05d3a3739 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 19 Dec 2016 14:17:39 +0000 Subject: [PATCH 105/182] chown /var/www/ to www-data --- server-ce/init_scripts/00_make_sharelatex_data_dirs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh index 6085a087da..7857b984fb 100755 --- a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh @@ -26,6 +26,8 @@ chown www-data:www-data /var/lib/sharelatex/tmp/uploads mkdir -p /var/lib/sharelatex/tmp/dumpFolder chown www-data:www-data /var/lib/sharelatex/tmp/dumpFolder +chown www-data:www-data /var/www/ + if [ ! -e "/var/lib/sharelatex/data/db.sqlite" ]; then touch /var/lib/sharelatex/data/db.sqlite fi From b585560dd0b3416b42458c8796950891984162fc Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 20 Dec 2016 10:28:37 +0000 Subject: [PATCH 106/182] Remove cruft. --- server-ce/settings.coffee | 45 --------------------------------------- 1 file changed, 45 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 14a5c0d49f..5c795e17dc 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -391,51 +391,6 @@ if parse(process.env["SHARELATEX_IS_SERVER_PRO"]) == true url: "http://localhost:3040" -# LDAP - SERVER PRO ONLY -# ---------- -# Settings below use a working LDAP test server kindly provided by forumsys.com -# When testing with forumsys.com use username = einstein and password = password - - -# if process.env["SHARELATEX_LDAP_HOST"] -# settings.externalAuth = true -# settings.ldap = -# host: process.env["SHARELATEX_LDAP_HOST"] -# dn: process.env["SHARELATEX_LDAP_DN"] -# baseSearch: process.env["SHARELATEX_LDAP_BASE_SEARCH"] -# filter: process.env["SHARELATEX_LDAP_FILTER"] -# failMessage: process.env["SHARELATEX_LDAP_FAIL_MESSAGE"] or 'LDAP User Fail' -# fieldName: process.env["SHARELATEX_LDAP_FIELD_NAME"] or 'LDAP User' -# placeholder: process.env["SHARELATEX_LDAP_PLACEHOLDER"] or 'LDAP User ID' -# emailAtt: process.env["SHARELATEX_LDAP_EMAIL_ATT"] or 'mail' -# anonymous: parse(process.env["SHARELATEX_LDAP_ANONYMOUS"]) -# adminDN: process.env["SHARELATEX_LDAP_ADMIN_DN"] -# adminPW: process.env["SHARELATEX_LDAP_ADMIN_PW"] -# starttls: parse(process.env["SHARELATEX_LDAP_TLS"]) -# nameAtt: process.env["SHARELATEX_LDAP_NAME_ATT"] -# lastNameAtt: process.env["SHARELATEX_LDAP_LAST_NAME_ATT"] -# updateUserDetailsOnLogin: process.env["SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN"] == 'true' - -# if process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"] -# try -# ca = JSON.parse(process.env["SHARELATEX_LDAP_TLS_OPTS_CA_PATH"]) -# catch e -# console.error "could not parse SHARELATEX_LDAP_TLS_OPTS_CA_PATH, invalid JSON" - -# if typeof(ca) == 'string' -# ca_paths = [ca] -# else if typeof(ca) == 'object' && ca?.length? -# ca_paths = ca -# else -# console.error "problem parsing SHARELATEX_LDAP_TLS_OPTS_CA_PATH" - -# settings.ldap.tlsOptions = -# rejectUnauthorized: process.env["SHARELATEX_LDAP_TLS_OPTS_REJECT_UNAUTH"] == "true" -# ca:ca_paths # e.g.'/etc/ldap/ca_certs.pem' - - - - # LDAP - SERVER PRO ONLY # ---------- From 8f37d7dd2ce72410bc7b637cf829b6f639d7c175 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 20 Dec 2016 10:28:54 +0000 Subject: [PATCH 107/182] add `restrictInvitesToExistingAccounts` option --- server-ce/settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 5c795e17dc..b5d74c701d 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -109,6 +109,7 @@ settings = # The name this is used to describe your ShareLaTeX Installation appName: process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX (Community Edition)" + restrictInvitesToExistingAccounts: process.env["SHARELATEX_RESTRICT_INVITES_TO_EXISTING_ACCOUNTS"] == 'true' nav: title: process.env["SHARELATEX_NAV_TITLE"] or process.env["SHARELATEX_APP_NAME"] or "ShareLaTeX Community Edition" From 453311136f0ad60417897c12511b6ea01dd6af88 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 21 Dec 2016 13:51:05 +0000 Subject: [PATCH 108/182] Move the filtering-out of `/register` links to web --- server-ce/settings.coffee | 7 ------- 1 file changed, 7 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index b5d74c701d..58f83c5def 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -559,13 +559,6 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] undefined ) -if settings.externalAuth and settings?.nav?.header? - results = [] - for button in settings.nav.header - if button.url != "/register" - results.push(button) - settings.nav.header = results - # Compiler # -------- From fa29f0f19d4c907aaf79dad1c88a7cc6dcee2ea3 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 21 Dec 2016 14:57:47 +0000 Subject: [PATCH 109/182] Fix the header-nav links option --- server-ce/settings.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 58f83c5def..a132c4eb99 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -305,7 +305,7 @@ settings = references: true templates: true -#### OPTIONAL CONFIGERABLE SETTINGS +## OPTIONAL CONFIGERABLE SETTINGS if process.env["SHARELATEX_LEFT_FOOTER"]? try @@ -322,9 +322,12 @@ if process.env["SHARELATEX_RIGHT_FOOTER"]? if process.env["SHARELATEX_HEADER_IMAGE_URL"]? settings.nav.custom_logo = process.env["SHARELATEX_HEADER_IMAGE_URL"] - -if process.env["SHARELATEX_HEADER"]? - settings.nav.header = process.env["SHARELATEX_HEADER_NAV_LINKS"] + +if process.env["SHARELATEX_HEADER_NAV_LINKS"]? + try + settings.nav.header = JSON.parse(process.env["SHARELATEX_HEADER_NAV_LINKS"]) + catch e + console.error("could not parse SHARELATEX_HEADER_NAV_LINKS, not valid JSON") # if process.env["SHARELATEX_PROXY_LEARN"]? # settings.nav.header.push({text: "help", class: "subdued", dropdown: [{text: "documentation", url: "/learn"}] }) From c6153c5b44f3458b15c562014c5fb17234a9f803 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 4 Jan 2017 11:41:38 +0000 Subject: [PATCH 110/182] - added option to set lang code - removed commeted out learn header code - increased max pass length to 150 --- server-ce/settings.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index a132c4eb99..c410305a59 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -148,6 +148,12 @@ settings = behindProxy: process.env["SHARELATEX_BEHIND_PROXY"] or false + # Site Languages + i18n: + subdomainLang: + www: {lngCode:process.env["SHARELATEX_SITE_LANGUAGE"] or "en", url: siteUrl} + defaultLng: process.env["SHARELATEX_SITE_LANGUAGE"] or "en" + # Spell Check Languages # --------------------- # @@ -329,9 +335,6 @@ if process.env["SHARELATEX_HEADER_NAV_LINKS"]? catch e console.error("could not parse SHARELATEX_HEADER_NAV_LINKS, not valid JSON") -# if process.env["SHARELATEX_PROXY_LEARN"]? -# settings.nav.header.push({text: "help", class: "subdued", dropdown: [{text: "documentation", url: "/learn"}] }) - # Sending Email # ------------- @@ -381,7 +384,7 @@ if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELA settings.passwordStrengthOptions = pattern: process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or "aA$3" - length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] or 50} + length: {min:process.env["SHARELATEX_PASSWORD_VALIDATION_MIN_LENGTH"] or 8, max: process.env["SHARELATEX_PASSWORD_VALIDATION_MAX_LENGTH"] or 150} From b1e6b8a5e9241aa3a540a90cbe5e267dedf54422 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 6 Jan 2017 11:28:32 +0000 Subject: [PATCH 111/182] add option to set lang per domain --- server-ce/settings.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index c410305a59..25dfe1e548 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -148,7 +148,6 @@ settings = behindProxy: process.env["SHARELATEX_BEHIND_PROXY"] or false - # Site Languages i18n: subdomainLang: www: {lngCode:process.env["SHARELATEX_SITE_LANGUAGE"] or "en", url: siteUrl} @@ -374,7 +373,12 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? if process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]? settings.email.parameters.tls = rejectUnauthorized: parse(process.env["SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH"]) - + + +# i18n +if process.env["SHARELATEX_LANG_DOMAIN_MAPPING"]? + + settings.i18n.subdomainLang = parse(process.env["SHARELATEX_LANG_DOMAIN_MAPPING"]) # Password Settings # ----------- From af4703a2e27114219e953568bd485c2164a0adc2 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 6 Jan 2017 16:02:27 +0000 Subject: [PATCH 112/182] remove proxy_set_header X-Forwarded-Proto $scheme for https --- server-ce/nginx/sharelatex.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/server-ce/nginx/sharelatex.conf b/server-ce/nginx/sharelatex.conf index 0111797967..cf63f4c5c4 100644 --- a/server-ce/nginx/sharelatex.conf +++ b/server-ce/nginx/sharelatex.conf @@ -10,7 +10,6 @@ server { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 3m; proxy_send_timeout 3m; From 581ec86fb178029371578755a28d811f4c0609f1 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 12 Jan 2017 13:51:10 +0000 Subject: [PATCH 113/182] Add new SHARELATEX_HEADER_EXTRAS option --- server-ce/settings.coffee | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index a132c4eb99..77e4085642 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -324,10 +324,21 @@ if process.env["SHARELATEX_HEADER_IMAGE_URL"]? settings.nav.custom_logo = process.env["SHARELATEX_HEADER_IMAGE_URL"] if process.env["SHARELATEX_HEADER_NAV_LINKS"]? + console.error """ +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# +# WARNING: SHARELATEX_HEADER_NAV_LINKS is no longer supported +# See https://github.com/sharelatex/sharelatex/wiki/Configuring-Headers,-Footers-&-Logo +# +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +""" + +if process.env["SHARELATEX_HEADER_EXTRAS"]? try - settings.nav.header = JSON.parse(process.env["SHARELATEX_HEADER_NAV_LINKS"]) + settings.nav.header_extras = JSON.parse(process.env["SHARELATEX_HEADER_EXTRAS"]) catch e - console.error("could not parse SHARELATEX_HEADER_NAV_LINKS, not valid JSON") + console.error("could not parse SHARELATEX_HEADER_EXTRAS, not valid JSON") + # if process.env["SHARELATEX_PROXY_LEARN"]? # settings.nav.header.push({text: "help", class: "subdued", dropdown: [{text: "documentation", url: "/learn"}] }) From 8478935071fc3d8aafaf82fb826cee9db34e4815 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 13 Jan 2017 11:39:34 -0500 Subject: [PATCH 114/182] add /var/log/sharlatex-errors.log --- server-ce/runit/errorlogs/run | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 server-ce/runit/errorlogs/run diff --git a/server-ce/runit/errorlogs/run b/server-ce/runit/errorlogs/run new file mode 100755 index 0000000000..e4053dab9e --- /dev/null +++ b/server-ce/runit/errorlogs/run @@ -0,0 +1,2 @@ +#!/bin/bash +tail -F /var/log/sharelatex/*.log | grep '"level":50' >> /var/log/sharlatex-errors.log From d18b1b08050afd4bf88fd457e699852c72739b89 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 25 Jan 2017 15:22:32 +0000 Subject: [PATCH 115/182] Un-pin doc-updater --- server-ce/services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/services.js b/server-ce/services.js index 3dcb1df7da..b79ab9a4b7 100644 --- a/server-ce/services.js +++ b/server-ce/services.js @@ -11,7 +11,7 @@ module.exports = }, { name: "document-updater", repo: "https://github.com/sharelatex/document-updater-sharelatex.git", - version: "75c84e2" + version: "master" }, { name: "clsi", repo: "https://github.com/sharelatex/clsi-sharelatex.git", From c172455cd7d8abd55a49e434f89e0b2ee51799dd Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 26 Jan 2017 10:27:17 +0000 Subject: [PATCH 116/182] Add documentupdater config --- server-ce/settings.coffee | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index f1e32e87bc..7b6fc315d3 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -44,6 +44,19 @@ settings = port: process.env["SHARELATEX_REDIS_PORT"] or "6379" password: process.env["SHARELATEX_REDIS_PASS"] or "" fairy: redisConfig + documentupdater: + port: process.env["SHARELATEX_REDIS_PORT"] or "6379" + host: process.env["SHARELATEX_REDIS_HOST"] or "dockerhost" + password: process.env["SHARELATEX_REDIS_PASS"] or "" + key_schema: + blockingKey: ({doc_id}) -> "Blocking:#{doc_id}" + docLines: ({doc_id}) -> "doclines:#{doc_id}" + docOps: ({doc_id}) -> "DocOps:#{doc_id}" + docVersion: ({doc_id}) -> "DocVersion:#{doc_id}" + projectKey: ({doc_id}) -> "ProjectId:#{doc_id}" + docsInProject: ({project_id}) -> "DocsIn:#{project_id}" + ranges: ({doc_id}) -> "Ranges:#{doc_id}" + # The compile server (the clsi) uses a SQL database to cache files and # meta-data. sqllite is the default, and the load is low enough that this will From f0dc32f8791d6ac90655b27d0b313ec8cbca650e Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 26 Jan 2017 13:43:07 +0000 Subject: [PATCH 117/182] Add array wrapper --- server-ce/settings.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 7b6fc315d3..f60ff9f106 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -44,7 +44,7 @@ settings = port: process.env["SHARELATEX_REDIS_PORT"] or "6379" password: process.env["SHARELATEX_REDIS_PASS"] or "" fairy: redisConfig - documentupdater: + documentupdater: [{ port: process.env["SHARELATEX_REDIS_PORT"] or "6379" host: process.env["SHARELATEX_REDIS_HOST"] or "dockerhost" password: process.env["SHARELATEX_REDIS_PASS"] or "" @@ -56,6 +56,7 @@ settings = projectKey: ({doc_id}) -> "ProjectId:#{doc_id}" docsInProject: ({project_id}) -> "DocsIn:#{project_id}" ranges: ({doc_id}) -> "Ranges:#{doc_id}" + }] # The compile server (the clsi) uses a SQL database to cache files and From d4f00fca5a5eb024533626e6139711ca672cab22 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 27 Jan 2017 09:52:55 +0000 Subject: [PATCH 118/182] replace spaces with tabs --- server-ce/settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index f60ff9f106..53cf424853 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -56,7 +56,7 @@ settings = projectKey: ({doc_id}) -> "ProjectId:#{doc_id}" docsInProject: ({project_id}) -> "DocsIn:#{project_id}" ranges: ({doc_id}) -> "Ranges:#{doc_id}" - }] + }] # The compile server (the clsi) uses a SQL database to cache files and From 634881529429c21debaf967bc96c99b56be76ea3 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 27 Jan 2017 13:28:14 +0000 Subject: [PATCH 119/182] Add primary=true --- server-ce/settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 53cf424853..394a1d09f9 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -45,6 +45,7 @@ settings = password: process.env["SHARELATEX_REDIS_PASS"] or "" fairy: redisConfig documentupdater: [{ + primary: true port: process.env["SHARELATEX_REDIS_PORT"] or "6379" host: process.env["SHARELATEX_REDIS_HOST"] or "dockerhost" password: process.env["SHARELATEX_REDIS_PASS"] or "" From ee0c7293e97f4992a0a0ab1e2a42e6bdf7a2c812 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 2 Feb 2017 14:09:55 +0000 Subject: [PATCH 120/182] Add launchpad to docker build --- server-ce/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index d9a4b36e49..4e721dc5ef 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -63,7 +63,10 @@ RUN cd /var/www && npm install RUN cd /var/www/sharelatex; \ npm install; \ - grunt install; + grunt install; \ + cd web/modules; \ + git clone https://bitbucket.org/sharelatex/launchpad-webmodule.git launchpad; \ + grunt compile; RUN cd /var/www && node git-revision > revisions.txt From 1e843c52dacb64d61f72853d10237f0a7780ee1e Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 3 Feb 2017 14:10:42 +0000 Subject: [PATCH 121/182] add sandboxed compiles sibling containers --- server-ce/settings.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 394a1d09f9..7891c4a1a5 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -611,6 +611,12 @@ if process.env["SANDBOXED_COMPILES"] == "true" if !settings.path? settings.path = {} settings.path.synctexBaseDir = () -> "/compile" + if process.env['SANDBOXED_COMPILES_SIBLING_CONTAINERS'] == 'true' + console.log("Using sibling containers for sandoxed compiles") + if process.env['SANDBOXED_COMPILES_HOST_DIR'] + settings.path.sandboxedCompilesHostDir = process.env['SANDBOXED_COMPILES_HOST_DIR'] + else + console.error('Sibling containers, but SANDBOXED_COMPILES_HOST_DIR not set') # Templates From 29b2648606d0984d253499ef321e15d6c526a693 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 21 Feb 2017 11:01:52 +0000 Subject: [PATCH 122/182] Remove texlive docks --- server-ce/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 4e721dc5ef..b8ca0a0360 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -23,7 +23,8 @@ RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \ 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; \ + rm -rf /usr/local/texlive/2016/texmf-dist/doc/ RUN rm -r /install-tl-unx; \ rm install-tl-unx.tar.gz From 3c431008ddf4837c403d102a23116cdb33b7f80c Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 21 Feb 2017 11:22:25 +0000 Subject: [PATCH 123/182] split base image from main image --- server-ce/Dockerfile | 50 ++++----------------------------------- server-ce/Dockerfile-base | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 server-ce/Dockerfile-base diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index b8ca0a0360..2e688a0c55 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -1,58 +1,18 @@ -FROM phusion/baseimage:0.9.16 +FROM sharelatex-base-image -ENV baseDir . - -RUN apt-get update -RUN curl -sL https://deb.nodesource.com/setup | 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 - -ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex - -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 ShareLaTeX settings file +# Install sharelatex settings file ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee -# Install TexLive -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; \ - rm -rf /usr/local/texlive/2016/texmf-dist/doc/ - -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/2016/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; - - 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 -COPY ${baseDir}/init_scripts/ /etc/my_init.d/ +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 #random_change @@ -78,8 +38,6 @@ RUN cd /var/www/sharelatex/web; \ RUN cd /var/www/sharelatex/clsi; \ grunt compile:bin - - EXPOSE 80 WORKDIR / diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base new file mode 100644 index 0000000000..55c69e0aa5 --- /dev/null +++ b/server-ce/Dockerfile-base @@ -0,0 +1,41 @@ +# Sharelatex Base Image + +FROM phusion/baseimage:0.9.16 + +ENV baseDir . + +RUN apt-get update +RUN curl -sL https://deb.nodesource.com/setup | 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 + +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 TexLive +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 + +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/2016/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; + From 4c78f400b2d728faf4fdfdf85d6aa0d531edc4ac Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 22 Feb 2017 09:20:07 +0000 Subject: [PATCH 124/182] Update image names --- server-ce/Dockerfile | 4 +++- server-ce/Dockerfile-base | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 2e688a0c55..0efcdefa30 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -1,4 +1,6 @@ -FROM sharelatex-base-image +# Sharelatex Community Edition (sharelatex/sharelatex) + +FROM sharelatex/sharelatex-base # Install sharelatex settings file ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index 55c69e0aa5..4142c48b0c 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -1,4 +1,4 @@ -# Sharelatex Base Image +# Sharelatex Base Image (sharelatex/sharelatex-base) FROM phusion/baseimage:0.9.16 From 618c2710393c0cff82e7d6a2214098001d52eba6 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 22 Feb 2017 09:23:01 +0000 Subject: [PATCH 125/182] Add a makefil --- server-ce/Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 server-ce/Makefile diff --git a/server-ce/Makefile b/server-ce/Makefile new file mode 100644 index 0000000000..75e967936a --- /dev/null +++ b/server-ce/Makefile @@ -0,0 +1,12 @@ +# Makefile + + +build-base: + docker build -f Dockerfile-base -t sharelatex/sharelatex-base . + + +build-community: + docker build -f Dockerfile -t sharelatex/sharelatex . + + +PHONY: build-base build-community From f31b9d3a7df1b8cb8b90b82c244464fae6239927 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 22 Feb 2017 09:48:34 +0000 Subject: [PATCH 126/182] Set baseDir var --- server-ce/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 0efcdefa30..a520960c4f 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -2,6 +2,8 @@ FROM sharelatex/sharelatex-base +ENV baseDir . + # Install sharelatex settings file ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee @@ -17,7 +19,7 @@ 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 #random_change +RUN git clone https://github.com/sharelatex/sharelatex.git /var/www/sharelatex ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js ADD ${baseDir}/package.json /var/www/package.json From d1a73c5600bc104e03ff64af9ac3e88963bf866e Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 23 Feb 2017 09:47:11 +0000 Subject: [PATCH 127/182] Add docHash to key_schema --- server-ce/settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 7891c4a1a5..9eec76da71 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -54,6 +54,7 @@ settings = docLines: ({doc_id}) -> "doclines:#{doc_id}" docOps: ({doc_id}) -> "DocOps:#{doc_id}" docVersion: ({doc_id}) -> "DocVersion:#{doc_id}" + docHash: ({doc_id}) -> "DocHash:#{doc_id}" projectKey: ({doc_id}) -> "ProjectId:#{doc_id}" docsInProject: ({project_id}) -> "DocsIn:#{project_id}" ranges: ({doc_id}) -> "Ranges:#{doc_id}" From b30b100dca71585509e9c0e144c29ca434750158 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 27 Feb 2017 15:46:28 +0000 Subject: [PATCH 128/182] Pin to sharelatex-base:v1.0.0 --- server-ce/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index a520960c4f..11f0d2ef39 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -1,6 +1,6 @@ # Sharelatex Community Edition (sharelatex/sharelatex) -FROM sharelatex/sharelatex-base +FROM sharelatex/sharelatex-base:v1.0.0 ENV baseDir . From 25d21cbf2951bc96994e89e37c7317f169cd436c Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 5 Apr 2017 14:48:36 +0100 Subject: [PATCH 129/182] Add `trackchanges.continueOnError` as default --- server-ce/settings.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 9eec76da71..99c8b9d280 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -101,6 +101,9 @@ settings = # secret: "AWS_SECRET" # + trackchanges: + continueOnError: true + # Local disk caching # ------------------ path: From f7a2d60c440f4f7ce58cdc21a2e0ec90412c8b41 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 17 May 2017 15:29:01 +0100 Subject: [PATCH 130/182] Update redis configs to accomodate recent changes --- server-ce/settings.coffee | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 99c8b9d280..adf5bb5867 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -43,13 +43,8 @@ settings = host: process.env["SHARELATEX_REDIS_HOST"] or "dockerhost" port: process.env["SHARELATEX_REDIS_PORT"] or "6379" password: process.env["SHARELATEX_REDIS_PASS"] or "" - fairy: redisConfig - documentupdater: [{ - primary: true - port: process.env["SHARELATEX_REDIS_PORT"] or "6379" - host: process.env["SHARELATEX_REDIS_HOST"] or "dockerhost" - password: process.env["SHARELATEX_REDIS_PASS"] or "" key_schema: + # document-updater blockingKey: ({doc_id}) -> "Blocking:#{doc_id}" docLines: ({doc_id}) -> "doclines:#{doc_id}" docOps: ({doc_id}) -> "DocOps:#{doc_id}" @@ -58,8 +53,25 @@ settings = projectKey: ({doc_id}) -> "ProjectId:#{doc_id}" docsInProject: ({project_id}) -> "DocsIn:#{project_id}" ranges: ({doc_id}) -> "Ranges:#{doc_id}" - }] - + # document-updater:realtime + pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}" + # document-updater:history + uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:#{doc_id}" + docsWithHistoryOps: ({project_id}) -> "DocsWithHistoryOps:#{project_id}" + # document-updater:lock + blockingKey: ({doc_id}) -> "Blocking:#{doc_id}" + # track-changes:lock + historyLock: ({doc_id}) -> "HistoryLock:#{doc_id}" + historyIndexLock: ({project_id}) -> "HistoryIndexLock:#{project_id}" + # track-chanegs:history + uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:#{doc_id}" + docsWithHistoryOps: ({project_id}) -> "DocsWithHistoryOps:#{project_id}" + fairy: redisConfig + # track-changes and document-updater + realtime: redisConfig + documentupdater: redisConfig + lock: redisConfig + history: redisConfig # The compile server (the clsi) uses a SQL database to cache files and # meta-data. sqllite is the default, and the load is low enough that this will From b52028c7bbbed498d323d539a4e231c0857a12a4 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 18 May 2017 10:55:41 +0100 Subject: [PATCH 131/182] Add realtime config and websessions to redis --- server-ce/settings.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index adf5bb5867..a68eb483dd 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -66,12 +66,16 @@ settings = # track-chanegs:history uncompressedHistoryOps: ({doc_id}) -> "UncompressedHistoryOps:#{doc_id}" docsWithHistoryOps: ({project_id}) -> "DocsWithHistoryOps:#{project_id}" + # realtime + clientsInProject: ({project_id}) -> "clients_in_project:#{project_id}" + connectedUser: ({project_id, client_id})-> "connected_user:#{project_id}:#{client_id}" fairy: redisConfig # track-changes and document-updater realtime: redisConfig documentupdater: redisConfig lock: redisConfig history: redisConfig + websessions: redisConfig # The compile server (the clsi) uses a SQL database to cache files and # meta-data. sqllite is the default, and the load is low enough that this will From d5fa1401a1a22b1c313a5ae57d17ede7973bfb20 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 18 May 2017 13:08:55 +0100 Subject: [PATCH 132/182] Ensure bcrypt gets installed --- server-ce/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 11f0d2ef39..9f6cd1032a 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -29,7 +29,9 @@ RUN cd /var/www && npm install RUN cd /var/www/sharelatex; \ npm install; \ grunt install; \ - cd web/modules; \ + cd web; \ + npm install && npm install bcrypt; \ + cd modules; \ git clone https://bitbucket.org/sharelatex/launchpad-webmodule.git launchpad; \ grunt compile; From 4b46a4e655ed1e735e77dfe4c9190eba878b23db Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 19 May 2017 08:32:34 +0100 Subject: [PATCH 133/182] Refactor --- server-ce/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 9f6cd1032a..10db29293c 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -30,7 +30,8 @@ RUN cd /var/www/sharelatex; \ npm install; \ grunt install; \ cd web; \ - npm install && npm install bcrypt; \ + npm install; \ + npm install bcrypt; \ cd modules; \ git clone https://bitbucket.org/sharelatex/launchpad-webmodule.git launchpad; \ grunt compile; From 0c65c4d963e9683a9d4a3b193f44882e78b562dd Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 21 Jun 2017 10:59:19 +0100 Subject: [PATCH 134/182] add the driver field to email config --- server-ce/settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index a68eb483dd..9b7fe58c40 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -396,6 +396,7 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? settings.email = fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] replyTo: process.env["SHARELATEX_EMAIL_REPLY_TO"] or "" + driver: process.env["SHARELATEX_EMAIL_DRIVER"] parameters: #AWS Creds AWSAccessKeyID: process.env["SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID"] From bcd1c7c4d6951149bf350f5b266fc6e2c9146908 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 2 Aug 2017 08:42:30 +0100 Subject: [PATCH 135/182] Update the node distro --- 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 4142c48b0c..6ea4fd93d6 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -5,7 +5,7 @@ FROM phusion/baseimage:0.9.16 ENV baseDir . RUN apt-get update -RUN curl -sL https://deb.nodesource.com/setup | sudo bash - +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 WORKDIR /opt From ff99e226bc7f7fb5bd6f0c909255e45296543d6c Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 2 Aug 2017 09:45:08 +0100 Subject: [PATCH 136/182] Update texlive path --- 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 6ea4fd93d6..a59431fc9d 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -24,7 +24,7 @@ RUN echo "selected_scheme scheme-basic" >> /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/2016/bin/x86_64-linux/ +ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/2017/bin/x86_64-linux/ RUN tlmgr install latexmk RUN tlmgr install texcount From fd71cd3c0a331e9a80ca0dca8ed9d5b07160eb21 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 6 Sep 2017 11:16:12 +0100 Subject: [PATCH 137/182] Add call to install-services --- server-ce/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 10db29293c..6e94aa3ab8 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -29,6 +29,7 @@ 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; \ From d13fbe4c4861a746154063471a72d24d1a578161 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 8 Sep 2017 09:09:42 +0100 Subject: [PATCH 138/182] Pin to latest base image --- server-ce/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 6e94aa3ab8..7593c726f7 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -1,6 +1,6 @@ # Sharelatex Community Edition (sharelatex/sharelatex) -FROM sharelatex/sharelatex-base:v1.0.0 +FROM sharelatex/sharelatex-base:latest ENV baseDir . From 1b76a0e7c3478b697860c90facf22b816fdc0bda Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 18 Oct 2017 13:28:13 +0100 Subject: [PATCH 139/182] Add setting to enable anonymous read-write sharing --- server-ce/settings.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 9b7fe58c40..01614eae00 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -22,6 +22,9 @@ TMP_DIR = '/var/lib/sharelatex/tmp' settings = + allowAnonymousReadAndWriteSharing: + process.env['SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING'] == 'true' + # Databases # --------- From 8dd61c9d53c3da02b238d84e0db769887b4a1585 Mon Sep 17 00:00:00 2001 From: Rico Date: Mon, 23 Oct 2017 14:46:37 +0200 Subject: [PATCH 140/182] Fix typo in error log filename --- server-ce/runit/errorlogs/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/runit/errorlogs/run b/server-ce/runit/errorlogs/run index e4053dab9e..45ab0ed313 100755 --- a/server-ce/runit/errorlogs/run +++ b/server-ce/runit/errorlogs/run @@ -1,2 +1,2 @@ #!/bin/bash -tail -F /var/log/sharelatex/*.log | grep '"level":50' >> /var/log/sharlatex-errors.log +tail -F /var/log/sharelatex/*.log | grep '"level":50' >> /var/log/sharelatex-errors.log From e8078424edf212780585489f390e5b1107549d15 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 10 Nov 2017 14:15:22 +0000 Subject: [PATCH 141/182] add option to bypass percentage-based rollouts --- server-ce/settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 01614eae00..37bb88a18a 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -448,6 +448,7 @@ if process.env["SHARELATEX_PASSWORD_VALIDATION_PATTERN"] or process.env["SHARELA ####################### if parse(process.env["SHARELATEX_IS_SERVER_PRO"]) == true + settings.bypassPercentageRollouts = true settings.apis.references = url: "http://localhost:3040" From 8cae3f66c22800148b4bc8030bd0bc6e50d56a2b Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 5 Dec 2017 09:48:05 +0000 Subject: [PATCH 142/182] move contacts run file --- .../runit/{contacts-sharelatex.sh => contacts-sharelatex/run} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename server-ce/runit/{contacts-sharelatex.sh => contacts-sharelatex/run} (100%) diff --git a/server-ce/runit/contacts-sharelatex.sh b/server-ce/runit/contacts-sharelatex/run similarity index 100% rename from server-ce/runit/contacts-sharelatex.sh rename to server-ce/runit/contacts-sharelatex/run From 04579ce5037809b422bbd7aff8fe22f397b27b7f Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 6 Dec 2017 11:21:54 +0000 Subject: [PATCH 143/182] Pin contacts to branch 'sk-update-mongojs' --- server-ce/services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/services.js b/server-ce/services.js index b79ab9a4b7..941dd23a0e 100644 --- a/server-ce/services.js +++ b/server-ce/services.js @@ -43,7 +43,7 @@ module.exports = }, { name: "contacts", repo: "https://github.com/sharelatex/contacts-sharelatex.git", - version: "master" + version: "sk-update-mongojs" }, { name: "notifications", repo: "https://github.com/sharelatex/notifications-sharelatex.git", From 9091749448c734f53d26de55854369a9a54f902f Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 8 Jan 2018 16:21:18 +0000 Subject: [PATCH 144/182] Chown the sharelatex directory to www-data --- server-ce/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 7593c726f7..36ad4e19c2 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -44,7 +44,8 @@ RUN cd /var/www/sharelatex/web; \ grunt compile:minify; RUN cd /var/www/sharelatex/clsi; \ - grunt compile:bin + grunt compile:bin; \ + chown -R www-data:www-data /var/www/sharelatex; EXPOSE 80 From ad30a56f0a9fb9831462cb8138b2808196ec6dfe Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 22 Jan 2018 14:47:00 +0000 Subject: [PATCH 145/182] Pin version of simple-git --- server-ce/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/package.json b/server-ce/package.json index d3c19d112f..9a8f125940 100644 --- a/server-ce/package.json +++ b/server-ce/package.json @@ -7,7 +7,7 @@ "grunt-contrib-rename": "0.0.3", "grunt-docker-io": "^0.7.0", "grunt-github-api": "^0.2.3", - "simple-git": "^1.32.1", + "simple-git": "1.85.0", "underscore": "^1.8.3" } } From 3970b5b4be75136dc9cddf6929a0e19cfb6dd47a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 26 Jan 2018 09:43:43 +0000 Subject: [PATCH 146/182] added trackChanges into features --- server-ce/settings.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 37bb88a18a..7f4f18067f 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -345,8 +345,9 @@ settings = versioning: true compileTimeout: 180 compileGroup: "standard" - references: true + trackChanges: true templates: true + references: true ## OPTIONAL CONFIGERABLE SETTINGS From 56b2f641d2ba386b450cd166be215e60611eb624 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 6 Feb 2018 10:26:29 +0000 Subject: [PATCH 147/182] Change launchpad location to github --- server-ce/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 36ad4e19c2..881d48cfe6 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -34,7 +34,7 @@ RUN cd /var/www/sharelatex; \ npm install; \ npm install bcrypt; \ cd modules; \ - git clone https://bitbucket.org/sharelatex/launchpad-webmodule.git launchpad; \ + git clone https://github.com/sharelatex/launchpad-web-module.git launchpad; \ grunt compile; RUN cd /var/www && node git-revision > revisions.txt From 9727c374b7d5e0d83aa8afbda1ba98696e92d425 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 19 Feb 2019 10:20:17 +0000 Subject: [PATCH 148/182] Update the readme with a short explanation of how this code works --- server-ce/README.md | 49 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/server-ce/README.md b/server-ce/README.md index 8e5cd84b8e..53a770d328 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,2 +1,47 @@ -## Install -Please see the [offical wiki for install guides](https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions) \ No newline at end of file +# ShareLaTeX Docker Image + +This is the source for building the sharelatex community-edition docker image. + + +## End-User Install +Please see the [offical wiki for install +guides](https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions) + + +## Development + +This repo contains two dockerfiles, `Dockerfile-base`, which builds the +`sharelatex/sharelatex-base` image, and `Dockerfile` which builds the +`sharelatex/sharelatex` (or "community") image. + +The Base image generally contains the basic dependencies like `wget` and +`aspell`, plus `texlive`. We split this out because it's a pretty heavy set of +dependencies, and it's nice to not have to rebuild all of that every time. + +The Sharelatex image extends the base image and adds the actual sharelatex code +and services. + +Use `make build-base` and `make build-community` to build these images. + + +### How the Sharelatex code gets here + +This repo uses [the public Sharelatex +repository](https://github.com/sharelatex/sharelatex), which used to be the main +public source for the sharelatex system. + +That repo is cloned down into the docker image, and a script then installs all +the services. This way of doing things predates the new dev-env, and isn't +currently tested. + + +### How services run inside the container + +We use the [Phusion base-image](https://github.com/phusion/baseimage-docker) +(which is extended by our `base` image) to provide us with a VM-like container +in which to run the sharelatex services. Baseimage uses the `runit` service +manager to manage services, and we add our init-scripts from the `./runit` +folder. + +Overall, this is very like how the services would run in production, it just +happens to be all inside one docker container instead of being on one VM. From f8b3741292049e9fa7935c1ed816c5f8e72f7996 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 1 Mar 2019 11:16:12 +0000 Subject: [PATCH 149/182] remove bit from readme --- server-ce/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/server-ce/README.md b/server-ce/README.md index 53a770d328..ed5cd3a91f 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -42,6 +42,3 @@ We use the [Phusion base-image](https://github.com/phusion/baseimage-docker) in which to run the sharelatex services. Baseimage uses the `runit` service manager to manage services, and we add our init-scripts from the `./runit` folder. - -Overall, this is very like how the services would run in production, it just -happens to be all inside one docker container instead of being on one VM. From 2bf86d8ea7c84768cb5a7d48693fa0a860c57d0d Mon Sep 17 00:00:00 2001 From: mserranom Date: Wed, 7 Aug 2019 08:47:05 +0000 Subject: [PATCH 150/182] 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 151/182] 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 152/182] 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 From 1df1f17fc60c412dd2670a02f3cb579cf23d77b0 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 20 Aug 2019 10:50:23 +0200 Subject: [PATCH 153/182] Run filestore with node6 (#108) --- server-ce/runit/filestore-sharelatex/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/runit/filestore-sharelatex/run b/server-ce/runit/filestore-sharelatex/run index e0858c01ce..1ba126dda0 100755 --- a/server-ce/runit/filestore-sharelatex/run +++ b/server-ce/runit/filestore-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/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1 \ No newline at end of file +exec /sbin/setuser www-data /usr/bin/node6 /var/www/sharelatex/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1 From f100877eb76cd5e7c3e722e6239c6533db2df971 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 22 Aug 2019 16:57:26 +0200 Subject: [PATCH 154/182] Server Pro fixes (#109) --- server-ce/.dockerignore | 3 + server-ce/.gitignore | 1 + server-ce/Dockerfile-base | 12 +++- server-ce/README.md | 21 +++--- server-ce/settings.coffee | 144 +------------------------------------- 5 files changed, 27 insertions(+), 154 deletions(-) create mode 100644 server-ce/.dockerignore diff --git a/server-ce/.dockerignore b/server-ce/.dockerignore new file mode 100644 index 0000000000..fd3df9c73e --- /dev/null +++ b/server-ce/.dockerignore @@ -0,0 +1,3 @@ +.DS_Store +.git/ +node_modules/ \ No newline at end of file diff --git a/server-ce/.gitignore b/server-ce/.gitignore index 023b43469e..877b99b865 100644 --- a/server-ce/.gitignore +++ b/server-ce/.gitignore @@ -1,3 +1,4 @@ +.DS_Store node_modules/ api-data versions/ diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index aed92b21b8..f56136fd87 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -1,5 +1,5 @@ # -------------------------------------------------- -# Sharelatex Base Image (sharelatex/sharelatex-base) +# Overleaf Base Image (sharelatex/sharelatex-base) # -------------------------------------------------- FROM phusion/baseimage:0.11 @@ -44,6 +44,16 @@ RUN wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \ 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 + +# CTAN mirrors occasionally fail, in that case install TexLive against an +# specific server, for example http://ctan.crest.fr +# RUN wget http://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 \ +# -repository http://ctan.crest.fr/tex-archive/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/2019/bin/x86_64-linux/ diff --git a/server-ce/README.md b/server-ce/README.md index ed5cd3a91f..c1894afce0 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -1,11 +1,11 @@ -# ShareLaTeX Docker Image +# Overleaf Docker Image -This is the source for building the sharelatex community-edition docker image. +This is the source for building the Overleaf community-edition docker image. ## End-User Install Please see the [offical wiki for install -guides](https://github.com/sharelatex/sharelatex/wiki/Production-Installation-Instructions) +guides](https://github.com/overleaf/overleaf/wiki) ## Development @@ -18,27 +18,26 @@ The Base image generally contains the basic dependencies like `wget` and `aspell`, plus `texlive`. We split this out because it's a pretty heavy set of dependencies, and it's nice to not have to rebuild all of that every time. -The Sharelatex image extends the base image and adds the actual sharelatex code +The `sharelatex/sharelatex` image extends the base image and adds the actual Overleaf code and services. Use `make build-base` and `make build-community` to build these images. -### How the Sharelatex code gets here +### How the Overleaf code gets here -This repo uses [the public Sharelatex -repository](https://github.com/sharelatex/sharelatex), which used to be the main -public source for the sharelatex system. +This repo uses [the public Overleaf +repository](https://github.com/overleaf/overleaf), which used to be the main +public source for the Overleaf system. That repo is cloned down into the docker image, and a script then installs all -the services. This way of doing things predates the new dev-env, and isn't -currently tested. +the services. ### How services run inside the container We use the [Phusion base-image](https://github.com/phusion/baseimage-docker) (which is extended by our `base` image) to provide us with a VM-like container -in which to run the sharelatex services. Baseimage uses the `runit` service +in which to run the Overleaf services. Baseimage uses the `runit` service manager to manage services, and we add our init-scripts from the `./runit` folder. diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 92a545eac7..b8259b96ed 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -193,146 +193,6 @@ settings = www: {lngCode:process.env["SHARELATEX_SITE_LANGUAGE"] or "en", url: siteUrl} defaultLng: process.env["SHARELATEX_SITE_LANGUAGE"] or "en" - # Spell Check Languages - # --------------------- - # - # You must have the corresponding aspell dictionary installed to - # be able to use a language. Run `grunt check:aspell` to check which - # dictionaries you have installed. These should be set for the `code` for - # each language. - languages: [{ - "code":"en", "name":"English (American)" - },{ - "code":"en_GB", "name":"English (British)" - },{ - "code":"af", "name":"Africaans" - },{ - "code":"am", "name":"Amharic" - },{ - "code":"ar", "name":"Arabic" - },{ - "code":"hy", "name":"Armenian" - },{ - "code":"gl", "name":"Galician" - },{ - "code":"eu", "name":"Basque" - },{ - "code":"bn", "name":"Bengali" - },{ - "code":"br", "name":"Breton" - },{ - "code":"bg", "name":"Bulgarian" - },{ - "code":"ca", "name":"Catalan" - },{ - "code":"hr", "name":"Croatian" - },{ - "code":"cs", "name":"Czech" - },{ - "code":"da", "name":"Danish" - },{ - "code":"nl", "name":"Dutch" - },{ - "code":"eo", "name":"Esperanto" - },{ - "code":"et", "name":"Estonian" - },{ - "code":"fo", "name":"Faroese" - },{ - "code":"fr", "name":"French" - },{ - "code":"de", "name":"German" - },{ - "code":"el", "name":"Greek" - },{ - "code":"gu", "name":"Gujarati" - },{ - "code":"he", "name":"Hebrew" - },{ - "code":"hi", "name":"Hindi" - },{ - "code":"hu", "name":"Hungarian" - },{ - "code":"is", "name":"Icelandic" - },{ - "code":"id", "name":"Indonesian" - },{ - "code":"ga", "name":"Irish" - },{ - "code":"it", "name":"Italian" - },{ - "code":"kn", "name":"Kannada" - },{ - "code":"kk", "name":"Kazakh" - },{ - "code":"ku", "name":"Kurdish" - },{ - "code":"lv", "name":"Latvian" - },{ - "code":"lt", "name":"Lithuanian" - },{ - "code":"ml", "name":"Malayalam" - },{ - "code":"mr", "name":"Marathi" - },{ - "code":"nr", "name":"Ndebele" - },{ - "code":"ns", "name":"Northern Sotho" - },{ - "code":"no", "name":"Norwegian" - },{ - "code":"or", "name":"Oriya" - },{ - "code":"fa", "name":"Persian" - },{ - "code":"pl", "name":"Polish" - },{ - "code":"pt_BR", "name":"Portuguese (Brazilian)" - },{ - "code":"pt_PT", "name":"Portuguese (European)" - },{ - "code":"pa", "name":"Punjabi" - },{ - "code":"ro", "name":"Romanian" - },{ - "code":"ru", "name":"Russian" - },{ - "code":"sk", "name":"Slovak" - },{ - "code":"sl", "name":"Slovenian" - },{ - "code":"st", "name":"Southern Sotho" - },{ - "code":"es", "name":"Spanish" - },{ - "code":"ss", "name":"Swazi" - },{ - "code":"sv", "name":"Swedish" - },{ - "code":"tl", "name":"Tagalog" - },{ - "code":"ta", "name":"Tamil" - },{ - "code":"te", "name":"Telugu" - },{ - "code":"ts", "name":"Tsonga" - },{ - "code":"tn", "name":"Tswana" - },{ - "code":"uk", "name":"Ukrainian" - },{ - "code":"hsb", "name":"Upper Sorbian" - },{ - "code":"uz", "name":"Uzbek" - },{ - "code":"cy", "name":"Welsh" - },{ - "code":"xh", "name":"Xhosa" - },{ - "code":"zu", "name":"Zulu" - } - ] - apis: web: url: "http://localhost:3000" @@ -628,7 +488,7 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] # -------- if process.env["SANDBOXED_COMPILES"] == "true" settings.clsi = - commandRunner: "docker-runner-sharelatex" + dockerRunner: true docker: image: process.env["TEX_LIVE_DOCKER_IMAGE"] env: @@ -640,7 +500,7 @@ if process.env["SANDBOXED_COMPILES"] == "true" settings.path = {} settings.path.synctexBaseDir = () -> "/compile" if process.env['SANDBOXED_COMPILES_SIBLING_CONTAINERS'] == 'true' - console.log("Using sibling containers for sandoxed compiles") + console.log("Using sibling containers for sandboxed compiles") if process.env['SANDBOXED_COMPILES_HOST_DIR'] settings.path.sandboxedCompilesHostDir = process.env['SANDBOXED_COMPILES_HOST_DIR'] else From a818b1d427dac43c677377982c20bc3cfcbb00ea Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 3 Sep 2019 11:36:39 +0200 Subject: [PATCH 155/182] Updated settings to serve minified assets (#110) --- server-ce/settings.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index b8259b96ed..89fc442d64 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -169,9 +169,8 @@ settings = httpAuthUsers: httpAuthUsers # 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: false + # need to run `make minify` within the web directory to generate these. + useMinifiedJs: true # 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 d126eb711239d1c85ad71483cd4ef14c31ff7e06 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Wed, 4 Sep 2019 16:39:47 +0200 Subject: [PATCH 156/182] Updated settings with several fixes (#111) --- server-ce/settings.coffee | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 89fc442d64..96970b8bb1 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -168,8 +168,7 @@ settings = # between services that may need to go over public channels httpAuthUsers: httpAuthUsers - # Should javascript assets be served minified or not. Note that you will - # need to run `make minify` within the web directory to generate these. + # Should javascript assets be served minified or not. useMinifiedJs: true # Should static assets be sent with a header to tell the browser to cache @@ -197,6 +196,10 @@ settings = url: "http://localhost:3000" user: httpAuthUser pass: httpAuthPass + # overrides v1.url to indicate via Feature Flags that Overleaf V1 + # is not available + v1: + url: null references:{} notifications:undefined @@ -421,8 +424,6 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] entryPoint: process.env["SHARELATEX_SAML_ENTRYPOINT"] callbackUrl: process.env["SHARELATEX_SAML_CALLBACK_URL"] issuer: process.env["SHARELATEX_SAML_ISSUER"] - cert: process.env["SHARELATEX_SAML_CERT"] - privateCert: process.env["SHARELATEX_SAML_PRIVATE_CERT"] decryptionPvk: process.env["SHARELATEX_SAML_DECRYPTION_PVK"] signatureAlgorithm: process.env["SHARELATEX_SAML_SIGNATURE_ALGORITHM"] identifierFormat: process.env["SHARELATEX_SAML_IDENTIFIER_FORMAT"] @@ -482,6 +483,11 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] undefined ) + # SHARELATEX_SAML_CERT cannot be empty + # https://github.com/bergie/passport-saml/commit/f6b1c885c0717f1083c664345556b535f217c102 + if process.env["SHARELATEX_SAML_CERT"] + settings.saml.server.cert = process.env["SHARELATEX_SAML_CERT"] + settings.saml.server.privateCert = process.env["SHARELATEX_SAML_PRIVATE_CERT"] # Compiler # -------- From 47eb3e4186b74dc5280d2b3e3b12d759f8266493 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Fri, 6 Sep 2019 10:37:03 +0200 Subject: [PATCH 157/182] Override v1.url setting with "" instead of null (#112) --- server-ce/settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 96970b8bb1..fb930628a1 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -199,7 +199,7 @@ settings = # overrides v1.url to indicate via Feature Flags that Overleaf V1 # is not available v1: - url: null + url: "" references:{} notifications:undefined From fad5639f5581fcc64472a1670e64ce252e73cedd Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 10 Sep 2019 17:13:17 +0200 Subject: [PATCH 158/182] Added debugging support to services (#113) --- server-ce/.dockerignore | 2 +- server-ce/Dockerfile-base | 2 +- server-ce/runit/chat-sharelatex/run | 9 +++++- server-ce/runit/clsi-sharelatex/run | 9 +++++- server-ce/runit/contacts-sharelatex/run | 9 +++++- server-ce/runit/docstore-sharelatex/run | 9 +++++- .../runit/document-updater-sharelatex/run | 9 +++++- server-ce/runit/notifications-sharelatex/run | 9 +++++- server-ce/runit/real-time-sharelatex/run | 2 +- server-ce/runit/spelling-sharelatex/run | 9 +++++- server-ce/runit/tags-sharelatex/run | 9 +++++- server-ce/runit/track-changes-sharelatex/run | 9 +++++- server-ce/runit/web-sharelatex/run | 9 +++++- server-ce/settings.coffee | 28 +++++++++---------- 14 files changed, 97 insertions(+), 27 deletions(-) diff --git a/server-ce/.dockerignore b/server-ce/.dockerignore index fd3df9c73e..2a5c59398a 100644 --- a/server-ce/.dockerignore +++ b/server-ce/.dockerignore @@ -1,3 +1,3 @@ .DS_Store .git/ -node_modules/ \ No newline at end of file +node_modules/ diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index f56136fd87..2cff8a830f 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -43,7 +43,7 @@ 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 + /install-tl-unx/install-tl -profile /install-tl-unx/texlive.profile # CTAN mirrors occasionally fail, in that case install TexLive against an # specific server, for example http://ctan.crest.fr diff --git a/server-ce/runit/chat-sharelatex/run b/server-ce/runit/chat-sharelatex/run index 1b8533bb86..cc5f75057f 100755 --- a/server-ce/runit/chat-sharelatex/run +++ b/server-ce/runit/chat-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/chat/app.js >> /var/log/sharelatex/chat.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - chat" + 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 diff --git a/server-ce/runit/clsi-sharelatex/run b/server-ce/runit/clsi-sharelatex/run index 1c6974cd2a..7492acf6d1 100755 --- a/server-ce/runit/clsi-sharelatex/run +++ b/server-ce/runit/clsi-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/clsi/app.js >> /var/log/sharelatex/clsi.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - clsi" + NODE_PARAMS="--inspect=0.0.0.0:30130" +fi + +exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/clsi/app.js >> /var/log/sharelatex/clsi.log 2>&1 diff --git a/server-ce/runit/contacts-sharelatex/run b/server-ce/runit/contacts-sharelatex/run index 29b513cb97..e220d9ac1d 100755 --- a/server-ce/runit/contacts-sharelatex/run +++ b/server-ce/runit/contacts-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/contacts/app.js >> /var/log/sharelatex/contacts 2>&1 + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - contacts" + 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 2>&1 diff --git a/server-ce/runit/docstore-sharelatex/run b/server-ce/runit/docstore-sharelatex/run index 0de82ccf20..2a171f0968 100755 --- a/server-ce/runit/docstore-sharelatex/run +++ b/server-ce/runit/docstore-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/docstore/app.js >> /var/log/sharelatex/docstore.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - docstore" + 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 diff --git a/server-ce/runit/document-updater-sharelatex/run b/server-ce/runit/document-updater-sharelatex/run index 274b7f9998..51472b3d48 100755 --- a/server-ce/runit/document-updater-sharelatex/run +++ b/server-ce/runit/document-updater-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/document-updater/app.js >> /var/log/sharelatex/document-updater.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - document updater" + 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 diff --git a/server-ce/runit/notifications-sharelatex/run b/server-ce/runit/notifications-sharelatex/run index 12b3457f2c..89f8ad54f9 100755 --- a/server-ce/runit/notifications-sharelatex/run +++ b/server-ce/runit/notifications-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/notifications/app.js >> /var/log/sharelatex/notifications.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - notifications" + 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 diff --git a/server-ce/runit/real-time-sharelatex/run b/server-ce/runit/real-time-sharelatex/run index 7168368c38..1d00837def 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/node6 /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 diff --git a/server-ce/runit/spelling-sharelatex/run b/server-ce/runit/spelling-sharelatex/run index 4466bcfcf5..a9a73f8ae0 100755 --- a/server-ce/runit/spelling-sharelatex/run +++ b/server-ce/runit/spelling-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/spelling/app.js >> /var/log/sharelatex/spelling.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - spelling" + 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 diff --git a/server-ce/runit/tags-sharelatex/run b/server-ce/runit/tags-sharelatex/run index a5630ed4ff..62fe058ad9 100755 --- a/server-ce/runit/tags-sharelatex/run +++ b/server-ce/runit/tags-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/tags/app.js >> /var/log/sharelatex/tags.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - tags" + NODE_PARAMS="--inspect=0.0.0.0:30120" +fi + +exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/tags/app.js >> /var/log/sharelatex/tags.log 2>&1 diff --git a/server-ce/runit/track-changes-sharelatex/run b/server-ce/runit/track-changes-sharelatex/run index aeb812ef38..45b3b77ebc 100755 --- a/server-ce/runit/track-changes-sharelatex/run +++ b/server-ce/runit/track-changes-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/track-changes/app.js >> /var/log/sharelatex/track-changes.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - track-changes" + 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 diff --git a/server-ce/runit/web-sharelatex/run b/server-ce/runit/web-sharelatex/run index 053a55a326..c1371de0f4 100755 --- a/server-ce/runit/web-sharelatex/run +++ b/server-ce/runit/web-sharelatex/run @@ -1,3 +1,10 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/web/app.js >> /var/log/sharelatex/web.log 2>&1 \ No newline at end of file + +NODE_PARAMS="" +if [ "$DEBUG_NODE" == "true" ]; then + echo "running debug - web" + NODE_PARAMS="--inspect=0.0.0.0:40000" +fi + +exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/web/app.js >> /var/log/sharelatex/web.log 2>&1 diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index fb930628a1..3cb6a510b9 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -34,7 +34,7 @@ settings = # Documentation about the URL connection string format can be found at: # # http://docs.mongodb.org/manual/reference/connection-string/ - # + # # The following works out of the box with Mongo's default settings: mongo: url : process.env["SHARELATEX_MONGO_URL"] or 'mongodb://dockerhost/sharelatex' @@ -105,11 +105,11 @@ settings = # ShareLaTeX can store binary files like images either locally or in Amazon # S3. The default is locally: filestore: - backend: "fs" + backend: "fs" stores: user_files: Path.join(DATA_DIR, "user_files") template_files: Path.join(DATA_DIR, "template_files") - + # To use Amazon S3 as a storage backend, comment out the above config, and # uncomment the following, filling in your key, secret, and bucket name: # @@ -120,7 +120,7 @@ settings = # s3: # key: "AWS_KEY" # secret: "AWS_SECRET" - # + # trackchanges: continueOnError: true @@ -158,7 +158,7 @@ settings = # The email address which users will be directed to as the main point of # contact for this installation of ShareLaTeX. adminEmail: process.env["SHARELATEX_ADMIN_EMAIL"] or "placeholder@example.com" - + # If provided, a sessionSecret is used to sign cookies so that they cannot be # spoofed. This is recommended. security: @@ -167,7 +167,7 @@ settings = # These credentials are used for authenticating api requests # between services that may need to go over public channels httpAuthUsers: httpAuthUsers - + # Should javascript assets be served minified or not. useMinifiedJs: true @@ -179,7 +179,7 @@ settings = # If you are running ShareLaTeX over https, set this to true to send the # cookie with a secure flag (recommended). secureCookie: process.env["SHARELATEX_SECURE_COOKIE"]? - + # If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc) # then set this to true to allow it to correctly detect the forwarded IP # address and http/https protocol information. @@ -197,9 +197,9 @@ settings = user: httpAuthUser pass: httpAuthPass # overrides v1.url to indicate via Feature Flags that Overleaf V1 - # is not available + # is not available v1: - url: "" + url: "" references:{} notifications:undefined @@ -260,7 +260,7 @@ if process.env["SHARELATEX_HEADER_EXTRAS"]? if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? - + settings.email = fromAddress: process.env["SHARELATEX_EMAIL_FROM_ADDRESS"] replyTo: process.env["SHARELATEX_EMAIL_REPLY_TO"] or "" @@ -291,7 +291,7 @@ if process.env["SHARELATEX_EMAIL_FROM_ADDRESS"]? # i18n -if process.env["SHARELATEX_LANG_DOMAIN_MAPPING"]? +if process.env["SHARELATEX_LANG_DOMAIN_MAPPING"]? settings.i18n.subdomainLang = parse(process.env["SHARELATEX_LANG_DOMAIN_MAPPING"]) @@ -484,7 +484,7 @@ if process.env["SHARELATEX_SAML_ENTRYPOINT"] ) # SHARELATEX_SAML_CERT cannot be empty - # https://github.com/bergie/passport-saml/commit/f6b1c885c0717f1083c664345556b535f217c102 + # https://github.com/bergie/passport-saml/commit/f6b1c885c0717f1083c664345556b535f217c102 if process.env["SHARELATEX_SAML_CERT"] settings.saml.server.cert = process.env["SHARELATEX_SAML_CERT"] settings.saml.server.privateCert = process.env["SHARELATEX_SAML_PRIVATE_CERT"] @@ -518,7 +518,7 @@ if process.env["SHARELATEX_TEMPLATES_USER_ID"] settings.templates = mountPointUrl: "/templates" user_id: process.env["SHARELATEX_TEMPLATES_USER_ID"] - + settings.templateLinks = parse(process.env["SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS"]) @@ -533,7 +533,7 @@ if process.env["SHARELATEX_PROXY_LEARN"]? if process.env["SHARELATEX_ELASTICSEARCH_URL"]? settings.references.elasticsearch = host: process.env["SHARELATEX_ELASTICSEARCH_URL"] - + # With lots of incoming and outgoing HTTP connections to different services, # sometimes long running, it is a good idea to increase the default number From 460d334d21c3222729ccfa2d4cff1c26d5f6b2b1 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 24 Sep 2019 11:52:38 +0100 Subject: [PATCH 159/182] Copy logic from clsi entrypoint, to set permissions on docker.sock --- server-ce/runit/clsi-sharelatex/run | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server-ce/runit/clsi-sharelatex/run b/server-ce/runit/clsi-sharelatex/run index 7492acf6d1..539e5f2239 100755 --- a/server-ce/runit/clsi-sharelatex/run +++ b/server-ce/runit/clsi-sharelatex/run @@ -7,4 +7,13 @@ if [ "$DEBUG_NODE" == "true" ]; then NODE_PARAMS="--inspect=0.0.0.0:30130" fi +# Set permissions on docker.sock if present, +# To enable sibling-containers (see entrypoint.sh in clsi project) +if [ -e '/var/run/docker.sock' ]; then + echo ">> Setting permissions on docker socket" + DOCKER_GROUP=$(stat -c '%g' /var/run/docker.sock) + groupadd --non-unique --gid ${DOCKER_GROUP} dockeronhost + 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 From fbd5e2a826dc55539ff03acc17ea289763a67bd3 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 8 Oct 2019 11:54:49 +0200 Subject: [PATCH 160/182] Delete aggregated error log (#117) --- server-ce/runit/errorlogs/run | 2 -- 1 file changed, 2 deletions(-) delete mode 100755 server-ce/runit/errorlogs/run diff --git a/server-ce/runit/errorlogs/run b/server-ce/runit/errorlogs/run deleted file mode 100755 index 45ab0ed313..0000000000 --- a/server-ce/runit/errorlogs/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -tail -F /var/log/sharelatex/*.log | grep '"level":50' >> /var/log/sharelatex-errors.log From 325c31d602c63da7fa02347f6c40a4f78ead70e2 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 8 Oct 2019 12:47:08 +0200 Subject: [PATCH 161/182] Linked CLSI synctext to /opts/synctex (#118) --- server-ce/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index c527411457..d3a6e69e29 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -44,6 +44,11 @@ RUN bash -c 'cd /var/www/sharelatex && source ./bin/install-services' RUN bash -c 'cd /var/www/sharelatex && source ./bin/compile-services' +# Links CLSI sycntex to its default location +# ------------------------------------------ +RUN ln -s /var/www/sharelatex/clsi/bin/synctex /opt/synctex + + # Change application ownership to www-data # ---------------------------------------- RUN chown -R www-data:www-data /var/www/sharelatex; From 5159c9cc8bbbfb5f60bc3b7788c979ebb1a7a391 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 15 Oct 2019 11:00:38 +0200 Subject: [PATCH 162/182] Disable project-history via settings (#125) --- server-ce/settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 3cb6a510b9..8a3cd1af1c 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -200,6 +200,8 @@ settings = # is not available v1: url: "" + project_history: + enabled: false references:{} notifications:undefined From d29b3fa1f7a93647c3306d40a1c9b33184d331a1 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Mon, 21 Oct 2019 11:48:01 +0200 Subject: [PATCH 163/182] Overleaf CE Hotfix 2.0.1 (#126) --- server-ce/hotfix/2.0.1/Dockerfile | 13 +++++++++++++ .../hotfix/2.0.1/create_and_destroy_users.patch | 11 +++++++++++ .../hotfix/2.0.1/disable_project_history.patch | 11 +++++++++++ 3 files changed, 35 insertions(+) create mode 100644 server-ce/hotfix/2.0.1/Dockerfile create mode 100644 server-ce/hotfix/2.0.1/create_and_destroy_users.patch create mode 100644 server-ce/hotfix/2.0.1/disable_project_history.patch diff --git a/server-ce/hotfix/2.0.1/Dockerfile b/server-ce/hotfix/2.0.1/Dockerfile new file mode 100644 index 0000000000..12a85378b4 --- /dev/null +++ b/server-ce/hotfix/2.0.1/Dockerfile @@ -0,0 +1,13 @@ +FROM sharelatex/sharelatex:2.0.0 + + +# Patch 1: Fixes project deletion (https://github.com/overleaf/overleaf/issues/644) +ADD disable_project_history.patch /etc/sharelatex/disable_project_history.patch +RUN cd /etc/sharelatex && \ + patch < disable_project_history.patch + + +# Patch 2: Fixes admin creation via CLI (https://github.com/overleaf/overleaf/issues/647) +ADD create_and_destroy_users.patch /var/www/sharelatex/tasks/create_and_destroy_users.patch +RUN cd /var/www/sharelatex/tasks/ && \ + patch < create_and_destroy_users.patch diff --git a/server-ce/hotfix/2.0.1/create_and_destroy_users.patch b/server-ce/hotfix/2.0.1/create_and_destroy_users.patch new file mode 100644 index 0000000000..bb2dc16898 --- /dev/null +++ b/server-ce/hotfix/2.0.1/create_and_destroy_users.patch @@ -0,0 +1,11 @@ +--- CreateAndDestoryUsers.coffee ++++ CreateAndDestoryUsers.coffee +@@ -21,7 +21,7 @@ module.exports = (grunt) -> + user.save (error) -> + throw error if error? + ONE_WEEK = 7 * 24 * 60 * 60 # seconds +- OneTimeTokenHandler.getNewToken user._id, { expiresIn: ONE_WEEK }, (err, token)-> ++ OneTimeTokenHandler.getNewToken "password", { expiresIn: ONE_WEEK, email:user.email, user_id: user._id.toString() }, (err, token)-> + return next(err) if err? + + console.log "" diff --git a/server-ce/hotfix/2.0.1/disable_project_history.patch b/server-ce/hotfix/2.0.1/disable_project_history.patch new file mode 100644 index 0000000000..830570abbe --- /dev/null +++ b/server-ce/hotfix/2.0.1/disable_project_history.patch @@ -0,0 +1,11 @@ +--- settings.coffee ++++ settings.coffee +@@ -200,6 +200,8 @@ settings = + # is not available + v1: + url: "" ++ project_history: ++ enabled: false + references:{} + notifications:undefined + From bfcba2a9432db468b8c1203a19694341a3c3489f Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 21 Nov 2019 11:52:02 +0100 Subject: [PATCH 164/182] Remove overriden v1 settings (#128) --- server-ce/settings.coffee | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 8a3cd1af1c..922fb32c04 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -196,10 +196,6 @@ settings = url: "http://localhost:3000" user: httpAuthUser pass: httpAuthPass - # overrides v1.url to indicate via Feature Flags that Overleaf V1 - # is not available - v1: - url: "" project_history: enabled: false references:{} From fc0c464216ba2ddccbe2e4b547f1c1c7feb70aa0 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Fri, 22 Nov 2019 10:12:33 +0100 Subject: [PATCH 165/182] Copy synctex executable to docker host (#129) --- server-ce/runit/clsi-sharelatex/run | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server-ce/runit/clsi-sharelatex/run b/server-ce/runit/clsi-sharelatex/run index 539e5f2239..c1469b6cfe 100755 --- a/server-ce/runit/clsi-sharelatex/run +++ b/server-ce/runit/clsi-sharelatex/run @@ -16,4 +16,17 @@ if [ -e '/var/run/docker.sock' ]; then usermod -aG dockeronhost www-data fi +# Copies over CSLI synctex to the host mounted volume, so it +# can be subsequently mounted in TexLive containers on Sandbox Compilation +SYNCTEX=/var/lib/sharelatex/bin/synctex +if [ ! -f "$SYNCTEX" ]; then + if [ "$DISABLE_SYNCTEX_BINARY_COPY" == "true" ]; then + echo ">> Copy of synctex executable disabled by DISABLE_SYNCTEX_BINARY_COPY flag, feature may not work" + else + echo ">> Copying synctex executable to the host" + mkdir -p $(dirname $SYNCTEX ) + cp /var/www/sharelatex/clsi/bin/synctex $SYNCTEX + fi +fi + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/clsi/app.js >> /var/log/sharelatex/clsi.log 2>&1 From c4104806c3e46b07c6d78cbe63741ee8c13a6dd0 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 10 Dec 2019 15:06:40 +0100 Subject: [PATCH 166/182] Hotfix 2.0.2 (#130) --- server-ce/hotfix/2.0.2/1-anon-upload.patch | 60 +++++++++++++++++++ .../hotfix/2.0.2/2-read-only-access.patch | 11 ++++ server-ce/hotfix/2.0.2/3-url-linking-1.patch | 11 ++++ server-ce/hotfix/2.0.2/4-url-linking-2.patch | 20 +++++++ .../hotfix/2.0.2/5-disable-analytics-1.patch | 26 ++++++++ .../hotfix/2.0.2/6-disable-analytics-2.patch | 10 ++++ server-ce/hotfix/2.0.2/Dockerfile | 31 ++++++++++ 7 files changed, 169 insertions(+) create mode 100644 server-ce/hotfix/2.0.2/1-anon-upload.patch create mode 100644 server-ce/hotfix/2.0.2/2-read-only-access.patch create mode 100644 server-ce/hotfix/2.0.2/3-url-linking-1.patch create mode 100644 server-ce/hotfix/2.0.2/4-url-linking-2.patch create mode 100644 server-ce/hotfix/2.0.2/5-disable-analytics-1.patch create mode 100644 server-ce/hotfix/2.0.2/6-disable-analytics-2.patch create mode 100644 server-ce/hotfix/2.0.2/Dockerfile diff --git a/server-ce/hotfix/2.0.2/1-anon-upload.patch b/server-ce/hotfix/2.0.2/1-anon-upload.patch new file mode 100644 index 0000000000..75037901e0 --- /dev/null +++ b/server-ce/hotfix/2.0.2/1-anon-upload.patch @@ -0,0 +1,60 @@ +--- UploadsRouter.js ++++ UploadsRouter.js +@@ -1,13 +1,3 @@ +-/* eslint-disable +- no-unused-vars, +-*/ +-// TODO: This file was created by bulk-decaffeinate. +-// Fix any style issues and re-enable lint. +-/* +- * decaffeinate suggestions: +- * DS102: Remove unnecessary code created because of implicit returns +- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md +- */ + const AuthorizationMiddleware = require('../Authorization/AuthorizationMiddleware') + const AuthenticationController = require('../Authentication/AuthenticationController') + const ProjectUploadController = require('./ProjectUploadController') +@@ -28,18 +18,30 @@ module.exports = { + ProjectUploadController.uploadProject + ) + +- return webRouter.post( +- '/Project/:Project_id/upload', +- RateLimiterMiddleware.rateLimit({ +- endpointName: 'file-upload', +- params: ['Project_id'], +- maxRequests: 200, +- timeInterval: 60 * 30 +- }), +- AuthenticationController.requireLogin(), +- AuthorizationMiddleware.ensureUserCanWriteProjectContent, +- ProjectUploadController.multerMiddleware, +- ProjectUploadController.uploadFile +- ) ++ const fileUploadEndpoint = '/Project/:Project_id/upload' ++ const fileUploadRateLimit = RateLimiterMiddleware.rateLimit({ ++ endpointName: 'file-upload', ++ params: ['Project_id'], ++ maxRequests: 200, ++ timeInterval: 60 * 30 ++ }) ++ if (Settings.allowAnonymousReadAndWriteSharing) { ++ webRouter.post( ++ fileUploadEndpoint, ++ fileUploadRateLimit, ++ AuthorizationMiddleware.ensureUserCanWriteProjectContent, ++ ProjectUploadController.multerMiddleware, ++ ProjectUploadController.uploadFile ++ ) ++ } else { ++ webRouter.post( ++ fileUploadEndpoint, ++ fileUploadRateLimit, ++ AuthenticationController.requireLogin(), ++ AuthorizationMiddleware.ensureUserCanWriteProjectContent, ++ ProjectUploadController.multerMiddleware, ++ ProjectUploadController.uploadFile ++ ) ++ } + } + } diff --git a/server-ce/hotfix/2.0.2/2-read-only-access.patch b/server-ce/hotfix/2.0.2/2-read-only-access.patch new file mode 100644 index 0000000000..246cc3e04d --- /dev/null +++ b/server-ce/hotfix/2.0.2/2-read-only-access.patch @@ -0,0 +1,11 @@ +--- TokenAccessHandler.js ++++ TokenAccessHandler.js +@@ -255,7 +255,7 @@ const TokenAccessHandler = { + + getV1DocPublishedInfo(token, callback) { + // default to allowing access +- if (!Settings.apis || !Settings.apis.v1) { ++ if (!Settings.apis.v1 || !Settings.apis.v1.url) { + return callback(null, { allow: true }) + } + V1Api.request( diff --git a/server-ce/hotfix/2.0.2/3-url-linking-1.patch b/server-ce/hotfix/2.0.2/3-url-linking-1.patch new file mode 100644 index 0000000000..173809842f --- /dev/null +++ b/server-ce/hotfix/2.0.2/3-url-linking-1.patch @@ -0,0 +1,11 @@ +--- Features.js ++++ Features.js +@@ -53,6 +53,8 @@ module.exports = Features = { + return Settings.apis.references.url != null + case 'saml': + return Settings.enableSaml ++ case 'link-url': ++ return Settings.apis.linkedUrlProxy && Settings.apis.linkedUrlProxy.url + default: + throw new Error(`unknown feature: ${feature}`) + } diff --git a/server-ce/hotfix/2.0.2/4-url-linking-2.patch b/server-ce/hotfix/2.0.2/4-url-linking-2.patch new file mode 100644 index 0000000000..587a8e6e0f --- /dev/null +++ b/server-ce/hotfix/2.0.2/4-url-linking-2.patch @@ -0,0 +1,20 @@ +--- new-file-modal.pug ++++ new-file-modal.pug +@@ -21,11 +21,12 @@ script(type='text/ng-template', id='newFileModalTemplate') + i.fa.fa-fw.fa-folder-open + | + | From Another Project +- li(ng-class="type == 'url' ? 'active' : null") +- a(href, ng-click="type = 'url'") +- i.fa.fa-fw.fa-globe +- | +- | From External URL ++ if hasFeature('link-url') ++ li(ng-class="type == 'url' ? 'active' : null") ++ a(href, ng-click="type = 'url'") ++ i.fa.fa-fw.fa-globe ++ | ++ | From External URL + != moduleIncludes("newFileModal:selector", locals) + + td(class="modal-new-file--body modal-new-file--body-{{type}}") diff --git a/server-ce/hotfix/2.0.2/5-disable-analytics-1.patch b/server-ce/hotfix/2.0.2/5-disable-analytics-1.patch new file mode 100644 index 0000000000..198ee03935 --- /dev/null +++ b/server-ce/hotfix/2.0.2/5-disable-analytics-1.patch @@ -0,0 +1,26 @@ +--- AnalyticsController.js ++++ AnalyticsController.js +@@ -3,9 +3,13 @@ const Errors = require('../Errors/Errors') + const AuthenticationController = require('../Authentication/AuthenticationController') + const InstitutionsAPI = require('../Institutions/InstitutionsAPI') + const GeoIpLookup = require('../../infrastructure/GeoIpLookup') ++const Features = require('../../infrastructure/Features') + + module.exports = { + updateEditingSession(req, res, next) { ++ if (!Features.hasFeature('analytics')) { ++ return res.send(204) ++ } + const userId = AuthenticationController.getLoggedInUserId(req) + const { projectId } = req.params + let countryCode = null +@@ -28,6 +32,9 @@ module.exports = { + }, + + recordEvent(req, res, next) { ++ if (!Features.hasFeature('analytics')) { ++ return res.send(204) ++ } + const userId = + AuthenticationController.getLoggedInUserId(req) || req.sessionID + AnalyticsManager.recordEvent(userId, req.params.event, req.body, error => diff --git a/server-ce/hotfix/2.0.2/6-disable-analytics-2.patch b/server-ce/hotfix/2.0.2/6-disable-analytics-2.patch new file mode 100644 index 0000000000..9fb41c1cba --- /dev/null +++ b/server-ce/hotfix/2.0.2/6-disable-analytics-2.patch @@ -0,0 +1,10 @@ +--- Features.js ++++ Features.js +@@ -41,6 +41,7 @@ module.exports = Features = { + case 'templates-server-pro': + return Settings.overleaf == null + case 'affiliations': ++ case 'analytics': + // Checking both properties is needed for the time being to allow + // enabling the feature in web-api and disabling in Server Pro + // see https://github.com/overleaf/web-internal/pull/2127 diff --git a/server-ce/hotfix/2.0.2/Dockerfile b/server-ce/hotfix/2.0.2/Dockerfile new file mode 100644 index 0000000000..7a75ed97a5 --- /dev/null +++ b/server-ce/hotfix/2.0.2/Dockerfile @@ -0,0 +1,31 @@ +FROM sharelatex/sharelatex:2.0.1 + + +# Patch 1: Fixes anonymous link sharing +ADD 1-anon-upload.patch /var/www/sharelatex/web/app/src/Features/Uploads/1-anon-upload.patch +RUN cd /var/www/sharelatex/web/app/src/Features/Uploads/ && \ + patch < 1-anon-upload.patch + + +# Patch 2: Fixes read-only access +ADD 2-read-only-access.patch /var/www/sharelatex/web/app/src/Features/TokenAccess/3-read-only-access.patch +RUN cd /var/www/sharelatex/web/app/src/Features/TokenAccess/ && \ + patch < 3-read-only-access.patch + + +# Patch 3: Fixes url linking +ADD 3-url-linking-1.patch /var/www/sharelatex/web/app/src/infrastructure/6-url-linking-1.patch +RUN cd /var/www/sharelatex/web/app/src/infrastructure/ && \ + patch < 6-url-linking-1.patch +ADD 4-url-linking-2.patch /var/www/sharelatex/web/app/views/project/editor/7-url-linking-2.patch +RUN cd /var/www/sharelatex/web/app/views/project/editor/ && \ + patch < 7-url-linking-2.patch + + +# Patch 4: Disables analytics +ADD 5-disable-analytics-1.patch /var/www/sharelatex/web/app/src/Features/Analytics/8-disable-analytics-1.patch +RUN cd /var/www/sharelatex/web/app/src/Features/Analytics/ && \ + patch < 8-disable-analytics-1.patch +ADD 6-disable-analytics-2.patch /var/www/sharelatex/web/app/src/infrastructure/9-disable-analytics-2.patch +RUN cd /var/www/sharelatex/web/app/src/infrastructure/ && \ + patch < 9-disable-analytics-2.patch From 4a424096f231bc7ee4234fcf9c640854472fa55c Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 9 Jan 2020 15:55:57 +0100 Subject: [PATCH 167/182] Added environment variables for web-api user/pass (#131) --- server-ce/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index d3a6e69e29..3fcfb509f6 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -81,6 +81,15 @@ COPY ${baseDir}/init_scripts/ /etc/my_init.d/ RUN cd /var/www && node git-revision > revisions.txt +# Set Environment Variables +# -------------------------------- +ENV WEB_API_USER "sharelatex" +# password is regenerated in init_scripts/00_regen_sharelatex_secrets.sh +ENV WEB_API_PASSWORD "password" + +ENV SHARELATEX_APP_NAME "Overleaf Community Edition" + + EXPOSE 80 WORKDIR / From 2bc1dc464bfb497e570dbd616d849d7f6cb0c14f Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 21 Jan 2020 12:37:40 +0100 Subject: [PATCH 168/182] Added missing recaptcha configuration (#132) --- server-ce/hotfix/2.1.1/Dockerfile | 8 ++++++++ server-ce/hotfix/2.1.1/add-recaptcha-config.patch | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 server-ce/hotfix/2.1.1/Dockerfile create mode 100644 server-ce/hotfix/2.1.1/add-recaptcha-config.patch diff --git a/server-ce/hotfix/2.1.1/Dockerfile b/server-ce/hotfix/2.1.1/Dockerfile new file mode 100644 index 0000000000..313c596545 --- /dev/null +++ b/server-ce/hotfix/2.1.1/Dockerfile @@ -0,0 +1,8 @@ +FROM sharelatex/sharelatex:2.1.0 + +# Patch: defines recaptcha config to fix share-related issues +# - https://github.com/overleaf/overleaf/issues/684 +ADD add-recaptcha-config.patch /etc/sharelatex/add-recaptcha-config.patch +RUN cd /etc/sharelatex/ && \ + patch < add-recaptcha-config.patch + diff --git a/server-ce/hotfix/2.1.1/add-recaptcha-config.patch b/server-ce/hotfix/2.1.1/add-recaptcha-config.patch new file mode 100644 index 0000000000..cdca537c46 --- /dev/null +++ b/server-ce/hotfix/2.1.1/add-recaptcha-config.patch @@ -0,0 +1,14 @@ +--- a/settings.coffee ++++ b/settings.coffee +@@ -180,6 +180,11 @@ settings = + # cookie with a secure flag (recommended). + secureCookie: process.env["SHARELATEX_SECURE_COOKIE"]? + ++ recaptcha: ++ disabled: ++ invite: true ++ register: true ++ + # If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc) + # then set this to true to allow it to correctly detect the forwarded IP + # address and http/https protocol information. From 3783f03a837fce0baa9f5c36bc2712716cf67f95 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 22 Jan 2020 17:40:47 +0100 Subject: [PATCH 169/182] [misc] export all git repository revisions There is a multi purpose shell script for the gathering of git revisions now. It will extract all revisions that can be found in traversing of the current working directory. This effectively includes the overleaf/overleaf repo and any others that may be added downstream. --- server-ce/Dockerfile | 4 ++-- server-ce/git-revision.js | 22 ---------------------- server-ce/git-revision.sh | 6 ++++++ 3 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 server-ce/git-revision.js create mode 100755 server-ce/git-revision.sh diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 3fcfb509f6..db3c98a793 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -22,7 +22,7 @@ RUN git clone https://github.com/overleaf/overleaf.git \ # 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 +ADD ${baseDir}/git-revision.sh /var/www/git-revision.sh RUN cd /var/www && npm install @@ -78,7 +78,7 @@ COPY ${baseDir}/init_scripts/ /etc/my_init.d/ # Stores the version installed for each service # --------------------------------------------- -RUN cd /var/www && node git-revision > revisions.txt +RUN cd /var/www && ./git-revision.sh > revisions.txt # Set Environment Variables diff --git a/server-ce/git-revision.js b/server-ce/git-revision.js deleted file mode 100644 index 89359cea2e..0000000000 --- a/server-ce/git-revision.js +++ /dev/null @@ -1,22 +0,0 @@ -var simple = require('simple-git'); -var services = require('./sharelatex/config/services'); -const fs = require('fs'); - -function print_latest(repoDir) { - git = simple(repoDir); - opt = []; - opt['max-count'] = 1; - git.log(opt, function(err, log) { - if (!err) { - console.log(repoDir + ',' + log.latest.hash); - } - }) -} - -for (id in services) { - service = services[id]; - dirPath = __dirname + '/sharelatex/'+service.name; - if (fs.existsSync(dirPath)) { - print_latest(dirPath); - } -} diff --git a/server-ce/git-revision.sh b/server-ce/git-revision.sh new file mode 100755 index 0000000000..e26f75bfd4 --- /dev/null +++ b/server-ce/git-revision.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +for gitDir in $(find "$PWD" -name .git); do + echo -n "$(dirname ${gitDir})," + git --git-dir="$gitDir" rev-parse HEAD +done From 6a5f1588cc4e0ba811d5563a120424159682857b Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 28 Jan 2020 07:16:23 +0100 Subject: [PATCH 170/182] Set CRYPTO_RANDOM as environment variable at startup time (#134) --- server-ce/Dockerfile | 2 -- .../00_regen_sharelatex_secrets.sh | 22 ++++++++++++++----- server-ce/settings.coffee | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index db3c98a793..48c14a26ff 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -84,8 +84,6 @@ RUN cd /var/www && ./git-revision.sh > revisions.txt # Set Environment Variables # -------------------------------- ENV WEB_API_USER "sharelatex" -# password is regenerated in init_scripts/00_regen_sharelatex_secrets.sh -ENV WEB_API_PASSWORD "password" ENV SHARELATEX_APP_NAME "Overleaf Community Edition" diff --git a/server-ce/init_scripts/00_regen_sharelatex_secrets.sh b/server-ce/init_scripts/00_regen_sharelatex_secrets.sh index 80fd293260..695ca66f78 100755 --- a/server-ce/init_scripts/00_regen_sharelatex_secrets.sh +++ b/server-ce/init_scripts/00_regen_sharelatex_secrets.sh @@ -1,7 +1,19 @@ #!/bin/sh -# Create random secret keys (twice, once for http auth pass, once for cookie secret). -CRYPTO_RANDOM=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') -sed -i "0,/CRYPTO_RANDOM/s/CRYPTO_RANDOM/$CRYPTO_RANDOM/" /etc/sharelatex/settings.coffee -CRYPTO_RANDOM=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') -sed -i "0,/CRYPTO_RANDOM/s/CRYPTO_RANDOM/$CRYPTO_RANDOM/" /etc/sharelatex/settings.coffee +# generate secrets and defines them as environment variables +# https://github.com/phusion/baseimage-docker#centrally-defining-your-own-environment-variables + +WEB_API_PASSWORD_FILE=/etc/container_environment/WEB_API_PASSWORD +CRYPTO_RANDOM_FILE=/etc/container_environment/CRYPTO_RANDOM + +if [ ! -f "$WEB_API_PASSWORD_FILE" ] || [ ! -f "$CRYPTO_RANDOM_FILE" ]; then + + echo "generating random secrets" + + SECRET=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') + echo ${SECRET} > ${WEB_API_PASSWORD_FILE} + + SECRET=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/') + echo ${SECRET} > ${CRYPTO_RANDOM_FILE} +fi + diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 922fb32c04..32e2b3ba81 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -3,7 +3,7 @@ Path = require('path') # These credentials are used for authenticating api requests # between services that may need to go over public channels httpAuthUser = "sharelatex" -httpAuthPass = "CRYPTO_RANDOM" # Randomly generated for you +httpAuthPass = process.env["WEB_API_PASSWORD"] httpAuthUsers = {} httpAuthUsers[httpAuthUser] = httpAuthPass @@ -162,7 +162,7 @@ settings = # If provided, a sessionSecret is used to sign cookies so that they cannot be # spoofed. This is recommended. security: - sessionSecret: process.env["SHARELATEX_SESSION_SECRET"] or "CRYPTO_RANDOM" # This was randomly generated for you + sessionSecret: process.env["SHARELATEX_SESSION_SECRET"] or process.env["CRYPTO_RANDOM"] # These credentials are used for authenticating api requests # between services that may need to go over public channels From 16ca8f25c45f1c5f6f2241c2f47c15356f4e8f2c Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 29 Jan 2020 12:14:32 +0100 Subject: [PATCH 171/182] [misc] narrow down the rw accessible directories for the run user (#119) --- server-ce/Dockerfile | 7 +------ server-ce/init_scripts/00_make_sharelatex_data_dirs.sh | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 48c14a26ff..f00b6da4d1 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -26,7 +26,7 @@ ADD ${baseDir}/git-revision.sh /var/www/git-revision.sh RUN cd /var/www && npm install -# Replace overleaf/config/services.js with the list of available +# 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 @@ -49,11 +49,6 @@ RUN bash -c 'cd /var/www/sharelatex && source ./bin/compile-services' RUN ln -s /var/www/sharelatex/clsi/bin/synctex /opt/synctex -# 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 diff --git a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh index 7857b984fb..6085a087da 100755 --- a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh @@ -26,8 +26,6 @@ chown www-data:www-data /var/lib/sharelatex/tmp/uploads mkdir -p /var/lib/sharelatex/tmp/dumpFolder chown www-data:www-data /var/lib/sharelatex/tmp/dumpFolder -chown www-data:www-data /var/www/ - if [ ! -e "/var/lib/sharelatex/data/db.sqlite" ]; then touch /var/lib/sharelatex/data/db.sqlite fi From 45561cde0e8ac83910af64f6ee0868f6800ad1b3 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 6 Feb 2020 11:19:15 +0100 Subject: [PATCH 172/182] Removed node6 and updated modules to Node 10 (#135) --- server-ce/Dockerfile-base | 9 --------- server-ce/runit/filestore-sharelatex/run | 2 +- server-ce/runit/real-time-sharelatex/run | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index 2cff8a830f..14b9550ed1 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -28,15 +28,6 @@ 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 && \ diff --git a/server-ce/runit/filestore-sharelatex/run b/server-ce/runit/filestore-sharelatex/run index 1ba126dda0..4237a38793 100755 --- a/server-ce/runit/filestore-sharelatex/run +++ b/server-ce/runit/filestore-sharelatex/run @@ -1,3 +1,3 @@ #!/bin/bash export SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee -exec /sbin/setuser www-data /usr/bin/node6 /var/www/sharelatex/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1 +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/filestore/app.js >> /var/log/sharelatex/filestore.log 2>&1 diff --git a/server-ce/runit/real-time-sharelatex/run b/server-ce/runit/real-time-sharelatex/run index 1d00837def..ad005b624c 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/node6 /var/www/sharelatex/real-time/app.js >> /var/log/sharelatex/real-time.log 2>&1 +exec /sbin/setuser www-data /usr/bin/node /var/www/sharelatex/real-time/app.js >> /var/log/sharelatex/real-time.log 2>&1 From 6f46b2c1450f7bf3e4313d1058c8cd301468eea7 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 11:56:03 +0100 Subject: [PATCH 173/182] [settings] produce a consistent redis config for every service (#124) Signed-off-by: Jakob Ackermann --- server-ce/settings.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server-ce/settings.coffee b/server-ce/settings.coffee index 32e2b3ba81..9d6b31206c 100644 --- a/server-ce/settings.coffee +++ b/server-ce/settings.coffee @@ -81,6 +81,9 @@ settings = lock: redisConfig history: redisConfig websessions: redisConfig + api: redisConfig + pubsub: redisConfig + project_history: redisConfig # The compile server (the clsi) uses a SQL database to cache files and # meta-data. sqllite is the default, and the load is low enough that this will From 991cb29d0b0b8f4ba62ca3db8bca5f6450272c6c Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 11:59:20 +0100 Subject: [PATCH 174/182] [nginx] simplify the root specification for sendfile (#121) Signed-off-by: Jakob Ackermann --- server-ce/nginx/sharelatex.conf | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/server-ce/nginx/sharelatex.conf b/server-ce/nginx/sharelatex.conf index cf63f4c5c4..3a10a999f0 100644 --- a/server-ce/nginx/sharelatex.conf +++ b/server-ce/nginx/sharelatex.conf @@ -2,7 +2,7 @@ server { listen 80; server_name _; # Catch all, see http://nginx.org/en/docs/http/server_names.html - set $static_path /var/www/sharelatex/web/public; + root /var/www/sharelatex/web/public/; location / { proxy_pass http://127.0.0.1:3000; @@ -14,7 +14,7 @@ server { proxy_read_timeout 3m; proxy_send_timeout 3m; } - + location /socket.io { proxy_pass http://127.0.0.1:3026; proxy_http_version 1.1; @@ -29,16 +29,13 @@ server { location /stylesheets { expires 1y; - root $static_path/; } location /minjs { expires 1y; - root $static_path/; } location /img { expires 1y; - root $static_path/; } } From ac82600b74ff181c6a9f8948c9b561be23311d53 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 12:00:03 +0100 Subject: [PATCH 175/182] [misc] minimize base image (#120) * [docker] drop sudo Signed-off-by: Jakob Ackermann * [docker] install qpdf in a single stage Signed-off-by: Jakob Ackermann * [docker] install texlive and additional tlmgr packages in a single stage Signed-off-by: Jakob Ackermann * [docker] drop the apt package lists Signed-off-by: Jakob Ackermann * [docker] pull the package lists only once move the installation of nodejs into the dependencies install section Signed-off-by: Jakob Ackermann * [docker] delete the default nginx configuration files immediately Signed-off-by: Jakob Ackermann * [docker] skip the downloading and storage of unused texlive artifacts Signed-off-by: Jakob Ackermann * [docker] drop the npm download cache Signed-off-by: Jakob Ackermann * [docker] apply review feedback - install qpdf as ubuntu package - add a comment on the nginx config removal - add back and update a note on changing the texlive mirror --- server-ce/Dockerfile | 1 - server-ce/Dockerfile-base | 78 ++++++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index f00b6da4d1..c6e16aec97 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -56,7 +56,6 @@ 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 diff --git a/server-ce/Dockerfile-base b/server-ce/Dockerfile-base index 14b9550ed1..9f1ef5b913 100644 --- a/server-ce/Dockerfile-base +++ b/server-ce/Dockerfile-base @@ -9,47 +9,59 @@ ENV baseDir . # 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 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 +RUN apt-get update \ +&& apt-get install -y \ + build-essential wget net-tools unzip time imagemagick optipng strace nginx git python zlib1g-dev libpcre3-dev \ + qpdf \ + 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 Node.JS 10 +&& curl -sSL https://deb.nodesource.com/setup_10.x | bash - \ +&& apt-get install -y nodejs \ + \ +&& rm -rf \ +# We are adding a custom nginx config in the main Dockerfile. + /etc/nginx/nginx.conf \ + /etc/nginx/sites-enabled/default \ + /var/lib/apt/lists/* - -# Install qpdf +# Install Grunt # ------------ -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 +RUN npm install -g \ + grunt-cli \ +&& rm -rf /root/.npm # Install TexLive # --------------- -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 - # CTAN mirrors occasionally fail, in that case install TexLive against an # specific server, for example http://ctan.crest.fr -# RUN wget http://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 \ -# -repository http://ctan.crest.fr/tex-archive/systems/texlive/tlnet/ +# +# # docker build \ +# --build-arg TEXLIVE_MIRROR=http://ctan.crest.fr/tex-archive/systems/texlive/tlnet \ +# -f Dockerfile-base -t sharelatex/sharelatex-base . +ARG TEXLIVE_MIRROR=http://mirror.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/2019/bin/x86_64-linux/ -RUN tlmgr install latexmk -RUN tlmgr install texcount +ENV PATH "${PATH}:/usr/local/texlive/2019/bin/x86_64-linux" + +RUN mkdir /install-tl-unx \ +&& curl -sSL \ + ${TEXLIVE_MIRROR}/install-tl-unx.tar.gz \ + | tar -xzC /install-tl-unx --strip-components=1 \ + \ +&& echo "tlpdbopt_autobackup 0" >> /install-tl-unx/texlive.profile \ +&& echo "tlpdbopt_install_docfiles 0" >> /install-tl-unx/texlive.profile \ +&& echo "tlpdbopt_install_srcfiles 0" >> /install-tl-unx/texlive.profile \ +&& echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile \ + \ +&& /install-tl-unx/install-tl \ + -profile /install-tl-unx/texlive.profile \ + -repository ${TEXLIVE_MIRROR} \ + \ +&& tlmgr install --repository ${TEXLIVE_MIRROR} \ + latexmk \ + texcount \ + \ +&& rm -rf /install-tl-unx # Set up sharelatex user and home directory From 3170a27fb5872ff303fb88ca35e8c15d53b96c14 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 13:33:56 +0100 Subject: [PATCH 176/182] [init] bail out in case the db access fails (#123) * [init] bail out in case the db access fails Signed-off-by: Jakob Ackermann * [misc] bail out in case any command in an init_script failed NOTE: sh does not support `-o pipefail`. Signed-off-by: Jakob Ackermann --- server-ce/init_scripts/00_make_sharelatex_data_dirs.sh | 2 ++ server-ce/init_scripts/00_regen_sharelatex_secrets.sh | 3 ++- server-ce/init_scripts/00_set_docker_host_ipaddress.sh | 6 ++++-- server-ce/init_scripts/98_check_db_access.sh | 2 ++ server-ce/init_scripts/99_migrate.sh | 2 ++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh index 6085a087da..0d7c643733 100755 --- a/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh @@ -1,4 +1,6 @@ #!/bin/sh +set -e + mkdir -p /var/lib/sharelatex/data chown www-data:www-data /var/lib/sharelatex/data diff --git a/server-ce/init_scripts/00_regen_sharelatex_secrets.sh b/server-ce/init_scripts/00_regen_sharelatex_secrets.sh index 695ca66f78..365be0869f 100755 --- a/server-ce/init_scripts/00_regen_sharelatex_secrets.sh +++ b/server-ce/init_scripts/00_regen_sharelatex_secrets.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash +set -e -o pipefail # generate secrets and defines them as environment variables # https://github.com/phusion/baseimage-docker#centrally-defining-your-own-environment-variables diff --git a/server-ce/init_scripts/00_set_docker_host_ipaddress.sh b/server-ce/init_scripts/00_set_docker_host_ipaddress.sh index afd31b69a1..0587a9b222 100755 --- a/server-ce/init_scripts/00_set_docker_host_ipaddress.sh +++ b/server-ce/init_scripts/00_set_docker_host_ipaddress.sh @@ -1,3 +1,5 @@ -#!/bin/sh +#!/bin/bash +set -e -o pipefail + # See the bottom of http://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach -echo "`route -n | awk '/UG[ \t]/{print $2}'` dockerhost" >> /etc/hosts \ No newline at end of file +echo "`route -n | awk '/UG[ \t]/{print $2}'` dockerhost" >> /etc/hosts diff --git a/server-ce/init_scripts/98_check_db_access.sh b/server-ce/init_scripts/98_check_db_access.sh index a90adba84f..f8507f582f 100755 --- a/server-ce/init_scripts/98_check_db_access.sh +++ b/server-ce/init_scripts/98_check_db_access.sh @@ -1,4 +1,6 @@ #!/bin/sh +set -e + echo "Checking can connect to mongo and redis" cd /var/www/sharelatex && grunt check:redis cd /var/www/sharelatex && grunt check:mongo diff --git a/server-ce/init_scripts/99_migrate.sh b/server-ce/init_scripts/99_migrate.sh index d062496581..f880fa816f 100755 --- a/server-ce/init_scripts/99_migrate.sh +++ b/server-ce/init_scripts/99_migrate.sh @@ -1,4 +1,6 @@ #!/bin/sh +set -e + which node which grunt ls -al /var/www/sharelatex/migrations From b715f16a3b6fa51f82d04b04cbd449d7752f7e4c Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 16:38:58 +0100 Subject: [PATCH 177/182] [misc] minimize the main stage (#122) - cleanup git history - do not install not needed npm packages - The Gruntfile was removed in REF: 27dd97ecc59954a5ad2d8b140f7d5a83073ca2c8 - The simple-git package is not used since REF: df2d46df829872ccd6d9018dac3f2e6d9b9ae8d0 - cleanup npm cache - cleanup node-gyp build cache - cleanup /tmp - move copying of the settings defaults after the installation Signed-off-by: Jakob Ackermann --- server-ce/Dockerfile | 59 +++++++++++++++++++++++------------------- server-ce/package.json | 13 ---------- 2 files changed, 32 insertions(+), 40 deletions(-) delete mode 100644 server-ce/package.json diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index c6e16aec97..3d79194f14 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -4,12 +4,6 @@ FROM sharelatex/sharelatex-base:latest -ENV baseDir . - - -# Install app settings files -# -------------------------- -ADD ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee @@ -19,30 +13,43 @@ RUN git clone https://github.com/overleaf/overleaf.git \ --depth 1 /var/www/sharelatex -# Install dependencies needed to run configuration scripts -# -------------------------------------------------------- -ADD ${baseDir}/package.json /var/www/package.json +# Copy build dependencies +# ----------------------- ADD ${baseDir}/git-revision.sh /var/www/git-revision.sh -RUN cd /var/www && npm install - - -# 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 cd /var/www/sharelatex \ +&& npm install \ +&& grunt install \ + \ +# Cleanup not needed artifacts # ---------------------------- -RUN bash -c 'cd /var/www/sharelatex && source ./bin/install-services' -RUN bash -c 'cd /var/www/sharelatex && source ./bin/compile-services' +&& rm -rf /root/.cache /root/.npm $(find /tmp/ -mindepth 1 -maxdepth 1) \ +# Stores the version installed for each service +# --------------------------------------------- +&& cd /var/www \ +&& ./git-revision.sh > revisions.txt \ + \ +# Cleanup the git history +# ------------------- +&& rm -rf $(find /var/www/sharelatex -name .git) +# Install npm dependencies +# ------------------------ +RUN cd /var/www/sharelatex \ +&& bash ./bin/install-services \ + \ +# Cleanup not needed artifacts +# ---------------------------- +&& rm -rf /root/.cache /root/.npm $(find /tmp/ -mindepth 1 -maxdepth 1) + +# Compile CoffeeScript +# -------------------- +RUN cd /var/www/sharelatex \ +&& bash ./bin/compile-services # Links CLSI sycntex to its default location # ------------------------------------------ @@ -69,11 +76,9 @@ ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex # -------------------------------------------------- COPY ${baseDir}/init_scripts/ /etc/my_init.d/ - -# Stores the version installed for each service -# --------------------------------------------- -RUN cd /var/www && ./git-revision.sh > revisions.txt - +# Copy app settings files +# ----------------------- +COPY ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee # Set Environment Variables # -------------------------------- diff --git a/server-ce/package.json b/server-ce/package.json deleted file mode 100644 index 9a8f125940..0000000000 --- a/server-ce/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "none", - "author": "none", - "description": "none", - "dependencies": { - "grunt": "^0.4.5", - "grunt-contrib-rename": "0.0.3", - "grunt-docker-io": "^0.7.0", - "grunt-github-api": "^0.2.3", - "simple-git": "1.85.0", - "underscore": "^1.8.3" - } -} From 276281e7e43abdf2492e5e176851501300ecb3a5 Mon Sep 17 00:00:00 2001 From: mserranom Date: Mon, 17 Feb 2020 13:56:49 +0100 Subject: [PATCH 178/182] moved files from docker-image imported repo to root --- server-ce/{docker-image => }/.dockerignore | 0 server-ce/{docker-image => }/.editorconfig | 0 server-ce/{docker-image => }/Dockerfile | 0 server-ce/{docker-image => }/Dockerfile-base | 0 server-ce/{docker-image => }/Makefile | 0 server-ce/{docker-image => }/git-revision.sh | 0 server-ce/{docker-image => }/hotfix/2.0.1/Dockerfile | 0 .../hotfix/2.0.1/create_and_destroy_users.patch | 0 .../{docker-image => }/hotfix/2.0.1/disable_project_history.patch | 0 server-ce/{docker-image => }/hotfix/2.0.2/1-anon-upload.patch | 0 .../{docker-image => }/hotfix/2.0.2/2-read-only-access.patch | 0 server-ce/{docker-image => }/hotfix/2.0.2/3-url-linking-1.patch | 0 server-ce/{docker-image => }/hotfix/2.0.2/4-url-linking-2.patch | 0 .../{docker-image => }/hotfix/2.0.2/5-disable-analytics-1.patch | 0 .../{docker-image => }/hotfix/2.0.2/6-disable-analytics-2.patch | 0 server-ce/{docker-image => }/hotfix/2.0.2/Dockerfile | 0 server-ce/{docker-image => }/hotfix/2.1.1/Dockerfile | 0 .../{docker-image => }/hotfix/2.1.1/add-recaptcha-config.patch | 0 .../init_scripts/00_make_sharelatex_data_dirs.sh | 0 .../init_scripts/00_regen_sharelatex_secrets.sh | 0 .../init_scripts/00_set_docker_host_ipaddress.sh | 0 server-ce/{docker-image => }/init_scripts/98_check_db_access.sh | 0 server-ce/{docker-image => }/init_scripts/99_migrate.sh | 0 server-ce/{docker-image => }/logrotate/sharelatex | 0 server-ce/{docker-image => }/nginx/nginx.conf | 0 server-ce/{docker-image => }/nginx/sharelatex.conf | 0 server-ce/{docker-image => }/runit/chat-sharelatex/run | 0 server-ce/{docker-image => }/runit/clsi-sharelatex/run | 0 server-ce/{docker-image => }/runit/contacts-sharelatex/run | 0 server-ce/{docker-image => }/runit/docstore-sharelatex/run | 0 .../{docker-image => }/runit/document-updater-sharelatex/run | 0 server-ce/{docker-image => }/runit/filestore-sharelatex/run | 0 server-ce/{docker-image => }/runit/nginx/run | 0 server-ce/{docker-image => }/runit/notifications-sharelatex/run | 0 server-ce/{docker-image => }/runit/real-time-sharelatex/run | 0 server-ce/{docker-image => }/runit/spelling-sharelatex/run | 0 server-ce/{docker-image => }/runit/tags-sharelatex/run | 0 server-ce/{docker-image => }/runit/track-changes-sharelatex/run | 0 server-ce/{docker-image => }/runit/web-sharelatex/run | 0 server-ce/{docker-image => }/services.js | 0 server-ce/{docker-image => }/settings.coffee | 0 41 files changed, 0 insertions(+), 0 deletions(-) rename server-ce/{docker-image => }/.dockerignore (100%) rename server-ce/{docker-image => }/.editorconfig (100%) rename server-ce/{docker-image => }/Dockerfile (100%) rename server-ce/{docker-image => }/Dockerfile-base (100%) rename server-ce/{docker-image => }/Makefile (100%) rename server-ce/{docker-image => }/git-revision.sh (100%) rename server-ce/{docker-image => }/hotfix/2.0.1/Dockerfile (100%) rename server-ce/{docker-image => }/hotfix/2.0.1/create_and_destroy_users.patch (100%) rename server-ce/{docker-image => }/hotfix/2.0.1/disable_project_history.patch (100%) rename server-ce/{docker-image => }/hotfix/2.0.2/1-anon-upload.patch (100%) rename server-ce/{docker-image => }/hotfix/2.0.2/2-read-only-access.patch (100%) rename server-ce/{docker-image => }/hotfix/2.0.2/3-url-linking-1.patch (100%) rename server-ce/{docker-image => }/hotfix/2.0.2/4-url-linking-2.patch (100%) rename server-ce/{docker-image => }/hotfix/2.0.2/5-disable-analytics-1.patch (100%) rename server-ce/{docker-image => }/hotfix/2.0.2/6-disable-analytics-2.patch (100%) rename server-ce/{docker-image => }/hotfix/2.0.2/Dockerfile (100%) rename server-ce/{docker-image => }/hotfix/2.1.1/Dockerfile (100%) rename server-ce/{docker-image => }/hotfix/2.1.1/add-recaptcha-config.patch (100%) rename server-ce/{docker-image => }/init_scripts/00_make_sharelatex_data_dirs.sh (100%) rename server-ce/{docker-image => }/init_scripts/00_regen_sharelatex_secrets.sh (100%) rename server-ce/{docker-image => }/init_scripts/00_set_docker_host_ipaddress.sh (100%) rename server-ce/{docker-image => }/init_scripts/98_check_db_access.sh (100%) rename server-ce/{docker-image => }/init_scripts/99_migrate.sh (100%) rename server-ce/{docker-image => }/logrotate/sharelatex (100%) rename server-ce/{docker-image => }/nginx/nginx.conf (100%) rename server-ce/{docker-image => }/nginx/sharelatex.conf (100%) rename server-ce/{docker-image => }/runit/chat-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/clsi-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/contacts-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/docstore-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/document-updater-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/filestore-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/nginx/run (100%) rename server-ce/{docker-image => }/runit/notifications-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/real-time-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/spelling-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/tags-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/track-changes-sharelatex/run (100%) rename server-ce/{docker-image => }/runit/web-sharelatex/run (100%) rename server-ce/{docker-image => }/services.js (100%) rename server-ce/{docker-image => }/settings.coffee (100%) diff --git a/server-ce/docker-image/.dockerignore b/server-ce/.dockerignore similarity index 100% rename from server-ce/docker-image/.dockerignore rename to server-ce/.dockerignore diff --git a/server-ce/docker-image/.editorconfig b/server-ce/.editorconfig similarity index 100% rename from server-ce/docker-image/.editorconfig rename to server-ce/.editorconfig diff --git a/server-ce/docker-image/Dockerfile b/server-ce/Dockerfile similarity index 100% rename from server-ce/docker-image/Dockerfile rename to server-ce/Dockerfile diff --git a/server-ce/docker-image/Dockerfile-base b/server-ce/Dockerfile-base similarity index 100% rename from server-ce/docker-image/Dockerfile-base rename to server-ce/Dockerfile-base diff --git a/server-ce/docker-image/Makefile b/server-ce/Makefile similarity index 100% rename from server-ce/docker-image/Makefile rename to server-ce/Makefile diff --git a/server-ce/docker-image/git-revision.sh b/server-ce/git-revision.sh similarity index 100% rename from server-ce/docker-image/git-revision.sh rename to server-ce/git-revision.sh diff --git a/server-ce/docker-image/hotfix/2.0.1/Dockerfile b/server-ce/hotfix/2.0.1/Dockerfile similarity index 100% rename from server-ce/docker-image/hotfix/2.0.1/Dockerfile rename to server-ce/hotfix/2.0.1/Dockerfile diff --git a/server-ce/docker-image/hotfix/2.0.1/create_and_destroy_users.patch b/server-ce/hotfix/2.0.1/create_and_destroy_users.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.0.1/create_and_destroy_users.patch rename to server-ce/hotfix/2.0.1/create_and_destroy_users.patch diff --git a/server-ce/docker-image/hotfix/2.0.1/disable_project_history.patch b/server-ce/hotfix/2.0.1/disable_project_history.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.0.1/disable_project_history.patch rename to server-ce/hotfix/2.0.1/disable_project_history.patch diff --git a/server-ce/docker-image/hotfix/2.0.2/1-anon-upload.patch b/server-ce/hotfix/2.0.2/1-anon-upload.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.0.2/1-anon-upload.patch rename to server-ce/hotfix/2.0.2/1-anon-upload.patch diff --git a/server-ce/docker-image/hotfix/2.0.2/2-read-only-access.patch b/server-ce/hotfix/2.0.2/2-read-only-access.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.0.2/2-read-only-access.patch rename to server-ce/hotfix/2.0.2/2-read-only-access.patch diff --git a/server-ce/docker-image/hotfix/2.0.2/3-url-linking-1.patch b/server-ce/hotfix/2.0.2/3-url-linking-1.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.0.2/3-url-linking-1.patch rename to server-ce/hotfix/2.0.2/3-url-linking-1.patch diff --git a/server-ce/docker-image/hotfix/2.0.2/4-url-linking-2.patch b/server-ce/hotfix/2.0.2/4-url-linking-2.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.0.2/4-url-linking-2.patch rename to server-ce/hotfix/2.0.2/4-url-linking-2.patch diff --git a/server-ce/docker-image/hotfix/2.0.2/5-disable-analytics-1.patch b/server-ce/hotfix/2.0.2/5-disable-analytics-1.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.0.2/5-disable-analytics-1.patch rename to server-ce/hotfix/2.0.2/5-disable-analytics-1.patch diff --git a/server-ce/docker-image/hotfix/2.0.2/6-disable-analytics-2.patch b/server-ce/hotfix/2.0.2/6-disable-analytics-2.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.0.2/6-disable-analytics-2.patch rename to server-ce/hotfix/2.0.2/6-disable-analytics-2.patch diff --git a/server-ce/docker-image/hotfix/2.0.2/Dockerfile b/server-ce/hotfix/2.0.2/Dockerfile similarity index 100% rename from server-ce/docker-image/hotfix/2.0.2/Dockerfile rename to server-ce/hotfix/2.0.2/Dockerfile diff --git a/server-ce/docker-image/hotfix/2.1.1/Dockerfile b/server-ce/hotfix/2.1.1/Dockerfile similarity index 100% rename from server-ce/docker-image/hotfix/2.1.1/Dockerfile rename to server-ce/hotfix/2.1.1/Dockerfile diff --git a/server-ce/docker-image/hotfix/2.1.1/add-recaptcha-config.patch b/server-ce/hotfix/2.1.1/add-recaptcha-config.patch similarity index 100% rename from server-ce/docker-image/hotfix/2.1.1/add-recaptcha-config.patch rename to server-ce/hotfix/2.1.1/add-recaptcha-config.patch diff --git a/server-ce/docker-image/init_scripts/00_make_sharelatex_data_dirs.sh b/server-ce/init_scripts/00_make_sharelatex_data_dirs.sh similarity index 100% rename from server-ce/docker-image/init_scripts/00_make_sharelatex_data_dirs.sh rename to server-ce/init_scripts/00_make_sharelatex_data_dirs.sh diff --git a/server-ce/docker-image/init_scripts/00_regen_sharelatex_secrets.sh b/server-ce/init_scripts/00_regen_sharelatex_secrets.sh similarity index 100% rename from server-ce/docker-image/init_scripts/00_regen_sharelatex_secrets.sh rename to server-ce/init_scripts/00_regen_sharelatex_secrets.sh diff --git a/server-ce/docker-image/init_scripts/00_set_docker_host_ipaddress.sh b/server-ce/init_scripts/00_set_docker_host_ipaddress.sh similarity index 100% rename from server-ce/docker-image/init_scripts/00_set_docker_host_ipaddress.sh rename to server-ce/init_scripts/00_set_docker_host_ipaddress.sh diff --git a/server-ce/docker-image/init_scripts/98_check_db_access.sh b/server-ce/init_scripts/98_check_db_access.sh similarity index 100% rename from server-ce/docker-image/init_scripts/98_check_db_access.sh rename to server-ce/init_scripts/98_check_db_access.sh diff --git a/server-ce/docker-image/init_scripts/99_migrate.sh b/server-ce/init_scripts/99_migrate.sh similarity index 100% rename from server-ce/docker-image/init_scripts/99_migrate.sh rename to server-ce/init_scripts/99_migrate.sh diff --git a/server-ce/docker-image/logrotate/sharelatex b/server-ce/logrotate/sharelatex similarity index 100% rename from server-ce/docker-image/logrotate/sharelatex rename to server-ce/logrotate/sharelatex diff --git a/server-ce/docker-image/nginx/nginx.conf b/server-ce/nginx/nginx.conf similarity index 100% rename from server-ce/docker-image/nginx/nginx.conf rename to server-ce/nginx/nginx.conf diff --git a/server-ce/docker-image/nginx/sharelatex.conf b/server-ce/nginx/sharelatex.conf similarity index 100% rename from server-ce/docker-image/nginx/sharelatex.conf rename to server-ce/nginx/sharelatex.conf diff --git a/server-ce/docker-image/runit/chat-sharelatex/run b/server-ce/runit/chat-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/chat-sharelatex/run rename to server-ce/runit/chat-sharelatex/run diff --git a/server-ce/docker-image/runit/clsi-sharelatex/run b/server-ce/runit/clsi-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/clsi-sharelatex/run rename to server-ce/runit/clsi-sharelatex/run diff --git a/server-ce/docker-image/runit/contacts-sharelatex/run b/server-ce/runit/contacts-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/contacts-sharelatex/run rename to server-ce/runit/contacts-sharelatex/run diff --git a/server-ce/docker-image/runit/docstore-sharelatex/run b/server-ce/runit/docstore-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/docstore-sharelatex/run rename to server-ce/runit/docstore-sharelatex/run diff --git a/server-ce/docker-image/runit/document-updater-sharelatex/run b/server-ce/runit/document-updater-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/document-updater-sharelatex/run rename to server-ce/runit/document-updater-sharelatex/run diff --git a/server-ce/docker-image/runit/filestore-sharelatex/run b/server-ce/runit/filestore-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/filestore-sharelatex/run rename to server-ce/runit/filestore-sharelatex/run diff --git a/server-ce/docker-image/runit/nginx/run b/server-ce/runit/nginx/run similarity index 100% rename from server-ce/docker-image/runit/nginx/run rename to server-ce/runit/nginx/run diff --git a/server-ce/docker-image/runit/notifications-sharelatex/run b/server-ce/runit/notifications-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/notifications-sharelatex/run rename to server-ce/runit/notifications-sharelatex/run diff --git a/server-ce/docker-image/runit/real-time-sharelatex/run b/server-ce/runit/real-time-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/real-time-sharelatex/run rename to server-ce/runit/real-time-sharelatex/run diff --git a/server-ce/docker-image/runit/spelling-sharelatex/run b/server-ce/runit/spelling-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/spelling-sharelatex/run rename to server-ce/runit/spelling-sharelatex/run diff --git a/server-ce/docker-image/runit/tags-sharelatex/run b/server-ce/runit/tags-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/tags-sharelatex/run rename to server-ce/runit/tags-sharelatex/run diff --git a/server-ce/docker-image/runit/track-changes-sharelatex/run b/server-ce/runit/track-changes-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/track-changes-sharelatex/run rename to server-ce/runit/track-changes-sharelatex/run diff --git a/server-ce/docker-image/runit/web-sharelatex/run b/server-ce/runit/web-sharelatex/run similarity index 100% rename from server-ce/docker-image/runit/web-sharelatex/run rename to server-ce/runit/web-sharelatex/run diff --git a/server-ce/docker-image/services.js b/server-ce/services.js similarity index 100% rename from server-ce/docker-image/services.js rename to server-ce/services.js diff --git a/server-ce/docker-image/settings.coffee b/server-ce/settings.coffee similarity index 100% rename from server-ce/docker-image/settings.coffee rename to server-ce/settings.coffee From c3d0ba2aa6dcfbd266a7d35b174f15ce8a402b6b Mon Sep 17 00:00:00 2001 From: mserranom Date: Mon, 17 Feb 2020 13:57:53 +0100 Subject: [PATCH 179/182] merged README.md --- server-ce/README.md | 26 +++++++++++++++++-- server-ce/docker-image/README.md | 43 -------------------------------- 2 files changed, 24 insertions(+), 45 deletions(-) delete mode 100644 server-ce/docker-image/README.md diff --git a/server-ce/README.md b/server-ce/README.md index 776088abe4..8b1463d23c 100644 --- a/server-ce/README.md +++ b/server-ce/README.md @@ -8,9 +8,9 @@

Key FeaturesWiki • - Server Pro • + Server ProContributing • - Mailing List • + Mailing ListAuthorsLicense

@@ -54,6 +54,28 @@ This repository does not contain any code. It acts a wrapper and toolkit for man | **[tags](https://github.com/overleaf/tags)** | The backend API for managing project tags (folders). | | **[spelling](https://github.com/overleaf/spelling)** | An API for running server-side spelling checking on Overleaf documents. | +## Overleaf Docker Image + +This repo contains two dockerfiles, `Dockerfile-base`, which builds the +`sharelatex/sharelatex-base` image, and `Dockerfile` which builds the +`sharelatex/sharelatex` (or "community") image. + +The Base image generally contains the basic dependencies like `wget` and +`aspell`, plus `texlive`. We split this out because it's a pretty heavy set of +dependencies, and it's nice to not have to rebuild all of that every time. + +The `sharelatex/sharelatex` image extends the base image and adds the actual Overleaf code +and services. + +Use `make build-base` and `make build-community` to build these images. + +We use the [Phusion base-image](https://github.com/phusion/baseimage-docker) +(which is extended by our `base` image) to provide us with a VM-like container +in which to run the Overleaf services. Baseimage uses the `runit` service +manager to manage services, and we add our init-scripts from the `./runit` +folder. + + ## Contributing Please see the [CONTRIBUTING](https://github.com/overleaf/overleaf/blob/master/CONTRIBUTING.md) file for information on contributing to the development of Overleaf. See [our wiki](https://github.com/overleaf/overleaf/wiki/Developer-Guidelines) for information on setting up a development environment and how to recompile and run Overleaf after modifications. diff --git a/server-ce/docker-image/README.md b/server-ce/docker-image/README.md deleted file mode 100644 index c1894afce0..0000000000 --- a/server-ce/docker-image/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Overleaf Docker Image - -This is the source for building the Overleaf community-edition docker image. - - -## End-User Install -Please see the [offical wiki for install -guides](https://github.com/overleaf/overleaf/wiki) - - -## Development - -This repo contains two dockerfiles, `Dockerfile-base`, which builds the -`sharelatex/sharelatex-base` image, and `Dockerfile` which builds the -`sharelatex/sharelatex` (or "community") image. - -The Base image generally contains the basic dependencies like `wget` and -`aspell`, plus `texlive`. We split this out because it's a pretty heavy set of -dependencies, and it's nice to not have to rebuild all of that every time. - -The `sharelatex/sharelatex` image extends the base image and adds the actual Overleaf code -and services. - -Use `make build-base` and `make build-community` to build these images. - - -### How the Overleaf code gets here - -This repo uses [the public Overleaf -repository](https://github.com/overleaf/overleaf), which used to be the main -public source for the Overleaf system. - -That repo is cloned down into the docker image, and a script then installs all -the services. - - -### How services run inside the container - -We use the [Phusion base-image](https://github.com/phusion/baseimage-docker) -(which is extended by our `base` image) to provide us with a VM-like container -in which to run the Overleaf services. Baseimage uses the `runit` service -manager to manage services, and we add our init-scripts from the `./runit` -folder. From 1fe5394ca5cb0146a8ae2b76fd020fc0faa9fc7f Mon Sep 17 00:00:00 2001 From: mserranom Date: Mon, 17 Feb 2020 13:58:48 +0100 Subject: [PATCH 180/182] merged .gitignore --- server-ce/.gitignore | 7 +++++-- server-ce/docker-image/.gitignore | 4 ---- 2 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 server-ce/docker-image/.gitignore diff --git a/server-ce/.gitignore b/server-ce/.gitignore index abf5d3ff2f..008b9d7cae 100644 --- a/server-ce/.gitignore +++ b/server-ce/.gitignore @@ -1,6 +1,9 @@ /config config-local -node_modules + +node_modules/ +api-data +versions/ web document-updater @@ -20,4 +23,4 @@ tmp db.sqlite .DS_Store -.vagrant +.vagrant \ No newline at end of file diff --git a/server-ce/docker-image/.gitignore b/server-ce/docker-image/.gitignore deleted file mode 100644 index 877b99b865..0000000000 --- a/server-ce/docker-image/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -node_modules/ -api-data -versions/ From ead0f219652567f746960c285c56331218e9c268 Mon Sep 17 00:00:00 2001 From: mserranom Date: Mon, 17 Feb 2020 14:00:29 +0100 Subject: [PATCH 181/182] merged services.js --- server-ce/config/services.js | 52 ------------------------------------ server-ce/services.js | 10 +++---- 2 files changed, 5 insertions(+), 57 deletions(-) delete mode 100644 server-ce/config/services.js diff --git a/server-ce/config/services.js b/server-ce/config/services.js deleted file mode 100644 index 2072964383..0000000000 --- a/server-ce/config/services.js +++ /dev/null @@ -1,52 +0,0 @@ -module.exports = - -[{ - name: "web", - repo: "https://github.com/sharelatex/web-sharelatex.git", - version: "master" -}, { - name: "real-time", - repo: "https://github.com/sharelatex/real-time-sharelatex.git", - version: "master" -}, { - name: "document-updater", - repo: "https://github.com/sharelatex/document-updater-sharelatex.git", - version: "master" -}, { - name: "clsi", - repo: "https://github.com/sharelatex/clsi-sharelatex.git", - version: "master" -}, { - name: "filestore", - repo: "https://github.com/sharelatex/filestore-sharelatex.git", - version: "master" -}, { - name: "track-changes", - repo: "https://github.com/sharelatex/track-changes-sharelatex.git", - version: "master" -}, { - name: "docstore", - repo: "https://github.com/sharelatex/docstore-sharelatex.git", - version: "master" -}, { - name: "chat", - repo: "https://github.com/sharelatex/chat-sharelatex.git", - version: "master" -}, { - name: "tags", - repo: "https://github.com/sharelatex/tags-sharelatex.git", - version: "master" -}, { - name: "spelling", - repo: "https://github.com/sharelatex/spelling-sharelatex.git", - version: "master" -}, { - name: "contacts", - repo: "https://github.com/sharelatex/contacts-sharelatex.git", - version: "master" -}, { - name: "notifications", - repo: "https://github.com/sharelatex/notifications-sharelatex.git", - version: "master" -} -] diff --git a/server-ce/services.js b/server-ce/services.js index 941dd23a0e..654148bc52 100644 --- a/server-ce/services.js +++ b/server-ce/services.js @@ -1,4 +1,4 @@ -module.exports = +module.exports = [{ name: "web", @@ -43,9 +43,9 @@ module.exports = }, { name: "contacts", repo: "https://github.com/sharelatex/contacts-sharelatex.git", - version: "sk-update-mongojs" + version: "master" }, { - name: "notifications", - repo: "https://github.com/sharelatex/notifications-sharelatex.git", - version: "master" + name: "notifications", + repo: "https://github.com/sharelatex/notifications-sharelatex.git", + version: "master" }] From fa13f4f079e60440d303426dae729dc1eaf1cb7c Mon Sep 17 00:00:00 2001 From: mserranom Date: Mon, 17 Feb 2020 14:58:47 +0100 Subject: [PATCH 182/182] Updated dockerfile and build script with monorepo changes --- server-ce/Dockerfile | 14 ++++++++++---- server-ce/bin/compile-services | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index 3d79194f14..c4478b6b29 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -7,10 +7,16 @@ FROM sharelatex/sharelatex-base:latest ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee -# Checkout Overleaf Community Edition repo -# ---------------------------------------- -RUN git clone https://github.com/overleaf/overleaf.git \ - --depth 1 /var/www/sharelatex +# Add required source files +# ------------------------- +ADD ${baseDir}/bin /var/www/sharelatex/bin +ADD ${baseDir}/doc /var/www/sharelatex/doc +ADD ${baseDir}/migrations /var/www/sharelatex/migrations +ADD ${baseDir}/tasks /var/www/sharelatex/tasks +ADD ${baseDir}/Gruntfile.coffee /var/www/sharelatex/Gruntfile.coffee +ADD ${baseDir}/package.json /var/www/sharelatex/package.json +ADD ${baseDir}/npm-shrinkwrap.json /var/www/sharelatex/npm-shrinkwrap.json +ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js # Copy build dependencies diff --git a/server-ce/bin/compile-services b/server-ce/bin/compile-services index fc3bb8ea38..017baa8fbc 100755 --- a/server-ce/bin/compile-services +++ b/server-ce/bin/compile-services @@ -12,7 +12,7 @@ grep 'name:' config/services.js | \ web) npm run webpack:production ;; - chat|filestore|notifications) + chat|filestore|notifications|tags) echo "$service doesn't require a compilation" ;; *)