From c15caa4698c965efec711cb15cbcdd17abb93716 Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 6 Feb 2015 17:01:50 +0000 Subject: [PATCH 001/177] Initial Dockerfile image build --- 00_make_sharelatex_data_dirs.sh | 21 ++ 00_regen_sharelatex_secrets.sh | 7 + Dockerfile | 81 +++++ README.md | 70 +++++ nginx/nginx.conf | 74 +++++ nginx/sharelatex.conf | 45 +++ runit/chat-sharelatex.sh | 3 + runit/clsi-sharelatex.sh | 3 + runit/docstore-sharelatex.sh | 3 + runit/document-updater-sharelatex.sh | 3 + runit/filestore-sharelatex.sh | 3 + runit/nginx.sh | 2 + runit/real-time-sharelatex.sh | 3 + runit/spelling-sharelatex.sh | 3 + runit/tags-sharelatex.sh | 3 + runit/track-changes-sharelatex.sh | 3 + runit/web-sharelatex.sh | 3 + settings.coffee | 422 +++++++++++++++++++++++++++ 18 files changed, 752 insertions(+) create mode 100755 00_make_sharelatex_data_dirs.sh create mode 100755 00_regen_sharelatex_secrets.sh create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 nginx/nginx.conf create mode 100644 nginx/sharelatex.conf create mode 100755 runit/chat-sharelatex.sh create mode 100755 runit/clsi-sharelatex.sh create mode 100755 runit/docstore-sharelatex.sh create mode 100755 runit/document-updater-sharelatex.sh create mode 100755 runit/filestore-sharelatex.sh create mode 100755 runit/nginx.sh create mode 100755 runit/real-time-sharelatex.sh create mode 100755 runit/spelling-sharelatex.sh create mode 100755 runit/tags-sharelatex.sh create mode 100755 runit/track-changes-sharelatex.sh create mode 100755 runit/web-sharelatex.sh create mode 100644 settings.coffee diff --git a/00_make_sharelatex_data_dirs.sh b/00_make_sharelatex_data_dirs.sh new file mode 100755 index 0000000000..f8d424f201 --- /dev/null +++ b/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/00_regen_sharelatex_secrets.sh b/00_regen_sharelatex_secrets.sh new file mode 100755 index 0000000000..80fd293260 --- /dev/null +++ b/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/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..77e6ea1aba --- /dev/null +++ b/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/README.md b/README.md new file mode 100644 index 0000000000..ba4eae9155 --- /dev/null +++ b/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/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000000..03d228c622 --- /dev/null +++ b/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/nginx/sharelatex.conf b/nginx/sharelatex.conf new file mode 100644 index 0000000000..e9d6566ffd --- /dev/null +++ b/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/runit/chat-sharelatex.sh b/runit/chat-sharelatex.sh new file mode 100755 index 0000000000..509ff8588e --- /dev/null +++ b/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/runit/clsi-sharelatex.sh b/runit/clsi-sharelatex.sh new file mode 100755 index 0000000000..59298743c8 --- /dev/null +++ b/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/runit/docstore-sharelatex.sh b/runit/docstore-sharelatex.sh new file mode 100755 index 0000000000..ba7a96c8d7 --- /dev/null +++ b/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/runit/document-updater-sharelatex.sh b/runit/document-updater-sharelatex.sh new file mode 100755 index 0000000000..8f692ecdbe --- /dev/null +++ b/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/runit/filestore-sharelatex.sh b/runit/filestore-sharelatex.sh new file mode 100755 index 0000000000..b02695f747 --- /dev/null +++ b/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/runit/nginx.sh b/runit/nginx.sh new file mode 100755 index 0000000000..9eacfb4ff2 --- /dev/null +++ b/runit/nginx.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec nginx \ No newline at end of file diff --git a/runit/real-time-sharelatex.sh b/runit/real-time-sharelatex.sh new file mode 100755 index 0000000000..19aaed457b --- /dev/null +++ b/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/runit/spelling-sharelatex.sh b/runit/spelling-sharelatex.sh new file mode 100755 index 0000000000..848c6ac7d1 --- /dev/null +++ b/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/runit/tags-sharelatex.sh b/runit/tags-sharelatex.sh new file mode 100755 index 0000000000..8616c1356c --- /dev/null +++ b/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/runit/track-changes-sharelatex.sh b/runit/track-changes-sharelatex.sh new file mode 100755 index 0000000000..347d8f021a --- /dev/null +++ b/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/runit/web-sharelatex.sh b/runit/web-sharelatex.sh new file mode 100755 index 0000000000..b0bda54c81 --- /dev/null +++ b/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/settings.coffee b/settings.coffee new file mode 100644 index 0000000000..d4b6987f85 --- /dev/null +++ b/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 531f9e84ac2995ac9a7808fbf2c3ab7b534b6845 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 9 Feb 2015 16:18:58 +0000 Subject: [PATCH 002/177] Don't rely on --net=host --- Dockerfile | 13 ++++-- README.md | 118 +++++++++++++++++++++++++++++++++++++++++------- settings.coffee | 6 +-- 3 files changed, 114 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 77e6ea1aba..dbf7241c51 100644 --- a/Dockerfile +++ b/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/README.md b/README.md index ba4eae9155..a9a0a729eb 100644 --- a/README.md +++ b/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/settings.coffee b/settings.coffee index d4b6987f85..622529068a 100644 --- a/settings.coffee +++ b/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 d347ee087d9b79f0d3bee329099bfa7faf289d17 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 9 Feb 2015 16:27:44 +0000 Subject: [PATCH 003/177] Add missing file --- 00_set_docker_host_ipaddress.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 00_set_docker_host_ipaddress.sh diff --git a/00_set_docker_host_ipaddress.sh b/00_set_docker_host_ipaddress.sh new file mode 100755 index 0000000000..afd31b69a1 --- /dev/null +++ b/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 c8be8b526c38eb1da9958f325545e662c3d4e11b Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 10 Feb 2015 16:49:34 +0000 Subject: [PATCH 004/177] Update to use release version of ShareLaTeX --- Dockerfile | 16 ++++++++++------ README.md | 34 ++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index dbf7241c51..9d750e5a2e 100644 --- a/Dockerfile +++ b/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/README.md b/README.md index a9a0a729eb..5f1eea71f2 100644 --- a/README.md +++ b/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 e0ce15e10cfb2ebd7df209e60a30fe78c97a1018 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 11 Feb 2015 13:54:03 +0000 Subject: [PATCH 005/177] Update README.md --- README.md | 61 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 5f1eea71f2..820b2ac49f 100644 --- a/README.md +++ b/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 7bcecf38c135115caf8deb6c62ca7b34a11b5976 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 11 Feb 2015 13:56:01 +0000 Subject: [PATCH 006/177] Update README.md --- README.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 820b2ac49f..1b91bf1ff5 100644 --- a/README.md +++ b/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 8b26d251cba33e0090dd22fe31e1edc8396aad20 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 11 Feb 2015 14:34:39 +0000 Subject: [PATCH 007/177] Update README.md --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1b91bf1ff5..011daeb900 100644 --- a/README.md +++ b/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 d64ef2eccdec79c085626fc749aff1e891fe5c63 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 11 Feb 2015 14:34:53 +0000 Subject: [PATCH 008/177] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 011daeb900..73b66ff196 100644 --- a/README.md +++ b/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 edb091bb92f8a4900b086243ad478c230f77e974 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 18 Feb 2015 17:08:41 +0000 Subject: [PATCH 009/177] Install unzip in Docker container --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9d750e5a2e..19d4d82875 100644 --- a/Dockerfile +++ b/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 be1cdc0df1d8ca634e833cd4a437f200f481b12c Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 25 Mar 2015 16:28:06 +0000 Subject: [PATCH 010/177] Update to use latest ShareLaTeX release --- Dockerfile | 9 +++++---- README.md | 16 ++++++++++++++++ settings.coffee | 15 +++++++-------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 19d4d82875..a8d6d9be82 100644 --- a/Dockerfile +++ b/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/README.md b/README.md index 73b66ff196..2ac12723b6 100644 --- a/README.md +++ b/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/settings.coffee b/settings.coffee index 622529068a..440b59f7fb 100644 --- a/settings.coffee +++ b/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 131450452ebcff2ccc4d76e86905840abfa08417 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 17 Sep 2015 14:07:50 +0000 Subject: [PATCH 011/177] added mongodb migrations added imagemagick make sure release is up to date --- 99_migrate.sh | 5 +++++ Dockerfile | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 99_migrate.sh diff --git a/99_migrate.sh b/99_migrate.sh new file mode 100755 index 0000000000..762aae2806 --- /dev/null +++ b/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/Dockerfile b/Dockerfile index a8d6d9be82..ff52a33198 100644 --- a/Dockerfile +++ b/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 42e9208b1461214d5849910ad9020392876b6b35 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 1 Dec 2015 16:17:15 +0000 Subject: [PATCH 012/177] Added tip for copying the database when upgrading --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ac12723b6..405ba6406f 100644 --- a/README.md +++ b/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 1993b4c19e85539ca6b0bbf18f33ff89ed011c8e Mon Sep 17 00:00:00 2001 From: mattcollier Date: Mon, 28 Dec 2015 16:27:46 -0500 Subject: [PATCH 013/177] Correct typo. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 405ba6406f..eac83edd43 100644 --- a/README.md +++ b/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 5c74504ce7757995ed13d20bb7e0c8a4158cfae6 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 13 Jan 2016 15:10:31 +0000 Subject: [PATCH 014/177] set nginx to 50mb limit which is upper side of what ShareLaTeX can handle --- nginx/nginx.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 03d228c622..c4311103b0 100644 --- a/nginx/nginx.conf +++ b/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 c23ea9f1cf4e90eab2eb1ad34385450a47fa109a Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 3 Feb 2016 14:56:11 +0000 Subject: [PATCH 015/177] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eac83edd43..ffda2e1dfb 100644 --- a/README.md +++ b/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 9ed593f22c52b8cf9800c314e8d8f911ed887f1e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 9 Feb 2016 12:57:05 +0000 Subject: [PATCH 016/177] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ffda2e1dfb..93e330a74f 100644 --- a/README.md +++ b/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 08ea79a29f4683b5d42ded60c1b7bd9d1b16e3eb Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 8 Mar 2016 16:05:42 +0000 Subject: [PATCH 017/177] change localhost to 127.0.0.1 which should help with ipv6 --- nginx/sharelatex.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx/sharelatex.conf b/nginx/sharelatex.conf index e9d6566ffd..0111797967 100644 --- a/nginx/sharelatex.conf +++ b/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 09624e37960741da881232b8b3fa7676b4bd4a99 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 6 Apr 2016 15:42:01 +0000 Subject: [PATCH 018/177] add session secret as env varx --- settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 440b59f7fb..e2ee828a79 100644 --- a/settings.coffee +++ b/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 700e37696891dc70103a8040b90fbe92160d5179 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 6 Apr 2016 17:07:59 +0100 Subject: [PATCH 019/177] made email and ldap configurable from env vars --- settings.coffee | 107 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 20 deletions(-) diff --git a/settings.coffee b/settings.coffee index 440b59f7fb..f385becb12 100644 --- a/settings.coffee +++ b/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 7d9de6c216f541691d08c5c0d048370562d02fdf Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 6 Apr 2016 17:10:43 +0100 Subject: [PATCH 020/177] added tls as env vars --- settings.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/settings.coffee b/settings.coffee index f385becb12..165d4c16d0 100644 --- a/settings.coffee +++ b/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 72e6fc60dabd1f1a1b9ef15883ae61af25f391ea Mon Sep 17 00:00:00 2001 From: Vincent von Hof Date: Wed, 20 Apr 2016 12:54:11 +0200 Subject: [PATCH 021/177] Fix a typo in README.md nothing here...moving on --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93e330a74f..af2b50a377 100644 --- a/README.md +++ b/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 d4331f84157846ff5840a116ca2cc20ca581a7c9 Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Wed, 20 Apr 2016 21:55:47 -0300 Subject: [PATCH 022/177] add support for grunt build --- Dockerfile | 11 +++++++++-- Gruntfile.coffee | 38 ++++++++++++++++++++++++++++++++++++++ git-revision.js | 22 ++++++++++++++++++++++ package.json | 11 +++++++++++ services.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 Gruntfile.coffee create mode 100644 git-revision.js create mode 100644 package.json create mode 100644 services.js diff --git a/Dockerfile b/Dockerfile index ff52a33198..7d813bd5d5 100644 --- a/Dockerfile +++ b/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/Gruntfile.coffee b/Gruntfile.coffee new file mode 100644 index 0000000000..0f1d222059 --- /dev/null +++ b/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/git-revision.js b/git-revision.js new file mode 100644 index 0000000000..89359cea2e --- /dev/null +++ b/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/package.json b/package.json new file mode 100644 index 0000000000..329169d96d --- /dev/null +++ b/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/services.js b/services.js new file mode 100644 index 0000000000..be4da8698a --- /dev/null +++ b/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 b43a58467c0c05ad355e140702752dba00d803e8 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 28 Apr 2016 12:01:30 +0100 Subject: [PATCH 023/177] recommend mongodb 3.x --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af2b50a377..e1a0c228b3 100644 --- a/README.md +++ b/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 f33ea044085a799a08d7c803e68861f7eb9fd491 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 20 Apr 2016 21:55:47 -0300 Subject: [PATCH 024/177] add support for grunt build --- Dockerfile | 11 +++++++++-- Gruntfile.coffee | 38 ++++++++++++++++++++++++++++++++++++++ git-revision.js | 22 ++++++++++++++++++++++ package.json | 11 +++++++++++ services.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 Gruntfile.coffee create mode 100644 git-revision.js create mode 100644 package.json create mode 100644 services.js diff --git a/Dockerfile b/Dockerfile index ff52a33198..7d813bd5d5 100644 --- a/Dockerfile +++ b/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/Gruntfile.coffee b/Gruntfile.coffee new file mode 100644 index 0000000000..0f1d222059 --- /dev/null +++ b/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/git-revision.js b/git-revision.js new file mode 100644 index 0000000000..89359cea2e --- /dev/null +++ b/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/package.json b/package.json new file mode 100644 index 0000000000..329169d96d --- /dev/null +++ b/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/services.js b/services.js new file mode 100644 index 0000000000..be4da8698a --- /dev/null +++ b/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 9a5df51ea44fb7222b1a9af75c55c117eeaaed92 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 2 May 2016 23:55:53 +0000 Subject: [PATCH 025/177] add baseDir for Dockerfile --- Dockerfile | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7d813bd5d5..2f9766efaa 100644 --- a/Dockerfile +++ b/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 b4ae96facbfc5884d482695b5bb0f986a5cf594c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 9 May 2016 16:08:51 +0100 Subject: [PATCH 026/177] recommend debian/ubuntu --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e1a0c228b3..5d6956d7f6 100644 --- a/README.md +++ b/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 246496a468abdd3f4056bf8fd88801df71fe45db Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 11:30:25 +0100 Subject: [PATCH 027/177] added docker and and templates options for server pro --- settings.coffee | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/settings.coffee b/settings.coffee index 165d4c16d0..06d34c567a 100644 --- a/settings.coffee +++ b/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 bc5449e18e11e138cebfc41512323d76822a13b4 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 11:37:43 +0100 Subject: [PATCH 028/177] add git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..c2658d7d1b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ From 160d952231768bc9231c95725a8bc224ef36b80c Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 23 May 2016 11:38:09 +0000 Subject: [PATCH 029/177] ignore api-data --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c2658d7d1b..84b9efb392 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +api-data From 89a1cd267a75d85bafd8a8dba2c74935dcaa7ae9 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 12:39:06 +0100 Subject: [PATCH 030/177] use dir of versions not version --- Gruntfile.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 0f1d222059..fad7fc82da 100644 --- a/Gruntfile.coffee +++ b/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 4464bf7893161684a010b6693fda20d9c674642e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 12:43:26 +0100 Subject: [PATCH 031/177] move init scripts to init dir --- Dockerfile | 8 ++++---- .../00_make_sharelatex_data_dirs.sh | 0 .../00_regen_sharelatex_secrets.sh | 0 .../00_set_docker_host_ipaddress.sh | 0 99_migrate.sh => init_scripts/99_migrate.sh | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename 00_make_sharelatex_data_dirs.sh => init_scripts/00_make_sharelatex_data_dirs.sh (100%) rename 00_regen_sharelatex_secrets.sh => init_scripts/00_regen_sharelatex_secrets.sh (100%) rename 00_set_docker_host_ipaddress.sh => init_scripts/00_set_docker_host_ipaddress.sh (100%) rename 99_migrate.sh => init_scripts/99_migrate.sh (100%) diff --git a/Dockerfile b/Dockerfile index 2f9766efaa..ca42eb7fc3 100644 --- a/Dockerfile +++ b/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/00_make_sharelatex_data_dirs.sh b/init_scripts/00_make_sharelatex_data_dirs.sh similarity index 100% rename from 00_make_sharelatex_data_dirs.sh rename to init_scripts/00_make_sharelatex_data_dirs.sh diff --git a/00_regen_sharelatex_secrets.sh b/init_scripts/00_regen_sharelatex_secrets.sh similarity index 100% rename from 00_regen_sharelatex_secrets.sh rename to init_scripts/00_regen_sharelatex_secrets.sh diff --git a/00_set_docker_host_ipaddress.sh b/init_scripts/00_set_docker_host_ipaddress.sh similarity index 100% rename from 00_set_docker_host_ipaddress.sh rename to init_scripts/00_set_docker_host_ipaddress.sh diff --git a/99_migrate.sh b/init_scripts/99_migrate.sh similarity index 100% rename from 99_migrate.sh rename to init_scripts/99_migrate.sh From 576efb8ebf9cded3ce5ee3449923276bbbabbe94 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 12:51:49 +0100 Subject: [PATCH 032/177] create templates dir --- Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ca42eb7fc3..006c9503f8 100644 --- a/Dockerfile +++ b/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 1a478d49db2da2fbe9bdf26b486bc05cb623e740 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 13:26:45 +0100 Subject: [PATCH 033/177] fixed bad coffeescript in settings file --- settings.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/settings.coffee b/settings.coffee index f479c13350..765c6c3354 100644 --- a/settings.coffee +++ b/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 80e419788a541e73ff3c7e30779194bf8c5c5eb0 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 23 May 2016 14:27:24 +0100 Subject: [PATCH 034/177] added strace and time --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 006c9503f8..c7081288f4 100644 --- a/Dockerfile +++ b/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 8c1fecbe168bbebd8191833a17de2f04c50f785f Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 12:12:26 +0100 Subject: [PATCH 035/177] added missing ldap settings --- settings.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 765c6c3354..7e4f88a327 100644 --- a/settings.coffee +++ b/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 27ea0d2f00b05e578dba90e18f0a3341dfa25ac6 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 15:47:13 +0100 Subject: [PATCH 036/177] moved guide to official wiki --- README.md | 215 +----------------------------------------------------- 1 file changed, 3 insertions(+), 212 deletions(-) diff --git a/README.md b/README.md index 5d6956d7f6..e5980183ac 100644 --- a/README.md +++ b/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 086bb2310e2360125bac0e8665fdf8785504a315 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 15:47:46 +0100 Subject: [PATCH 037/177] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5980183ac..0b11b2b198 100644 --- a/README.md +++ b/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 25a93b3bf2ae3ea1b694350fed000aaab1e59a61 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 15:48:02 +0100 Subject: [PATCH 038/177] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0b11b2b198..04a117bcb7 100644 --- a/README.md +++ b/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 dab6bf74b3eed32a3bd96d179d45b8447d375771 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 24 May 2016 16:43:08 +0100 Subject: [PATCH 039/177] fix templates & clsi set dynamically. and more robust bool vals from env vars --- settings.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/settings.coffee b/settings.coffee index 7e4f88a327..2e2c738acb 100644 --- a/settings.coffee +++ b/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 7ee0355ed07bd727c3a7836dd2e919e0f5481abe Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 26 May 2016 11:01:21 +0100 Subject: [PATCH 040/177] build latex first for faster images and compile clsi synctex --- Dockerfile | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index c7081288f4..7fd51f7e01 100644 --- a/Dockerfile +++ b/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 df0b2bb57bd7d7c097694773ef311adb14f9a902 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 26 May 2016 11:22:51 +0100 Subject: [PATCH 041/177] build things that don't change at the start for quicker build time --- Dockerfile | 53 +++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7fd51f7e01..9cfd8edc51 100644 --- a/Dockerfile +++ b/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 d4891d77f1189fabc352cca00be3262a578eb49d Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 27 May 2016 12:12:28 +0100 Subject: [PATCH 042/177] put apt-get installs on same line and set $TEX_LIVE_DOCKER_IMAGE via env var --- Dockerfile | 20 +++----------------- settings.coffee | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9cfd8edc51..929528f274 100644 --- a/Dockerfile +++ b/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/settings.coffee b/settings.coffee index 2e2c738acb..f3066da8ed 100644 --- a/settings.coffee +++ b/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 c524be6180efa1b7e123b6f9b7f9489ecb91ad80 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 27 May 2016 12:55:18 +0100 Subject: [PATCH 043/177] run as www-data --- Dockerfile | 6 +++--- runit/chat-sharelatex.sh | 2 +- runit/clsi-sharelatex.sh | 2 +- runit/docstore-sharelatex.sh | 2 +- runit/document-updater-sharelatex.sh | 2 +- runit/filestore-sharelatex.sh | 2 +- runit/real-time-sharelatex.sh | 2 +- runit/spelling-sharelatex.sh | 2 +- runit/tags-sharelatex.sh | 2 +- runit/track-changes-sharelatex.sh | 2 +- runit/web-sharelatex.sh | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 929528f274..eac17b83c1 100644 --- a/Dockerfile +++ b/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/runit/chat-sharelatex.sh b/runit/chat-sharelatex.sh index 509ff8588e..1b8533bb86 100755 --- a/runit/chat-sharelatex.sh +++ b/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/runit/clsi-sharelatex.sh b/runit/clsi-sharelatex.sh index 59298743c8..1c6974cd2a 100755 --- a/runit/clsi-sharelatex.sh +++ b/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/runit/docstore-sharelatex.sh b/runit/docstore-sharelatex.sh index ba7a96c8d7..0de82ccf20 100755 --- a/runit/docstore-sharelatex.sh +++ b/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/runit/document-updater-sharelatex.sh b/runit/document-updater-sharelatex.sh index 8f692ecdbe..274b7f9998 100755 --- a/runit/document-updater-sharelatex.sh +++ b/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/runit/filestore-sharelatex.sh b/runit/filestore-sharelatex.sh index b02695f747..e0858c01ce 100755 --- a/runit/filestore-sharelatex.sh +++ b/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/runit/real-time-sharelatex.sh b/runit/real-time-sharelatex.sh index 19aaed457b..c57d1d489e 100755 --- a/runit/real-time-sharelatex.sh +++ b/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/runit/spelling-sharelatex.sh b/runit/spelling-sharelatex.sh index 848c6ac7d1..4466bcfcf5 100755 --- a/runit/spelling-sharelatex.sh +++ b/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/runit/tags-sharelatex.sh b/runit/tags-sharelatex.sh index 8616c1356c..a5630ed4ff 100755 --- a/runit/tags-sharelatex.sh +++ b/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/runit/track-changes-sharelatex.sh b/runit/track-changes-sharelatex.sh index 347d8f021a..aeb812ef38 100755 --- a/runit/track-changes-sharelatex.sh +++ b/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/runit/web-sharelatex.sh b/runit/web-sharelatex.sh index b0bda54c81..053a55a326 100755 --- a/runit/web-sharelatex.sh +++ b/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 59ce10e45f367b4310a1434f21a0063f33e58fc6 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 27 May 2016 13:12:22 +0100 Subject: [PATCH 044/177] one line the apt-get --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index eac17b83c1..e3ca178741 100644 --- a/Dockerfile +++ b/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 c0090fcc22e902182f34ca81eea2e0f9fd34429e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 27 May 2016 15:46:51 +0100 Subject: [PATCH 045/177] run everything as www-data --- init_scripts/00_make_sharelatex_data_dirs.sh | 17 ++++++++++------- settings.coffee | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/init_scripts/00_make_sharelatex_data_dirs.sh b/init_scripts/00_make_sharelatex_data_dirs.sh index f8d424f201..f48a95fde7 100755 --- a/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/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/settings.coffee b/settings.coffee index f3066da8ed..f6d48b3dc4 100644 --- a/settings.coffee +++ b/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 2247ee50b9359a87ac4f1a32bc0f93cd1d7649a8 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 31 May 2016 14:15:24 +0000 Subject: [PATCH 046/177] install qpdf v6 --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e3ca178741..91fa6e4c4d 100644 --- a/Dockerfile +++ b/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 4222a822d758c44f01a6cfd4edc45f484e484e64 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 31 May 2016 15:16:31 +0100 Subject: [PATCH 047/177] set synctexBaseDir: () -> "/compile" if using docker in docker --- Dockerfile | 2 ++ settings.coffee | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 91fa6e4c4d..d7ca93d357 100644 --- a/Dockerfile +++ b/Dockerfile @@ -106,5 +106,7 @@ ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee EXPOSE 80 +WORKDIR / + ENTRYPOINT ["/sbin/my_init"] diff --git a/settings.coffee b/settings.coffee index f6d48b3dc4..e1b5c2ca5e 100644 --- a/settings.coffee +++ b/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 d9f50ae34819bdf1efe803b397ea5c9bbcc5cde9 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 31 May 2016 15:21:26 +0100 Subject: [PATCH 048/177] use SANDBOXED_COMPILES not DOCKER_IN_DOCKER --- settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index e1b5c2ca5e..55c964012b 100644 --- a/settings.coffee +++ b/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 6189ce9c16802a6ed6ae1c83989b486c7ec54a5e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 31 May 2016 16:37:50 +0100 Subject: [PATCH 049/177] try cicule ci --- circle.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000000..6df3bd992e --- /dev/null +++ b/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 d4fb706ac01b08fd1a1fbcf2d9b8b1eeb9eda1dc Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Thu, 9 Jun 2016 11:36:00 +0000 Subject: [PATCH 050/177] add grunt cut task --- .gitignore | 1 + Gruntfile.coffee | 7 +++++++ package.json | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 84b9efb392..023b43469e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ api-data +versions/ diff --git a/Gruntfile.coffee b/Gruntfile.coffee index fad7fc82da..502fc13c36 100644 --- a/Gruntfile.coffee +++ b/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/package.json b/package.json index 329169d96d..e1efb9b159 100644 --- a/package.json +++ b/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 e8fe3bc924169393b8e32ab153db22a73d5dde0e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 9 Jun 2016 16:21:54 +0100 Subject: [PATCH 051/177] allow header and footer to be configured via env vars --- settings.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/settings.coffee b/settings.coffee index 55c964012b..1f782a68c6 100644 --- a/settings.coffee +++ b/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 317b891afe56f73e987d0277bb6da85ef1efe658 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 9 Jun 2016 16:22:27 +0100 Subject: [PATCH 052/177] point to texlive 2016 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d7ca93d357..097de9a123 100644 --- a/Dockerfile +++ b/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 77933a9abc6a803bbd6e42a62fd996d0b339cc9d Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 9 Jun 2016 18:29:27 +0100 Subject: [PATCH 053/177] move left_footer and co to bottom of settings file --- settings.coffee | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/settings.coffee b/settings.coffee index 1f782a68c6..0b0242e7fb 100644 --- a/settings.coffee +++ b/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 27dd97ecc59954a5ad2d8b140f7d5a83073ca2c8 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 15 Jun 2016 17:08:21 +0100 Subject: [PATCH 054/177] remove grunfile and circule.yml file, consolodate in server pro --- Gruntfile.coffee | 45 --------------------------------------------- README.md | 6 +----- circle.yml | 13 ------------- 3 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 Gruntfile.coffee delete mode 100644 circle.yml diff --git a/Gruntfile.coffee b/Gruntfile.coffee deleted file mode 100644 index 502fc13c36..0000000000 --- a/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/README.md b/README.md index 04a117bcb7..8e5cd84b8e 100644 --- a/README.md +++ b/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/circle.yml b/circle.yml deleted file mode 100644 index 6df3bd992e..0000000000 --- a/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 b24239f46885ec4b006049a77d7f51342708e814 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 15 Jun 2016 17:08:48 +0100 Subject: [PATCH 055/177] fix spelling mistake with community --- settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 0b0242e7fb..e5b775e298 100644 --- a/settings.coffee +++ b/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 3cb66b24a99dafb3825954a91df65530ae0c7396 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 17 Jun 2016 12:34:38 +0100 Subject: [PATCH 056/177] settings.header ! settingsheader --- settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index e5b775e298..e813342ebd 100644 --- a/settings.coffee +++ b/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 cc3c8d1db79c446da3bc071ff8b2a12b22ee2325 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 17 Jun 2016 13:05:03 +0100 Subject: [PATCH 057/177] parse left and right footers as json --- settings.coffee | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/settings.coffee b/settings.coffee index e813342ebd..9e81e644a1 100644 --- a/settings.coffee +++ b/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 3cd9b096d30ee1ba2d641422d0108ace9063fb4b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 22 Jun 2016 11:47:17 +0100 Subject: [PATCH 058/177] parse ca paths as json --- settings.coffee | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/settings.coffee b/settings.coffee index 9e81e644a1..bfcf232267 100644 --- a/settings.coffee +++ b/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 701971e28d3911bd5b0fbc455e6ea89e563529b6 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 22 Jun 2016 11:56:29 +0100 Subject: [PATCH 059/177] remove debugging line --- settings.coffee | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/settings.coffee b/settings.coffee index bfcf232267..b610bad137 100644 --- a/settings.coffee +++ b/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 06b7eb5b5a2ae2e7153edbf353ef79d97430a838 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 23 Jun 2016 16:47:56 +0100 Subject: [PATCH 060/177] set smtp auth to null if not set --- settings.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/settings.coffee b/settings.coffee index b610bad137..a5c590edab 100644 --- a/settings.coffee +++ b/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 4a66b59c16650df64cde1215191a15ccb956b12f Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 23 Jun 2016 16:48:05 +0100 Subject: [PATCH 061/177] set references to undefined so its not used yet --- settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.coffee b/settings.coffee index a5c590edab..5fb1050505 100644 --- a/settings.coffee +++ b/settings.coffee @@ -388,6 +388,7 @@ settings = url: "http://localhost:3000" user: httpAuthUser pass: httpAuthPass + references:undefined # documentupdater: # url : "http://localhost:#{docUpdaterPort}" # clsi: From 3c46fbf2e1d7216a00db18c0774d251b1818ccc0 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Thu, 23 Jun 2016 22:07:30 +0000 Subject: [PATCH 062/177] touch sqlite file if it does not exist --- init_scripts/00_make_sharelatex_data_dirs.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init_scripts/00_make_sharelatex_data_dirs.sh b/init_scripts/00_make_sharelatex_data_dirs.sh index f48a95fde7..6269f1b2a9 100755 --- a/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/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 10c2665e401be3d7fd379300728c4597084806b3 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Jun 2016 14:06:50 +0100 Subject: [PATCH 063/177] don't call notifications --- settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/settings.coffee b/settings.coffee index 5fb1050505..94fd2939b4 100644 --- a/settings.coffee +++ b/settings.coffee @@ -389,6 +389,8 @@ settings = user: httpAuthUser pass: httpAuthPass references:undefined + notifications:undefined + # documentupdater: # url : "http://localhost:#{docUpdaterPort}" # clsi: From a5b11360d375759bca60e636d548ded7255434f9 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 27 Jun 2016 14:50:46 +0100 Subject: [PATCH 064/177] added SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH and SHARELATEX_EMAIL_SMTP_IGNORE_TLS --- settings.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/settings.coffee b/settings.coffee index 94fd2939b4..c7e9d1e873 100644 --- a/settings.coffee +++ b/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 2795a04ffae62ae532233bb588917decf6c3a468 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 27 Jun 2016 15:19:43 +0100 Subject: [PATCH 065/177] don't try and put properties on email if basic email is not configured --- settings.coffee | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/settings.coffee b/settings.coffee index c7e9d1e873..fe4b9303a1 100644 --- a/settings.coffee +++ b/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 3e4cc12de4c7ba399a18ce2f7aed5fa145a5c5aa Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 28 Jun 2016 10:07:50 +0100 Subject: [PATCH 066/177] added learn wiki option and parse helper method --- settings.coffee | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/settings.coffee b/settings.coffee index fe4b9303a1..b396d37f66 100644 --- a/settings.coffee +++ b/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 9479ee4cbb0fdd0279cf001370dfb130735e52db Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 28 Jun 2016 17:08:00 +0100 Subject: [PATCH 067/177] added custom footer for email option --- settings.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/settings.coffee b/settings.coffee index b396d37f66..e2f25ad934 100644 --- a/settings.coffee +++ b/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 f3c2c11dc86f9fa0cae92df7a16802140ad50680 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 30 Jun 2016 16:47:13 +0100 Subject: [PATCH 068/177] move install latexmk and path higher up --- Dockerfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 097de9a123..dba9ac2066 100644 --- a/Dockerfile +++ b/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 d39b66f32ea6e99c0e06b13b6a525c7d74febb23 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 30 Jun 2016 16:47:23 +0100 Subject: [PATCH 069/177] add permissions change for templates dir --- init_scripts/00_make_sharelatex_data_dirs.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init_scripts/00_make_sharelatex_data_dirs.sh b/init_scripts/00_make_sharelatex_data_dirs.sh index 6269f1b2a9..49e5b7ba6d 100755 --- a/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/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 eef4982698af1db7a9e006f0fa6516baab8ec296 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 30 Jun 2016 16:47:35 +0100 Subject: [PATCH 070/177] add echo for finished migrations in --- init_scripts/99_migrate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/init_scripts/99_migrate.sh b/init_scripts/99_migrate.sh index 762aae2806..d062496581 100755 --- a/init_scripts/99_migrate.sh +++ b/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 1d80ac6b7a0cb011a42fd206a94d8ab5b5ff5073 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 14 Jul 2016 16:50:11 +0100 Subject: [PATCH 071/177] added dump folder and template files fix to init script --- init_scripts/00_make_sharelatex_data_dirs.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init_scripts/00_make_sharelatex_data_dirs.sh b/init_scripts/00_make_sharelatex_data_dirs.sh index 49e5b7ba6d..6085a087da 100755 --- a/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/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 bb49809776e84a83cf4c6dec0c7270ee365e027d Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 3 Aug 2016 16:21:44 +0100 Subject: [PATCH 072/177] add contacts to services.js --- services.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services.js b/services.js index be4da8698a..3614b2c020 100644 --- a/services.js +++ b/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 445780aa2c70fa76b5b22ea11e76ec7c7f0794ae Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 3 Aug 2016 16:22:10 +0100 Subject: [PATCH 073/177] add template links SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS to config file --- settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/settings.coffee b/settings.coffee index e2f25ad934..86d49e39ec 100644 --- a/settings.coffee +++ b/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 10b6f88f3b70f7444c2c5260feac9a78fc49673e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 3 Aug 2016 16:22:17 +0100 Subject: [PATCH 074/177] add logrotate --- Dockerfile | 2 ++ logrotate/sharelatex | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 logrotate/sharelatex diff --git a/Dockerfile b/Dockerfile index dba9ac2066..41aaa7e20c 100644 --- a/Dockerfile +++ b/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/logrotate/sharelatex b/logrotate/sharelatex new file mode 100644 index 0000000000..efc51cc6c9 --- /dev/null +++ b/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 3dbe92ce323ba3de673313b013dbd59b3c892330 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Thu, 4 Aug 2016 13:19:33 +0000 Subject: [PATCH 075/177] cleaned up settings file and added refernces option in --- settings.coffee | 274 +++++++++++++++--------------------------------- 1 file changed, 82 insertions(+), 192 deletions(-) diff --git a/settings.coffee b/settings.coffee index e2f25ad934..3bbed39856 100644 --- a/settings.coffee +++ b/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 db7f88c834e57f0d7d339f48189532f833983bd7 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 5 Aug 2016 11:59:39 +0100 Subject: [PATCH 076/177] cleaned up dockerfile more, removing undded things --- Dockerfile | 51 ++++--------------- .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 .../run.sh} | 0 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 runit/{chat-sharelatex.sh => chat-sharelatex/run.sh} (100%) rename runit/{clsi-sharelatex.sh => clsi-sharelatex/run.sh} (100%) rename runit/{docstore-sharelatex.sh => docstore-sharelatex/run.sh} (100%) rename runit/{document-updater-sharelatex.sh => document-updater-sharelatex/run.sh} (100%) rename runit/{filestore-sharelatex.sh => filestore-sharelatex/run.sh} (100%) rename runit/{nginx.sh => nginx/run.sh} (100%) rename runit/{real-time-sharelatex.sh => real-time-sharelatex/run.sh} (100%) rename runit/{spelling-sharelatex.sh => spelling-sharelatex/run.sh} (100%) rename runit/{tags-sharelatex.sh => tags-sharelatex/run.sh} (100%) rename runit/{track-changes-sharelatex.sh => track-changes-sharelatex/run.sh} (100%) rename runit/{web-sharelatex.sh => web-sharelatex/run.sh} (100%) diff --git a/Dockerfile b/Dockerfile index 41aaa7e20c..240404ca65 100644 --- a/Dockerfile +++ b/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/runit/chat-sharelatex.sh b/runit/chat-sharelatex/run.sh similarity index 100% rename from runit/chat-sharelatex.sh rename to runit/chat-sharelatex/run.sh diff --git a/runit/clsi-sharelatex.sh b/runit/clsi-sharelatex/run.sh similarity index 100% rename from runit/clsi-sharelatex.sh rename to runit/clsi-sharelatex/run.sh diff --git a/runit/docstore-sharelatex.sh b/runit/docstore-sharelatex/run.sh similarity index 100% rename from runit/docstore-sharelatex.sh rename to runit/docstore-sharelatex/run.sh diff --git a/runit/document-updater-sharelatex.sh b/runit/document-updater-sharelatex/run.sh similarity index 100% rename from runit/document-updater-sharelatex.sh rename to runit/document-updater-sharelatex/run.sh diff --git a/runit/filestore-sharelatex.sh b/runit/filestore-sharelatex/run.sh similarity index 100% rename from runit/filestore-sharelatex.sh rename to runit/filestore-sharelatex/run.sh diff --git a/runit/nginx.sh b/runit/nginx/run.sh similarity index 100% rename from runit/nginx.sh rename to runit/nginx/run.sh diff --git a/runit/real-time-sharelatex.sh b/runit/real-time-sharelatex/run.sh similarity index 100% rename from runit/real-time-sharelatex.sh rename to runit/real-time-sharelatex/run.sh diff --git a/runit/spelling-sharelatex.sh b/runit/spelling-sharelatex/run.sh similarity index 100% rename from runit/spelling-sharelatex.sh rename to runit/spelling-sharelatex/run.sh diff --git a/runit/tags-sharelatex.sh b/runit/tags-sharelatex/run.sh similarity index 100% rename from runit/tags-sharelatex.sh rename to runit/tags-sharelatex/run.sh diff --git a/runit/track-changes-sharelatex.sh b/runit/track-changes-sharelatex/run.sh similarity index 100% rename from runit/track-changes-sharelatex.sh rename to runit/track-changes-sharelatex/run.sh diff --git a/runit/web-sharelatex.sh b/runit/web-sharelatex/run.sh similarity index 100% rename from runit/web-sharelatex.sh rename to runit/web-sharelatex/run.sh From a6640f13586d5b2c99879bbf600efeddb5261d5d Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Fri, 5 Aug 2016 11:05:06 +0000 Subject: [PATCH 077/177] added log rotate and locked down docupdater version for moment --- Dockerfile | 2 +- services.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 41aaa7e20c..c29e55c3d7 100644 --- a/Dockerfile +++ b/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/services.js b/services.js index 3614b2c020..ed590505cc 100644 --- a/services.js +++ b/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 6d7993722cbe34d4eff67502f4081d3ba029af45 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 5 Aug 2016 15:18:13 +0100 Subject: [PATCH 078/177] fixed init.d copy --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 09b47ab367..f31c08aabe 100644 --- a/Dockerfile +++ b/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 0c8fc4982c6154ff5b9ebe49fdfc68e1a13ab6c9 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 5 Aug 2016 15:18:35 +0100 Subject: [PATCH 079/177] added runit --- runit/notifications-sharelatex/run.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 runit/notifications-sharelatex/run.sh diff --git a/runit/notifications-sharelatex/run.sh b/runit/notifications-sharelatex/run.sh new file mode 100755 index 0000000000..6d1629152c --- /dev/null +++ b/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 ec24fc28fce1152c315d8c5b4f03410728395399 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Fri, 5 Aug 2016 14:22:42 +0000 Subject: [PATCH 080/177] added dollar to base path --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f31c08aabe..63a584ad6d 100644 --- a/Dockerfile +++ b/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 6cfe468a3b4c070258663aa8c82923b3e6609bc6 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Wed, 21 Sep 2016 12:47:07 +0000 Subject: [PATCH 081/177] move settings file to early on --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 63a584ad6d..cd53f43be7 100644 --- a/Dockerfile +++ b/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 e029c806984aa6de7d6fc39c12ab4f0c5e92217b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 21 Sep 2016 15:24:07 +0100 Subject: [PATCH 082/177] moved run.sh to run --- runit/chat-sharelatex/{run.sh => run} | 0 runit/clsi-sharelatex/{run.sh => run} | 0 runit/docstore-sharelatex/{run.sh => run} | 0 runit/document-updater-sharelatex/{run.sh => run} | 0 runit/filestore-sharelatex/{run.sh => run} | 0 runit/nginx/{run.sh => run} | 0 runit/notifications-sharelatex/{run.sh => run} | 0 runit/real-time-sharelatex/{run.sh => run} | 0 runit/spelling-sharelatex/{run.sh => run} | 0 runit/tags-sharelatex/{run.sh => run} | 0 runit/track-changes-sharelatex/{run.sh => run} | 0 runit/web-sharelatex/{run.sh => run} | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename runit/chat-sharelatex/{run.sh => run} (100%) rename runit/clsi-sharelatex/{run.sh => run} (100%) rename runit/docstore-sharelatex/{run.sh => run} (100%) rename runit/document-updater-sharelatex/{run.sh => run} (100%) rename runit/filestore-sharelatex/{run.sh => run} (100%) rename runit/nginx/{run.sh => run} (100%) rename runit/notifications-sharelatex/{run.sh => run} (100%) rename runit/real-time-sharelatex/{run.sh => run} (100%) rename runit/spelling-sharelatex/{run.sh => run} (100%) rename runit/tags-sharelatex/{run.sh => run} (100%) rename runit/track-changes-sharelatex/{run.sh => run} (100%) rename runit/web-sharelatex/{run.sh => run} (100%) diff --git a/runit/chat-sharelatex/run.sh b/runit/chat-sharelatex/run similarity index 100% rename from runit/chat-sharelatex/run.sh rename to runit/chat-sharelatex/run diff --git a/runit/clsi-sharelatex/run.sh b/runit/clsi-sharelatex/run similarity index 100% rename from runit/clsi-sharelatex/run.sh rename to runit/clsi-sharelatex/run diff --git a/runit/docstore-sharelatex/run.sh b/runit/docstore-sharelatex/run similarity index 100% rename from runit/docstore-sharelatex/run.sh rename to runit/docstore-sharelatex/run diff --git a/runit/document-updater-sharelatex/run.sh b/runit/document-updater-sharelatex/run similarity index 100% rename from runit/document-updater-sharelatex/run.sh rename to runit/document-updater-sharelatex/run diff --git a/runit/filestore-sharelatex/run.sh b/runit/filestore-sharelatex/run similarity index 100% rename from runit/filestore-sharelatex/run.sh rename to runit/filestore-sharelatex/run diff --git a/runit/nginx/run.sh b/runit/nginx/run similarity index 100% rename from runit/nginx/run.sh rename to runit/nginx/run diff --git a/runit/notifications-sharelatex/run.sh b/runit/notifications-sharelatex/run similarity index 100% rename from runit/notifications-sharelatex/run.sh rename to runit/notifications-sharelatex/run diff --git a/runit/real-time-sharelatex/run.sh b/runit/real-time-sharelatex/run similarity index 100% rename from runit/real-time-sharelatex/run.sh rename to runit/real-time-sharelatex/run diff --git a/runit/spelling-sharelatex/run.sh b/runit/spelling-sharelatex/run similarity index 100% rename from runit/spelling-sharelatex/run.sh rename to runit/spelling-sharelatex/run diff --git a/runit/tags-sharelatex/run.sh b/runit/tags-sharelatex/run similarity index 100% rename from runit/tags-sharelatex/run.sh rename to runit/tags-sharelatex/run diff --git a/runit/track-changes-sharelatex/run.sh b/runit/track-changes-sharelatex/run similarity index 100% rename from runit/track-changes-sharelatex/run.sh rename to runit/track-changes-sharelatex/run diff --git a/runit/web-sharelatex/run.sh b/runit/web-sharelatex/run similarity index 100% rename from runit/web-sharelatex/run.sh rename to runit/web-sharelatex/run From 52f68e2c604ea2f0545c331fa651b820f0d1f302 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 21 Sep 2016 16:59:37 +0100 Subject: [PATCH 083/177] install texcount on default image --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index cd53f43be7..d9a4b36e49 100644 --- a/Dockerfile +++ b/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 5c42b1bbe3a746006528c3e724a0c88e5bfd7066 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 21 Sep 2016 17:54:46 +0100 Subject: [PATCH 084/177] spell check notifications --- runit/notifications-sharelatex/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runit/notifications-sharelatex/run b/runit/notifications-sharelatex/run index 6d1629152c..12b3457f2c 100755 --- a/runit/notifications-sharelatex/run +++ b/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 ad10fda87286bf552be8ea1f28aa76a43966397b Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Wed, 21 Sep 2016 17:09:23 +0000 Subject: [PATCH 085/177] added notificaitons service --- services.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services.js b/services.js index ed590505cc..3dcb1df7da 100644 --- a/services.js +++ b/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 e5283e39a552e04dad41d5ea908779d2b5b8a3a4 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Wed, 21 Sep 2016 17:09:53 +0000 Subject: [PATCH 086/177] added contacts runit --- runit/contacts-sharelatex.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 runit/contacts-sharelatex.sh diff --git a/runit/contacts-sharelatex.sh b/runit/contacts-sharelatex.sh new file mode 100755 index 0000000000..29b513cb97 --- /dev/null +++ b/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 1fca735f02f3c73a5684a4d87658e247b1e2cdd2 Mon Sep 17 00:00:00 2001 From: ShareLaTeX Date: Wed, 21 Sep 2016 17:10:27 +0000 Subject: [PATCH 087/177] added check db init script --- init_scripts/98_check_db_access.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 init_scripts/98_check_db_access.sh diff --git a/init_scripts/98_check_db_access.sh b/init_scripts/98_check_db_access.sh new file mode 100755 index 0000000000..a90adba84f --- /dev/null +++ b/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 912141a7a84802c1964583382104feb5bbdc7b67 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 3 Oct 2016 16:54:11 +0100 Subject: [PATCH 088/177] set clsi home to tmp which fixed luatex bug --- settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.coffee b/settings.coffee index 3bbed39856..799cb73121 100644 --- a/settings.coffee +++ b/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 32c123345aac95209606dc69c6fc16499fa84511 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 13 Oct 2016 14:21:33 +0100 Subject: [PATCH 089/177] added textEncoding for email option --- settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 799cb73121..c9d99521bd 100644 --- a/settings.coffee +++ b/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 efe0e8f87661d83fa992ab427921aee0822e76c9 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 21 Oct 2016 15:43:58 +0100 Subject: [PATCH 090/177] don't show register when external auth is used --- package.json | 3 ++- settings.coffee | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index e1efb9b159..d3c19d112f 100644 --- a/package.json +++ b/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/settings.coffee b/settings.coffee index c9d99521bd..81395d8b2e 100644 --- a/settings.coffee +++ b/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 2a1e22f20f51e7a529f81813c645d25f5b0e6570 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 3 Nov 2016 11:18:34 +0000 Subject: [PATCH 091/177] remove underscore from settings.coffee --- settings.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/settings.coffee b/settings.coffee index 81395d8b2e..2ecd4295f4 100644 --- a/settings.coffee +++ b/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 d06b8ec6883be0c2195977895d164ff82519c9f7 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 3 Nov 2016 16:28:25 +0000 Subject: [PATCH 092/177] Use the ? operator --- settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 2ecd4295f4..57d3c22c0d 100644 --- a/settings.coffee +++ b/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 68e4df72df7602f6cc001c6c7599cbb2c3d1664a Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 4 Nov 2016 15:14:33 +0000 Subject: [PATCH 093/177] check that nav.header is configured --- settings.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.coffee b/settings.coffee index 57d3c22c0d..691de1d9f4 100644 --- a/settings.coffee +++ b/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 2a6ef976f3c6f2bca047abd6492c1c4fc5d7971e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 8 Nov 2016 22:37:31 +0000 Subject: [PATCH 094/177] added default features --- settings.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 691de1d9f4..50d12acfdb 100644 --- a/settings.coffee +++ b/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 3f5a41e3027899058b35b257e37c1e51dbabeb7e Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 14 Nov 2016 15:40:18 +0000 Subject: [PATCH 095/177] Add saml config options --- settings.coffee | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/settings.coffee b/settings.coffee index 691de1d9f4..85f87677f5 100644 --- a/settings.coffee +++ b/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 4aadcb4b91d192b05ff98fd46ce5d29337cc761a Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 14 Nov 2016 15:46:12 +0000 Subject: [PATCH 096/177] Refactor. --- settings.coffee | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/settings.coffee b/settings.coffee index 9d8fcef66b..8ac6e34307 100644 --- a/settings.coffee +++ b/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 5c40640d062c8037e71c96f5e4f751cb2f91a514 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 23 Nov 2016 10:37:35 +0000 Subject: [PATCH 097/177] Add saml emailFieldName option --- settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.coffee b/settings.coffee index 8ac6e34307..b2113c1d91 100644 --- a/settings.coffee +++ b/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 8922421443eb50c7d747fd6d76e9a0deef2f92b0 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 23 Nov 2016 14:13:37 +0000 Subject: [PATCH 098/177] Add options for saml firstName and lastName fields. --- settings.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index b2113c1d91..2bb169d8dc 100644 --- a/settings.coffee +++ b/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 776ff2960deb8ded666fd1ecac0e52f93a073037 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 2 Dec 2016 15:12:57 +0000 Subject: [PATCH 099/177] Add `updateUserDetailsOnLogin` options to ldap and saml. --- settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/settings.coffee b/settings.coffee index 2bb169d8dc..1397930cfc 100644 --- a/settings.coffee +++ b/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 459a325bb51cd11dbf2a339f2be4650045bf8a13 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 09:22:31 +0000 Subject: [PATCH 100/177] Update to new ldap config --- settings.coffee | 126 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 111 insertions(+), 15 deletions(-) diff --git a/settings.coffee b/settings.coffee index 1397930cfc..683b674036 100644 --- a/settings.coffee +++ b/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 3093e93d8eb36bc19ac153192ebf8ece02deee4c Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 10:40:43 +0000 Subject: [PATCH 101/177] Remove the starttls option --- settings.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 683b674036..db943f45bb 100644 --- a/settings.coffee +++ b/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 aaf8c833b8e7aea64a2df4371934f3a519e9fc4f Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 11:01:01 +0000 Subject: [PATCH 102/177] Fix ldap settings --- settings.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/settings.coffee b/settings.coffee index db943f45bb..06778973e5 100644 --- a/settings.coffee +++ b/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 a146cb028229954f9a34b7712e3601436c10eaa2 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 11:13:20 +0000 Subject: [PATCH 103/177] Add error var --- settings.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.coffee b/settings.coffee index 06778973e5..6c41616556 100644 --- a/settings.coffee +++ b/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 b2221e7efa457339222e5070f8cb75d63afa042c Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 9 Dec 2016 12:34:08 +0000 Subject: [PATCH 104/177] Fix daft typos --- settings.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.coffee b/settings.coffee index 6c41616556..14a5c0d49f 100644 --- a/settings.coffee +++ b/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 4283bde9c00b42990787557b239a847b2ed3a089 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Mon, 19 Dec 2016 14:17:39 +0000 Subject: [PATCH 105/177] chown /var/www/ to www-data --- init_scripts/00_make_sharelatex_data_dirs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init_scripts/00_make_sharelatex_data_dirs.sh b/init_scripts/00_make_sharelatex_data_dirs.sh index 6085a087da..7857b984fb 100755 --- a/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/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 9abed0f0759e4297f3a350ac4362f016533e1229 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 20 Dec 2016 10:28:37 +0000 Subject: [PATCH 106/177] Remove cruft. --- settings.coffee | 45 --------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/settings.coffee b/settings.coffee index 14a5c0d49f..5c795e17dc 100644 --- a/settings.coffee +++ b/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 f4255f93a2a9dc17eed3582826cd0f87edbe2ff5 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 20 Dec 2016 10:28:54 +0000 Subject: [PATCH 107/177] add `restrictInvitesToExistingAccounts` option --- settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.coffee b/settings.coffee index 5c795e17dc..b5d74c701d 100644 --- a/settings.coffee +++ b/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 d1f4334df158a9e40893974575c1ccf875006721 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 21 Dec 2016 13:51:05 +0000 Subject: [PATCH 108/177] Move the filtering-out of `/register` links to web --- settings.coffee | 7 ------- 1 file changed, 7 deletions(-) diff --git a/settings.coffee b/settings.coffee index b5d74c701d..58f83c5def 100644 --- a/settings.coffee +++ b/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 afe9273412b927c57f980b520a5947c72d5d9ca2 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 21 Dec 2016 14:57:47 +0000 Subject: [PATCH 109/177] Fix the header-nav links option --- settings.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/settings.coffee b/settings.coffee index 58f83c5def..a132c4eb99 100644 --- a/settings.coffee +++ b/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 d18a63fac4ac4e36fec67701e2befd5a5aafd3b2 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 4 Jan 2017 11:41:38 +0000 Subject: [PATCH 110/177] - added option to set lang code - removed commeted out learn header code - increased max pass length to 150 --- settings.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/settings.coffee b/settings.coffee index a132c4eb99..c410305a59 100644 --- a/settings.coffee +++ b/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 1bfec242b27e2ab691e1ac7e28fb00d755638abd Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 6 Jan 2017 11:28:32 +0000 Subject: [PATCH 111/177] add option to set lang per domain --- settings.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/settings.coffee b/settings.coffee index c410305a59..25dfe1e548 100644 --- a/settings.coffee +++ b/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 8c08df27178a80a00fef996b6daf1947e276167f Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 6 Jan 2017 16:02:27 +0000 Subject: [PATCH 112/177] remove proxy_set_header X-Forwarded-Proto $scheme for https --- nginx/sharelatex.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/nginx/sharelatex.conf b/nginx/sharelatex.conf index 0111797967..cf63f4c5c4 100644 --- a/nginx/sharelatex.conf +++ b/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 1e97636089b8c85dbab8e9f5700621aa70ac8c63 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 12 Jan 2017 13:51:10 +0000 Subject: [PATCH 113/177] Add new SHARELATEX_HEADER_EXTRAS option --- settings.coffee | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/settings.coffee b/settings.coffee index a132c4eb99..77e4085642 100644 --- a/settings.coffee +++ b/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 0e2971cac190a947597fea8a0d3151aedf3f8966 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 13 Jan 2017 11:39:34 -0500 Subject: [PATCH 114/177] add /var/log/sharlatex-errors.log --- runit/errorlogs/run | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 runit/errorlogs/run diff --git a/runit/errorlogs/run b/runit/errorlogs/run new file mode 100755 index 0000000000..e4053dab9e --- /dev/null +++ b/runit/errorlogs/run @@ -0,0 +1,2 @@ +#!/bin/bash +tail -F /var/log/sharelatex/*.log | grep '"level":50' >> /var/log/sharlatex-errors.log From d5914532e8741707d80eb3b0910916292ed89df1 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 25 Jan 2017 15:22:32 +0000 Subject: [PATCH 115/177] Un-pin doc-updater --- services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services.js b/services.js index 3dcb1df7da..b79ab9a4b7 100644 --- a/services.js +++ b/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 80eaaf0dfb89ca6348b02912bba1812ad397745c Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 26 Jan 2017 10:27:17 +0000 Subject: [PATCH 116/177] Add documentupdater config --- settings.coffee | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/settings.coffee b/settings.coffee index f1e32e87bc..7b6fc315d3 100644 --- a/settings.coffee +++ b/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 76d722d835aec68d53c68dded962f55d70ea23bd Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 26 Jan 2017 13:43:07 +0000 Subject: [PATCH 117/177] Add array wrapper --- settings.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 7b6fc315d3..f60ff9f106 100644 --- a/settings.coffee +++ b/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 91c85b6cd86422563363fdf74590a78840b3bbec Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 27 Jan 2017 09:52:55 +0000 Subject: [PATCH 118/177] replace spaces with tabs --- settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index f60ff9f106..53cf424853 100644 --- a/settings.coffee +++ b/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 df7993e2c67df142d10d0b02cf1fcad92a9c6c7d Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 27 Jan 2017 13:28:14 +0000 Subject: [PATCH 119/177] Add primary=true --- settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.coffee b/settings.coffee index 53cf424853..394a1d09f9 100644 --- a/settings.coffee +++ b/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 6eaef02fa27bb124812ec1b24a79dd0ae6e5ac08 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 2 Feb 2017 14:09:55 +0000 Subject: [PATCH 120/177] Add launchpad to docker build --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d9a4b36e49..4e721dc5ef 100644 --- a/Dockerfile +++ b/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 eac77291f5528cb682b1c49d41782c47183adfac Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 3 Feb 2017 14:10:42 +0000 Subject: [PATCH 121/177] add sandboxed compiles sibling containers --- settings.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/settings.coffee b/settings.coffee index 394a1d09f9..7891c4a1a5 100644 --- a/settings.coffee +++ b/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 dda130939340945b39a9c40e8a0d604ee650978e Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 21 Feb 2017 11:01:52 +0000 Subject: [PATCH 122/177] Remove texlive docks --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4e721dc5ef..b8ca0a0360 100644 --- a/Dockerfile +++ b/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 37e8445e8dd2e6df9c9ea62abb3898ab639c00ee Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 21 Feb 2017 11:22:25 +0000 Subject: [PATCH 123/177] split base image from main image --- Dockerfile | 50 ++++--------------------------------------------- Dockerfile-base | 41 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 Dockerfile-base diff --git a/Dockerfile b/Dockerfile index b8ca0a0360..2e688a0c55 100644 --- a/Dockerfile +++ b/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/Dockerfile-base b/Dockerfile-base new file mode 100644 index 0000000000..55c69e0aa5 --- /dev/null +++ b/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 958ba764639c323c03158ec7f32059a00b9dcbb9 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 22 Feb 2017 09:20:07 +0000 Subject: [PATCH 124/177] Update image names --- Dockerfile | 4 +++- Dockerfile-base | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e688a0c55..0efcdefa30 100644 --- a/Dockerfile +++ b/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/Dockerfile-base b/Dockerfile-base index 55c69e0aa5..4142c48b0c 100644 --- a/Dockerfile-base +++ b/Dockerfile-base @@ -1,4 +1,4 @@ -# Sharelatex Base Image +# Sharelatex Base Image (sharelatex/sharelatex-base) FROM phusion/baseimage:0.9.16 From d7393738921f58c17bc387db78de9401da88d46a Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 22 Feb 2017 09:23:01 +0000 Subject: [PATCH 125/177] Add a makefil --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..75e967936a --- /dev/null +++ b/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 6c81aa07fb93d381da2812fa25bba46018c1f5a8 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 22 Feb 2017 09:48:34 +0000 Subject: [PATCH 126/177] Set baseDir var --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0efcdefa30..a520960c4f 100644 --- a/Dockerfile +++ b/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 fe7ba6d32126ef6dd0e16ef73bb9b9a367ce9717 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 23 Feb 2017 09:47:11 +0000 Subject: [PATCH 127/177] Add docHash to key_schema --- settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.coffee b/settings.coffee index 7891c4a1a5..9eec76da71 100644 --- a/settings.coffee +++ b/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 84ba3c76c7e89ad8d88f62b254259e04e606bfd9 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 27 Feb 2017 15:46:28 +0000 Subject: [PATCH 128/177] Pin to sharelatex-base:v1.0.0 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a520960c4f..11f0d2ef39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Sharelatex Community Edition (sharelatex/sharelatex) -FROM sharelatex/sharelatex-base +FROM sharelatex/sharelatex-base:v1.0.0 ENV baseDir . From 7a30975728a8be031d2ef0aae6e8adb3e2b27d67 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 5 Apr 2017 14:48:36 +0100 Subject: [PATCH 129/177] Add `trackchanges.continueOnError` as default --- settings.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/settings.coffee b/settings.coffee index 9eec76da71..99c8b9d280 100644 --- a/settings.coffee +++ b/settings.coffee @@ -101,6 +101,9 @@ settings = # secret: "AWS_SECRET" # + trackchanges: + continueOnError: true + # Local disk caching # ------------------ path: From 9e6b7a1aa15f91dbe9a983acc7c32e912fcfea55 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 17 May 2017 15:29:01 +0100 Subject: [PATCH 130/177] Update redis configs to accomodate recent changes --- settings.coffee | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/settings.coffee b/settings.coffee index 99c8b9d280..adf5bb5867 100644 --- a/settings.coffee +++ b/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 2c2b3a81175cc4870553cf668d864c50555c48a3 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 18 May 2017 10:55:41 +0100 Subject: [PATCH 131/177] Add realtime config and websessions to redis --- settings.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/settings.coffee b/settings.coffee index adf5bb5867..a68eb483dd 100644 --- a/settings.coffee +++ b/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 c392276b8e05dda3c9edd68170b480d27360c21f Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 18 May 2017 13:08:55 +0100 Subject: [PATCH 132/177] Ensure bcrypt gets installed --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 11f0d2ef39..9f6cd1032a 100644 --- a/Dockerfile +++ b/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 b5532802c9fd0090977adb9de6dd12cf128d8355 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 19 May 2017 08:32:34 +0100 Subject: [PATCH 133/177] Refactor --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9f6cd1032a..10db29293c 100644 --- a/Dockerfile +++ b/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 32eaa0310df3114a35b05486f38e037622811547 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 21 Jun 2017 10:59:19 +0100 Subject: [PATCH 134/177] add the driver field to email config --- settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.coffee b/settings.coffee index a68eb483dd..9b7fe58c40 100644 --- a/settings.coffee +++ b/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 6b384c6fe0f335857502652ca6af5e4139b2b35f Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 2 Aug 2017 08:42:30 +0100 Subject: [PATCH 135/177] Update the node distro --- Dockerfile-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile-base b/Dockerfile-base index 4142c48b0c..6ea4fd93d6 100644 --- a/Dockerfile-base +++ b/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 5825a51c44d30a9d1fbd8928840986b1d256b848 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 2 Aug 2017 09:45:08 +0100 Subject: [PATCH 136/177] Update texlive path --- Dockerfile-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile-base b/Dockerfile-base index 6ea4fd93d6..a59431fc9d 100644 --- a/Dockerfile-base +++ b/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 7fd351a2beb198d8a89a1b42fae2cb18bb1d61c8 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 6 Sep 2017 11:16:12 +0100 Subject: [PATCH 137/177] Add call to install-services --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 10db29293c..6e94aa3ab8 100644 --- a/Dockerfile +++ b/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 1a9aab3516d666ac7b0f061d603f26839d57ff91 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 8 Sep 2017 09:09:42 +0100 Subject: [PATCH 138/177] Pin to latest base image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6e94aa3ab8..7593c726f7 100644 --- a/Dockerfile +++ b/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 410039534aa37b788f70c6a174e65ea2a9fe5f65 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 18 Oct 2017 13:28:13 +0100 Subject: [PATCH 139/177] Add setting to enable anonymous read-write sharing --- settings.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/settings.coffee b/settings.coffee index 9b7fe58c40..01614eae00 100644 --- a/settings.coffee +++ b/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 041c73221abc9111822fec7727172708af6b231b Mon Sep 17 00:00:00 2001 From: Rico Date: Mon, 23 Oct 2017 14:46:37 +0200 Subject: [PATCH 140/177] Fix typo in error log filename --- runit/errorlogs/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runit/errorlogs/run b/runit/errorlogs/run index e4053dab9e..45ab0ed313 100755 --- a/runit/errorlogs/run +++ b/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 16285366db82aa708be72abd3453c6353ed650f8 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 10 Nov 2017 14:15:22 +0000 Subject: [PATCH 141/177] add option to bypass percentage-based rollouts --- settings.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.coffee b/settings.coffee index 01614eae00..37bb88a18a 100644 --- a/settings.coffee +++ b/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 51d59f20b0d6135fe3a2a3dca0e8b2b88ec7efe7 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 5 Dec 2017 09:48:05 +0000 Subject: [PATCH 142/177] move contacts run file --- runit/{contacts-sharelatex.sh => contacts-sharelatex/run} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename runit/{contacts-sharelatex.sh => contacts-sharelatex/run} (100%) diff --git a/runit/contacts-sharelatex.sh b/runit/contacts-sharelatex/run similarity index 100% rename from runit/contacts-sharelatex.sh rename to runit/contacts-sharelatex/run From 2761615440990a21b298193afee9a1b084a4e448 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 6 Dec 2017 11:21:54 +0000 Subject: [PATCH 143/177] Pin contacts to branch 'sk-update-mongojs' --- services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services.js b/services.js index b79ab9a4b7..941dd23a0e 100644 --- a/services.js +++ b/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 16b5c5dd1a5d587cc39bc2dc5ff602b1dc509942 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 8 Jan 2018 16:21:18 +0000 Subject: [PATCH 144/177] Chown the sharelatex directory to www-data --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7593c726f7..36ad4e19c2 100644 --- a/Dockerfile +++ b/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 d5338b57196ea9dcaaf352a5d26665ea0cb210f8 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 22 Jan 2018 14:47:00 +0000 Subject: [PATCH 145/177] Pin version of simple-git --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d3c19d112f..9a8f125940 100644 --- a/package.json +++ b/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 f18a0498a90bb5ac1d996e6fc1fac9376aaf7bca Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 26 Jan 2018 09:43:43 +0000 Subject: [PATCH 146/177] added trackChanges into features --- settings.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 37bb88a18a..7f4f18067f 100644 --- a/settings.coffee +++ b/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 3c4866a710523f08b4eb16b7ef1f77fadd1dc3e7 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 6 Feb 2018 10:26:29 +0000 Subject: [PATCH 147/177] Change launchpad location to github --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 36ad4e19c2..881d48cfe6 100644 --- a/Dockerfile +++ b/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 03d6d80fdb13a6528fae8c5a084a75a8faf10c69 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 19 Feb 2019 10:20:17 +0000 Subject: [PATCH 148/177] Update the readme with a short explanation of how this code works --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8e5cd84b8e..53a770d328 100644 --- a/README.md +++ b/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 e3590379581699e197590aae285880f42a643df2 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 1 Mar 2019 11:16:12 +0000 Subject: [PATCH 149/177] remove bit from readme --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 53a770d328..ed5cd3a91f 100644 --- a/README.md +++ b/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 32cb10a602503885611c93d4471d3dbb62cf3630 Mon Sep 17 00:00:00 2001 From: mserranom Date: Wed, 7 Aug 2019 08:47:05 +0000 Subject: [PATCH 150/177] Revive overleaf community --- Dockerfile | 89 ++++++++++++++++++++++------------ Dockerfile-base | 48 +++++++++++++----- runit/real-time-sharelatex/run | 2 +- settings.coffee | 4 +- 4 files changed, 98 insertions(+), 45 deletions(-) diff --git a/Dockerfile b/Dockerfile index 881d48cfe6..c527411457 100644 --- a/Dockerfile +++ b/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/Dockerfile-base b/Dockerfile-base index a59431fc9d..f1a7e22531 100644 --- a/Dockerfile-base +++ b/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/runit/real-time-sharelatex/run b/runit/real-time-sharelatex/run index c57d1d489e..7168368c38 100755 --- a/runit/real-time-sharelatex/run +++ b/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/settings.coffee b/settings.coffee index 7f4f18067f..92a545eac7 100644 --- a/settings.coffee +++ b/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 5a4669acbc0c3607375f12eeffcf6271c20a24ca Mon Sep 17 00:00:00 2001 From: mserranom Date: Wed, 7 Aug 2019 08:52:55 +0000 Subject: [PATCH 151/177] added missing aspell languages --- Dockerfile-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile-base b/Dockerfile-base index f1a7e22531..2f88946bdd 100644 --- a/Dockerfile-base +++ b/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 52a6e46cddb20eb34401fee50b74c2655466f222 Mon Sep 17 00:00:00 2001 From: mserranom Date: Thu, 8 Aug 2019 10:44:14 +0000 Subject: [PATCH 152/177] addressed PR comments --- .editorconfig | 9 +++++++++ Dockerfile-base | 23 +++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..9d08a1a828 --- /dev/null +++ b/.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/Dockerfile-base b/Dockerfile-base index 2f88946bdd..aed92b21b8 100644 --- a/Dockerfile-base +++ b/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 f4d0e0a47da4d4d9039b813360a3282839d7e4cb Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 20 Aug 2019 10:50:23 +0200 Subject: [PATCH 153/177] Run filestore with node6 (#108) --- runit/filestore-sharelatex/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runit/filestore-sharelatex/run b/runit/filestore-sharelatex/run index e0858c01ce..1ba126dda0 100755 --- a/runit/filestore-sharelatex/run +++ b/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 8cf70ce7f1a298c984a7dc92c73a4f90532976b9 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 22 Aug 2019 16:57:26 +0200 Subject: [PATCH 154/177] Server Pro fixes (#109) --- .dockerignore | 3 + .gitignore | 1 + Dockerfile-base | 12 +++- README.md | 21 ++++--- settings.coffee | 144 +----------------------------------------------- 5 files changed, 27 insertions(+), 154 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..fd3df9c73e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.DS_Store +.git/ +node_modules/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 023b43469e..877b99b865 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store node_modules/ api-data versions/ diff --git a/Dockerfile-base b/Dockerfile-base index aed92b21b8..f56136fd87 100644 --- a/Dockerfile-base +++ b/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/README.md b/README.md index ed5cd3a91f..c1894afce0 100644 --- a/README.md +++ b/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/settings.coffee b/settings.coffee index 92a545eac7..b8259b96ed 100644 --- a/settings.coffee +++ b/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 ad6d81a8cc25839a9dbe97274d0b5dff06600eb0 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 3 Sep 2019 11:36:39 +0200 Subject: [PATCH 155/177] Updated settings to serve minified assets (#110) --- settings.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/settings.coffee b/settings.coffee index b8259b96ed..89fc442d64 100644 --- a/settings.coffee +++ b/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 38291a364e97f731a2624859816fa6204a29c3d7 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Wed, 4 Sep 2019 16:39:47 +0200 Subject: [PATCH 156/177] Updated settings with several fixes (#111) --- settings.coffee | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/settings.coffee b/settings.coffee index 89fc442d64..96970b8bb1 100644 --- a/settings.coffee +++ b/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 6cc98a80394d3b90c9623c39dcdeca4b84ed2c04 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Fri, 6 Sep 2019 10:37:03 +0200 Subject: [PATCH 157/177] Override v1.url setting with "" instead of null (#112) --- settings.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.coffee b/settings.coffee index 96970b8bb1..fb930628a1 100644 --- a/settings.coffee +++ b/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 ece429d9b0723f07b215c69f900e055b619fafad Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 10 Sep 2019 17:13:17 +0200 Subject: [PATCH 158/177] Added debugging support to services (#113) --- .dockerignore | 2 +- Dockerfile-base | 2 +- runit/chat-sharelatex/run | 9 ++++++++- runit/clsi-sharelatex/run | 9 ++++++++- runit/contacts-sharelatex/run | 9 ++++++++- runit/docstore-sharelatex/run | 9 ++++++++- runit/document-updater-sharelatex/run | 9 ++++++++- runit/notifications-sharelatex/run | 9 ++++++++- runit/real-time-sharelatex/run | 2 +- runit/spelling-sharelatex/run | 9 ++++++++- runit/tags-sharelatex/run | 9 ++++++++- runit/track-changes-sharelatex/run | 9 ++++++++- runit/web-sharelatex/run | 9 ++++++++- settings.coffee | 28 +++++++++++++-------------- 14 files changed, 97 insertions(+), 27 deletions(-) diff --git a/.dockerignore b/.dockerignore index fd3df9c73e..2a5c59398a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ .DS_Store .git/ -node_modules/ \ No newline at end of file +node_modules/ diff --git a/Dockerfile-base b/Dockerfile-base index f56136fd87..2cff8a830f 100644 --- a/Dockerfile-base +++ b/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/runit/chat-sharelatex/run b/runit/chat-sharelatex/run index 1b8533bb86..cc5f75057f 100755 --- a/runit/chat-sharelatex/run +++ b/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/runit/clsi-sharelatex/run b/runit/clsi-sharelatex/run index 1c6974cd2a..7492acf6d1 100755 --- a/runit/clsi-sharelatex/run +++ b/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/runit/contacts-sharelatex/run b/runit/contacts-sharelatex/run index 29b513cb97..e220d9ac1d 100755 --- a/runit/contacts-sharelatex/run +++ b/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/runit/docstore-sharelatex/run b/runit/docstore-sharelatex/run index 0de82ccf20..2a171f0968 100755 --- a/runit/docstore-sharelatex/run +++ b/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/runit/document-updater-sharelatex/run b/runit/document-updater-sharelatex/run index 274b7f9998..51472b3d48 100755 --- a/runit/document-updater-sharelatex/run +++ b/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/runit/notifications-sharelatex/run b/runit/notifications-sharelatex/run index 12b3457f2c..89f8ad54f9 100755 --- a/runit/notifications-sharelatex/run +++ b/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/runit/real-time-sharelatex/run b/runit/real-time-sharelatex/run index 7168368c38..1d00837def 100755 --- a/runit/real-time-sharelatex/run +++ b/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/runit/spelling-sharelatex/run b/runit/spelling-sharelatex/run index 4466bcfcf5..a9a73f8ae0 100755 --- a/runit/spelling-sharelatex/run +++ b/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/runit/tags-sharelatex/run b/runit/tags-sharelatex/run index a5630ed4ff..62fe058ad9 100755 --- a/runit/tags-sharelatex/run +++ b/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/runit/track-changes-sharelatex/run b/runit/track-changes-sharelatex/run index aeb812ef38..45b3b77ebc 100755 --- a/runit/track-changes-sharelatex/run +++ b/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/runit/web-sharelatex/run b/runit/web-sharelatex/run index 053a55a326..c1371de0f4 100755 --- a/runit/web-sharelatex/run +++ b/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/settings.coffee b/settings.coffee index fb930628a1..3cb6a510b9 100644 --- a/settings.coffee +++ b/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 41ba0063bcb24245400777880b058e09c550d4ba Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 24 Sep 2019 11:52:38 +0100 Subject: [PATCH 159/177] Copy logic from clsi entrypoint, to set permissions on docker.sock --- runit/clsi-sharelatex/run | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runit/clsi-sharelatex/run b/runit/clsi-sharelatex/run index 7492acf6d1..539e5f2239 100755 --- a/runit/clsi-sharelatex/run +++ b/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 4b0ea96b551ae01d95e0c97f2e9c55b69cef3e23 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 8 Oct 2019 11:54:49 +0200 Subject: [PATCH 160/177] Delete aggregated error log (#117) --- runit/errorlogs/run | 2 -- 1 file changed, 2 deletions(-) delete mode 100755 runit/errorlogs/run diff --git a/runit/errorlogs/run b/runit/errorlogs/run deleted file mode 100755 index 45ab0ed313..0000000000 --- a/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 fe5cdef39c5fb10f3eeacc294a76bb6beb11a4a7 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 8 Oct 2019 12:47:08 +0200 Subject: [PATCH 161/177] Linked CLSI synctext to /opts/synctex (#118) --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index c527411457..d3a6e69e29 100644 --- a/Dockerfile +++ b/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 1c57b1deaba52155bf2af7f539888668f247f399 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 15 Oct 2019 11:00:38 +0200 Subject: [PATCH 162/177] Disable project-history via settings (#125) --- settings.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/settings.coffee b/settings.coffee index 3cb6a510b9..8a3cd1af1c 100644 --- a/settings.coffee +++ b/settings.coffee @@ -200,6 +200,8 @@ settings = # is not available v1: url: "" + project_history: + enabled: false references:{} notifications:undefined From 12c18f76fdbb1ebd1b4832eccc11b9f1bfd3b8fb Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Mon, 21 Oct 2019 11:48:01 +0200 Subject: [PATCH 163/177] Overleaf CE Hotfix 2.0.1 (#126) --- 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 hotfix/2.0.1/Dockerfile create mode 100644 hotfix/2.0.1/create_and_destroy_users.patch create mode 100644 hotfix/2.0.1/disable_project_history.patch diff --git a/hotfix/2.0.1/Dockerfile b/hotfix/2.0.1/Dockerfile new file mode 100644 index 0000000000..12a85378b4 --- /dev/null +++ b/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/hotfix/2.0.1/create_and_destroy_users.patch b/hotfix/2.0.1/create_and_destroy_users.patch new file mode 100644 index 0000000000..bb2dc16898 --- /dev/null +++ b/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/hotfix/2.0.1/disable_project_history.patch b/hotfix/2.0.1/disable_project_history.patch new file mode 100644 index 0000000000..830570abbe --- /dev/null +++ b/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 f92c6c27b03effc6aaae8aa77633b9ec492e3f57 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 21 Nov 2019 11:52:02 +0100 Subject: [PATCH 164/177] Remove overriden v1 settings (#128) --- settings.coffee | 4 ---- 1 file changed, 4 deletions(-) diff --git a/settings.coffee b/settings.coffee index 8a3cd1af1c..922fb32c04 100644 --- a/settings.coffee +++ b/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 ef8f099b10971fb77166c0fae903c0c73e3a2ca1 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Fri, 22 Nov 2019 10:12:33 +0100 Subject: [PATCH 165/177] Copy synctex executable to docker host (#129) --- runit/clsi-sharelatex/run | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/runit/clsi-sharelatex/run b/runit/clsi-sharelatex/run index 539e5f2239..c1469b6cfe 100755 --- a/runit/clsi-sharelatex/run +++ b/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 5e17a4c9283d6b6b860a78785179710499b9055e Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 10 Dec 2019 15:06:40 +0100 Subject: [PATCH 166/177] Hotfix 2.0.2 (#130) --- hotfix/2.0.2/1-anon-upload.patch | 60 ++++++++++++++++++++++++ hotfix/2.0.2/2-read-only-access.patch | 11 +++++ hotfix/2.0.2/3-url-linking-1.patch | 11 +++++ 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 ++++ hotfix/2.0.2/Dockerfile | 31 ++++++++++++ 7 files changed, 169 insertions(+) create mode 100644 hotfix/2.0.2/1-anon-upload.patch create mode 100644 hotfix/2.0.2/2-read-only-access.patch create mode 100644 hotfix/2.0.2/3-url-linking-1.patch create mode 100644 hotfix/2.0.2/4-url-linking-2.patch create mode 100644 hotfix/2.0.2/5-disable-analytics-1.patch create mode 100644 hotfix/2.0.2/6-disable-analytics-2.patch create mode 100644 hotfix/2.0.2/Dockerfile diff --git a/hotfix/2.0.2/1-anon-upload.patch b/hotfix/2.0.2/1-anon-upload.patch new file mode 100644 index 0000000000..75037901e0 --- /dev/null +++ b/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/hotfix/2.0.2/2-read-only-access.patch b/hotfix/2.0.2/2-read-only-access.patch new file mode 100644 index 0000000000..246cc3e04d --- /dev/null +++ b/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/hotfix/2.0.2/3-url-linking-1.patch b/hotfix/2.0.2/3-url-linking-1.patch new file mode 100644 index 0000000000..173809842f --- /dev/null +++ b/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/hotfix/2.0.2/4-url-linking-2.patch b/hotfix/2.0.2/4-url-linking-2.patch new file mode 100644 index 0000000000..587a8e6e0f --- /dev/null +++ b/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/hotfix/2.0.2/5-disable-analytics-1.patch b/hotfix/2.0.2/5-disable-analytics-1.patch new file mode 100644 index 0000000000..198ee03935 --- /dev/null +++ b/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/hotfix/2.0.2/6-disable-analytics-2.patch b/hotfix/2.0.2/6-disable-analytics-2.patch new file mode 100644 index 0000000000..9fb41c1cba --- /dev/null +++ b/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/hotfix/2.0.2/Dockerfile b/hotfix/2.0.2/Dockerfile new file mode 100644 index 0000000000..7a75ed97a5 --- /dev/null +++ b/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 17bfbee183d281f5c1e2834721665922661a5f4f Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 9 Jan 2020 15:55:57 +0100 Subject: [PATCH 167/177] Added environment variables for web-api user/pass (#131) --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index d3a6e69e29..3fcfb509f6 100644 --- a/Dockerfile +++ b/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 bb3485016e8900fcf7263d211484c79f53155f3b Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 21 Jan 2020 12:37:40 +0100 Subject: [PATCH 168/177] Added missing recaptcha configuration (#132) --- hotfix/2.1.1/Dockerfile | 8 ++++++++ hotfix/2.1.1/add-recaptcha-config.patch | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 hotfix/2.1.1/Dockerfile create mode 100644 hotfix/2.1.1/add-recaptcha-config.patch diff --git a/hotfix/2.1.1/Dockerfile b/hotfix/2.1.1/Dockerfile new file mode 100644 index 0000000000..313c596545 --- /dev/null +++ b/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/hotfix/2.1.1/add-recaptcha-config.patch b/hotfix/2.1.1/add-recaptcha-config.patch new file mode 100644 index 0000000000..cdca537c46 --- /dev/null +++ b/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 df2d46df829872ccd6d9018dac3f2e6d9b9ae8d0 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 22 Jan 2020 17:40:47 +0100 Subject: [PATCH 169/177] [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. --- Dockerfile | 4 ++-- git-revision.js | 22 ---------------------- git-revision.sh | 6 ++++++ 3 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 git-revision.js create mode 100755 git-revision.sh diff --git a/Dockerfile b/Dockerfile index 3fcfb509f6..db3c98a793 100644 --- a/Dockerfile +++ b/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/git-revision.js b/git-revision.js deleted file mode 100644 index 89359cea2e..0000000000 --- a/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/git-revision.sh b/git-revision.sh new file mode 100755 index 0000000000..e26f75bfd4 --- /dev/null +++ b/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 3781585862f8c6fd613bc2fe48634aeba53a163d Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Tue, 28 Jan 2020 07:16:23 +0100 Subject: [PATCH 170/177] Set CRYPTO_RANDOM as environment variable at startup time (#134) --- Dockerfile | 2 -- init_scripts/00_regen_sharelatex_secrets.sh | 22 ++++++++++++++++----- settings.coffee | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index db3c98a793..48c14a26ff 100644 --- a/Dockerfile +++ b/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/init_scripts/00_regen_sharelatex_secrets.sh b/init_scripts/00_regen_sharelatex_secrets.sh index 80fd293260..695ca66f78 100755 --- a/init_scripts/00_regen_sharelatex_secrets.sh +++ b/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/settings.coffee b/settings.coffee index 922fb32c04..32e2b3ba81 100644 --- a/settings.coffee +++ b/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 f2ee88054984aab3a92e188d7f3e6324808a2bc8 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 29 Jan 2020 12:14:32 +0100 Subject: [PATCH 171/177] [misc] narrow down the rw accessible directories for the run user (#119) --- Dockerfile | 7 +------ init_scripts/00_make_sharelatex_data_dirs.sh | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 48c14a26ff..f00b6da4d1 100644 --- a/Dockerfile +++ b/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/init_scripts/00_make_sharelatex_data_dirs.sh b/init_scripts/00_make_sharelatex_data_dirs.sh index 7857b984fb..6085a087da 100755 --- a/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/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 5c9a56d906a53af2cd87040705ccbb42bf873f3e Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 6 Feb 2020 11:19:15 +0100 Subject: [PATCH 172/177] Removed node6 and updated modules to Node 10 (#135) --- Dockerfile-base | 9 --------- runit/filestore-sharelatex/run | 2 +- runit/real-time-sharelatex/run | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Dockerfile-base b/Dockerfile-base index 2cff8a830f..14b9550ed1 100644 --- a/Dockerfile-base +++ b/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/runit/filestore-sharelatex/run b/runit/filestore-sharelatex/run index 1ba126dda0..4237a38793 100755 --- a/runit/filestore-sharelatex/run +++ b/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/runit/real-time-sharelatex/run b/runit/real-time-sharelatex/run index 1d00837def..ad005b624c 100755 --- a/runit/real-time-sharelatex/run +++ b/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 5e0f94f4044a02f650c9e348432a85929489be84 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 11:56:03 +0100 Subject: [PATCH 173/177] [settings] produce a consistent redis config for every service (#124) Signed-off-by: Jakob Ackermann --- settings.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/settings.coffee b/settings.coffee index 32e2b3ba81..9d6b31206c 100644 --- a/settings.coffee +++ b/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 e422c20e745501671a8ab529dd413060741de420 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 11:59:20 +0100 Subject: [PATCH 174/177] [nginx] simplify the root specification for sendfile (#121) Signed-off-by: Jakob Ackermann --- nginx/sharelatex.conf | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nginx/sharelatex.conf b/nginx/sharelatex.conf index cf63f4c5c4..3a10a999f0 100644 --- a/nginx/sharelatex.conf +++ b/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 47e51a2075f63ce3d14d9978e8492e7184bdea86 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 12:00:03 +0100 Subject: [PATCH 175/177] [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 --- Dockerfile | 1 - Dockerfile-base | 78 ++++++++++++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/Dockerfile b/Dockerfile index f00b6da4d1..c6e16aec97 100644 --- a/Dockerfile +++ b/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/Dockerfile-base b/Dockerfile-base index 14b9550ed1..9f1ef5b913 100644 --- a/Dockerfile-base +++ b/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 e83b7856c324218e866b6f9e7efd80067a4ed4a6 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 13:33:56 +0100 Subject: [PATCH 176/177] [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 --- init_scripts/00_make_sharelatex_data_dirs.sh | 2 ++ init_scripts/00_regen_sharelatex_secrets.sh | 3 ++- init_scripts/00_set_docker_host_ipaddress.sh | 6 ++++-- init_scripts/98_check_db_access.sh | 2 ++ init_scripts/99_migrate.sh | 2 ++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/init_scripts/00_make_sharelatex_data_dirs.sh b/init_scripts/00_make_sharelatex_data_dirs.sh index 6085a087da..0d7c643733 100755 --- a/init_scripts/00_make_sharelatex_data_dirs.sh +++ b/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/init_scripts/00_regen_sharelatex_secrets.sh b/init_scripts/00_regen_sharelatex_secrets.sh index 695ca66f78..365be0869f 100755 --- a/init_scripts/00_regen_sharelatex_secrets.sh +++ b/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/init_scripts/00_set_docker_host_ipaddress.sh b/init_scripts/00_set_docker_host_ipaddress.sh index afd31b69a1..0587a9b222 100755 --- a/init_scripts/00_set_docker_host_ipaddress.sh +++ b/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/init_scripts/98_check_db_access.sh b/init_scripts/98_check_db_access.sh index a90adba84f..f8507f582f 100755 --- a/init_scripts/98_check_db_access.sh +++ b/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/init_scripts/99_migrate.sh b/init_scripts/99_migrate.sh index d062496581..f880fa816f 100755 --- a/init_scripts/99_migrate.sh +++ b/init_scripts/99_migrate.sh @@ -1,4 +1,6 @@ #!/bin/sh +set -e + which node which grunt ls -al /var/www/sharelatex/migrations From ebd31737a5754a7dccc200ab696ab411b4686d4f Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 13 Feb 2020 16:38:58 +0100 Subject: [PATCH 177/177] [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 --- Dockerfile | 59 ++++++++++++++++++++++++++++------------------------ package.json | 13 ------------ 2 files changed, 32 insertions(+), 40 deletions(-) delete mode 100644 package.json diff --git a/Dockerfile b/Dockerfile index c6e16aec97..3d79194f14 100644 --- a/Dockerfile +++ b/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/package.json b/package.json deleted file mode 100644 index 9a8f125940..0000000000 --- a/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" - } -}