Loading 00_make_sharelatex_data_dirs.sh 0 → 100755 +22 −0 Original line number Diff line number Diff line #!/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 00_regen_sharelatex_secrets.sh 0 → 100755 +7 −0 Original line number Diff line number Diff line #!/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 Dockerfile 0 → 100644 +82 −0 Original line number Diff line number Diff line 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 README.md 0 → 100644 +71 −0 Original line number Diff line number Diff line 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 nginx/nginx.conf 0 → 100644 +74 −0 Original line number Diff line number Diff line 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/*; } Loading
00_make_sharelatex_data_dirs.sh 0 → 100755 +22 −0 Original line number Diff line number Diff line #!/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
00_regen_sharelatex_secrets.sh 0 → 100755 +7 −0 Original line number Diff line number Diff line #!/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
Dockerfile 0 → 100644 +82 −0 Original line number Diff line number Diff line 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
README.md 0 → 100644 +71 −0 Original line number Diff line number Diff line 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
nginx/nginx.conf 0 → 100644 +74 −0 Original line number Diff line number Diff line 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/*; }