mirror of
https://github.com/overleaf/overleaf.git
synced 2025-12-17 02:10:43 +00:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2ad040e08 | ||
|
|
a3bee00bdc | ||
|
|
afb7fd6d16 | ||
|
|
6aa2446eea | ||
|
|
0980b2e6dc | ||
|
|
1e073da1fd | ||
|
|
feafbb5416 | ||
|
|
e3b3b85726 | ||
|
|
ce10ceb2d9 | ||
|
|
dae47efa1c | ||
|
|
5dd40dc7cb | ||
|
|
5ea12c3de8 | ||
|
|
16ba8acfca | ||
|
|
4f4981b92b | ||
|
|
e9ec1b6316 | ||
|
|
16e6777d89 | ||
|
|
1ff5f683e0 | ||
|
|
c96d713310 | ||
|
|
9d6a2b1434 | ||
|
|
21199de254 | ||
|
|
e631902376 | ||
|
|
a2a2c23f76 | ||
|
|
4a19804aa9 | ||
|
|
2a03e4822d |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,3 +1,13 @@
|
||||
v0.1.4
|
||||
------
|
||||
|
||||
* Move to a private registration scheme where users must be added by an admin.
|
||||
* Proxy websockets connection through web to real-time service so no websocketsUrl parameter is needed.
|
||||
* Use worker aspell processes in spelling to prevent excessing forking.
|
||||
* Properly clean up after long running ImageMagick conversions in the filestore.
|
||||
* Allow a configurable app name and email contact address.
|
||||
* Switch to new PDF viewer with partial page loading for immediate preview of visible page.
|
||||
|
||||
v0.1.3
|
||||
------
|
||||
|
||||
|
||||
114
Gruntfile.coffee
114
Gruntfile.coffee
@@ -13,43 +13,43 @@ settings = require("settings-sharelatex")
|
||||
SERVICES = [{
|
||||
name: "web"
|
||||
repo: "https://github.com/sharelatex/web-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "real-time"
|
||||
repo: "https://github.com/sharelatex/real-time-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "document-updater"
|
||||
repo: "https://github.com/sharelatex/document-updater-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "clsi"
|
||||
repo: "https://github.com/sharelatex/clsi-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "filestore"
|
||||
repo: "https://github.com/sharelatex/filestore-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "track-changes"
|
||||
repo: "https://github.com/sharelatex/track-changes-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "docstore"
|
||||
repo: "https://github.com/sharelatex/docstore-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "chat"
|
||||
repo: "https://github.com/sharelatex/chat-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "tags"
|
||||
repo: "https://github.com/sharelatex/tags-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}, {
|
||||
name: "spelling"
|
||||
repo: "https://github.com/sharelatex/spelling-sharelatex.git"
|
||||
version: "v0.1.3"
|
||||
version: "v0.2.0"
|
||||
}]
|
||||
|
||||
module.exports = (grunt) ->
|
||||
@@ -161,13 +161,11 @@ module.exports = (grunt) ->
|
||||
Helpers.checkMake @async()
|
||||
grunt.registerTask "check", "Check that you have the required dependencies installed", ["check:redis", "check:latexmk", "check:s3", "check:fs", "check:aspell"]
|
||||
|
||||
grunt.registerTask "build:deb", "Build an installable .deb file from the current directory", () ->
|
||||
Helpers.buildDeb @async()
|
||||
grunt.registerTask "build:upstart_scripts", "Create upstart scripts for each service", () ->
|
||||
Helpers.buildUpstartScripts()
|
||||
|
||||
|
||||
#grunt.registerTask 'migrate', "compile migrations and run them", ['coffee:migrate', 'shell:migrate']
|
||||
grunt.registerTask 'migrate', "compile migrations and run them", ['coffee:migrate', 'shell:migrate']
|
||||
|
||||
|
||||
Helpers =
|
||||
@@ -457,93 +455,7 @@ module.exports = (grunt) ->
|
||||
return callback()
|
||||
|
||||
buildUpstartScripts: () ->
|
||||
template = fs.readFileSync("package/upstart/sharelatex-template").toString()
|
||||
template = fs.readFileSync("package/upstart/sharelatex-template.conf").toString()
|
||||
for service in SERVICES
|
||||
fs.writeFileSync "package/upstart/sharelatex-#{service.name}", template.replace(/__SERVICE__/g, service.name)
|
||||
|
||||
buildPackageSettingsFile: () ->
|
||||
config = fs.readFileSync("config/settings.development.coffee.example").toString()
|
||||
config = config.replace /DATA_DIR.*/, "DATA_DIR = '/var/lib/sharelatex/data'"
|
||||
config = config.replace /TMP_DIR.*/, "TMP_DIR = '/var/lib/sharelatex/tmp'"
|
||||
fs.writeFileSync "package/config/settings.coffee", config
|
||||
|
||||
buildDeb: (callback = (error) ->) ->
|
||||
command = ["-s", "dir", "-t", "deb", "-n", "sharelatex", "-v", "0.0.1", "--verbose"]
|
||||
command.push(
|
||||
"--maintainer", "ShareLaTeX <team@sharelatex.com>"
|
||||
"--config-files", "/etc/sharelatex/settings.coffee"
|
||||
"--config-files", "/etc/nginx/conf.d/sharelatex.conf"
|
||||
"--directories", "/var/lib/sharelatex"
|
||||
"--directories", "/var/log/sharelatex"
|
||||
)
|
||||
|
||||
command.push(
|
||||
"--depends", "redis-server > 2.6.12"
|
||||
"--depends", "mongodb-org > 2.4.0"
|
||||
"--depends", "nodejs > 0.10.0"
|
||||
)
|
||||
|
||||
@buildPackageSettingsFile()
|
||||
|
||||
@buildUpstartScripts()
|
||||
for service in SERVICES
|
||||
command.push(
|
||||
"--deb-upstart", "package/upstart/sharelatex-#{service.name}"
|
||||
)
|
||||
|
||||
after_install_script = """
|
||||
#!/bin/sh
|
||||
# Create random secret keys (twice, once for http auth pass, once for cookie secret).
|
||||
sed -i "0,/CRYPTO_RANDOM/s/CRYPTO_RANDOM/$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 64 | head -n 1)/" /etc/sharelatex/settings.coffee
|
||||
sed -i "0,/CRYPTO_RANDOM/s/CRYPTO_RANDOM/$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 64 | head -n 1)/" /etc/sharelatex/settings.coffee
|
||||
|
||||
sudo adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex
|
||||
|
||||
mkdir -p /var/log/sharelatex
|
||||
chown sharelatex:sharelatex /var/log/sharelatex
|
||||
|
||||
mkdir -p /var/lib/sharelatex
|
||||
|
||||
"""
|
||||
|
||||
for dir in ["data/user_files", "tmp/uploads", "data/compiles", "data/cache", "tmp/dumpFolder"]
|
||||
after_install_script += """
|
||||
mkdir -p /var/lib/sharelatex/#{dir}
|
||||
|
||||
"""
|
||||
|
||||
after_install_script += """
|
||||
chown -R sharelatex:sharelatex /var/lib/sharelatex
|
||||
|
||||
"""
|
||||
|
||||
for service in SERVICES
|
||||
after_install_script += "service sharelatex-#{service.name} restart\n"
|
||||
fs.writeFileSync "package/scripts/after_install.sh", after_install_script
|
||||
command.push("--after-install", "package/scripts/after_install.sh")
|
||||
|
||||
command.push("--exclude", "**/.git")
|
||||
command.push("--exclude", "**/node_modules/grunt-*")
|
||||
for path in ["filestore/user_files", "filestore/uploads", "clsi/cache", "clsi/compiles"]
|
||||
command.push "--exclude", path
|
||||
|
||||
for service in SERVICES
|
||||
command.push "#{service.name}=/var/www/sharelatex/"
|
||||
|
||||
command.push(
|
||||
"package/config/settings.coffee=/etc/sharelatex/settings.coffee"
|
||||
"package/nginx/sharelatex=/etc/nginx/conf.d/sharelatex.conf"
|
||||
)
|
||||
console.log "fpm " + command.join(" ")
|
||||
proc = spawn "fpm", command, stdio: "inherit"
|
||||
proc.on "close", (code) ->
|
||||
if code != 0
|
||||
callback(new Error("exit code: #{code}"))
|
||||
else
|
||||
callback()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
fs.writeFileSync "package/upstart/sharelatex-#{service.name}.conf", template.replace(/__SERVICE__/g, service.name)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ Dependencies
|
||||
|
||||
ShareLaTeX should run on OS X and Linux. You need:
|
||||
|
||||
* [Node.js](http://nodejs.org/) 0.10 or greater. We recommend that you use [nvm](https://github.com/creationix/nvm) to install it.
|
||||
* [Node.js](http://nodejs.org/) 0.10.x. We recommend that you use [nvm](https://github.com/creationix/nvm) to install it.
|
||||
* The [grunt](http://gruntjs.com/) command line tools (Run `npm install -g grunt-cli` to install them)
|
||||
* A local instance of [Redis](http://redis.io/topics/quickstart) (version 2.6.12 or later) and [MongoDB](http://docs.mongodb.org/manual/installation/) running on their standard ports.
|
||||
* [TeXLive](https://www.tug.org/texlive/) 2013 or later with the `latexmk` program installed.
|
||||
|
||||
@@ -63,13 +63,13 @@ module.exports =
|
||||
# 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"
|
||||
#filestore:
|
||||
# backend: "s3"
|
||||
# stores:
|
||||
# user_files: "BUCKET_NAME"
|
||||
# s3:
|
||||
# key: "AWS_KEY"
|
||||
# secret: "AWS_SECRET"
|
||||
#
|
||||
|
||||
# Local disk caching
|
||||
@@ -164,34 +164,37 @@ module.exports =
|
||||
# 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:
|
||||
#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"
|
||||
# host: "localhost"
|
||||
# realTime:
|
||||
# port: realTimeport = 3026
|
||||
# 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:
|
||||
@@ -200,22 +203,22 @@ module.exports =
|
||||
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}"
|
||||
# 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,
|
||||
|
||||
@@ -139,7 +139,7 @@ processNext = (project_id, callback)->
|
||||
markProjectAsProcessed project_id, (err)->
|
||||
setTimeout(
|
||||
-> callback(err)
|
||||
,500)
|
||||
,0)
|
||||
|
||||
|
||||
|
||||
184
migrations/2_doc_lines_delete_from_project.coffee
Normal file
184
migrations/2_doc_lines_delete_from_project.coffee
Normal file
@@ -0,0 +1,184 @@
|
||||
Settings = require "settings-sharelatex"
|
||||
fs = require("fs")
|
||||
mongojs = require("mongojs")
|
||||
ObjectId = mongojs.ObjectId
|
||||
db = mongojs(Settings.mongo.url, ['projects', 'docs'])
|
||||
_ = require("lodash")
|
||||
async = require("async")
|
||||
exec = require("child_process").exec
|
||||
|
||||
finished_projects_path = "/tmp/finished-projects-2"
|
||||
all_projects_path = "/tmp/all-projects-2"
|
||||
unmigrated_docs_path = "/tmp/unmigrated-2"
|
||||
|
||||
|
||||
printProgress = ->
|
||||
exec "wc #{finished_projects_path}", (error, results) ->
|
||||
setTimeout printProgress, 1000 * 30
|
||||
|
||||
checkIfFileHasBeenProccessed = (project_id, callback)->
|
||||
exec "grep #{project_id} #{finished_projects_path}", (error, results) ->
|
||||
hasBeenProcessed = _.include(results, project_id)
|
||||
callback(error, hasBeenProcessed)
|
||||
|
||||
loadProjectIds = (callback)->
|
||||
console.log "loading project ids from #{all_projects_path}"
|
||||
fs.readFile all_projects_path, "utf-8", (err, data)->
|
||||
ids = data.split("\n")
|
||||
console.log "loaded #{ids.length} project ids from #{all_projects_path}"
|
||||
callback err, ids
|
||||
|
||||
getAndWriteProjectids = (callback)->
|
||||
console.log "finding all project id's - #{new Date().toString()}"
|
||||
db.projects.find {}, {_id:1}, (err, ids)->
|
||||
console.log "total found projects in mongo #{ids.length} - #{new Date().toString()}"
|
||||
ids = _.pluck ids, '_id'
|
||||
ids = _.filter ids, (id)-> id?
|
||||
fileData = ids.join("\n")
|
||||
fs.writeFile all_projects_path, fileData, ->
|
||||
callback(err, ids)
|
||||
|
||||
markDocAsUnmigrated = (project_id, doc_id, callback)->
|
||||
console.log "#{project_id} #{doc_id} unmigrated"
|
||||
markProjectAsProcessed project_id, (err)->
|
||||
fs.appendFile unmigrated_docs_path, "#{project_id} #{doc_id}\n", callback
|
||||
|
||||
markUnmigratedDocs = (project_id, docs, callback)->
|
||||
console.log docs.length, project_id, "unmigrated"
|
||||
jobs = _.map docs, (doc)->
|
||||
(cb)->
|
||||
markDocAsUnmigrated project_id, doc._id, cb
|
||||
async.series jobs, callback
|
||||
|
||||
getProjectIds = (callback)->
|
||||
exists = fs.existsSync all_projects_path
|
||||
if exists
|
||||
loadProjectIds callback
|
||||
else
|
||||
getAndWriteProjectids callback
|
||||
|
||||
markProjectAsProcessed = (project_id, callback)->
|
||||
fs.appendFile finished_projects_path, "#{project_id}\n", callback
|
||||
|
||||
getAllDocs = (project_id, callback = (error, docs) ->) ->
|
||||
excludes = {}
|
||||
for i in [0..12]
|
||||
excludes["rootFolder#{Array(i).join(".folders")}.docs.lines"] = 0
|
||||
db.projects.findOne _id: ObjectId(project_id.toString()), excludes, (error, project) ->
|
||||
return callback(error) if error?
|
||||
if !project?
|
||||
console.log "no such project #{project_id}"
|
||||
return callback()
|
||||
findAllDocsInProject project, (error, docs) ->
|
||||
return callback(error) if error?
|
||||
return callback null, docs, project
|
||||
|
||||
findAllDocsInProject = (project, callback = (error, docs) ->) ->
|
||||
callback null, _findAllDocsInFolder project.rootFolder[0]
|
||||
|
||||
findDocInProject = (project, doc_id, callback = (error, doc, mongoPath) ->) ->
|
||||
result = _findDocInFolder project.rootFolder[0], doc_id, "rootFolder.0"
|
||||
if result?
|
||||
callback null, result.doc, result.mongoPath
|
||||
else
|
||||
callback null, null, null
|
||||
|
||||
_findDocInFolder = (folder = {}, doc_id, currentPath) ->
|
||||
for doc, i in folder.docs or []
|
||||
if doc?._id? and doc._id.toString() == doc_id.toString()
|
||||
return {
|
||||
doc: doc
|
||||
mongoPath: "#{currentPath}.docs.#{i}"
|
||||
}
|
||||
for childFolder, i in folder.folders or []
|
||||
result = _findDocInFolder childFolder, doc_id, "#{currentPath}.folders.#{i}"
|
||||
return result if result?
|
||||
|
||||
return null
|
||||
|
||||
_findAllDocsInFolder = (folder = {}) ->
|
||||
docs = folder.docs or []
|
||||
for childFolder in folder.folders or []
|
||||
docs = docs.concat _findAllDocsInFolder childFolder
|
||||
return docs
|
||||
|
||||
isDocInDocCollection = (doc, callback)->
|
||||
if !doc?._id? or doc._id.length == 0
|
||||
return callback(null, true)
|
||||
db.docs.find({_id: ObjectId(doc._id+"")}, {_id: 1}).limit 1, (err, foundDocs)->
|
||||
exists = foundDocs.length > 0
|
||||
callback err, exists
|
||||
|
||||
getWhichDocsCanBeDeleted = (docs, callback = (err, docsToBeDeleted, unmigratedDocs)->)->
|
||||
docsToBeDeleted = []
|
||||
unmigratedDocs = []
|
||||
|
||||
jobs = _.map docs, (doc)->
|
||||
return (cb)->
|
||||
isDocInDocCollection doc, (err, exists)->
|
||||
if exists
|
||||
docsToBeDeleted.push doc
|
||||
else
|
||||
unmigratedDocs.push doc
|
||||
cb(err)
|
||||
async.series jobs, (err)->
|
||||
callback err, docsToBeDeleted, unmigratedDocs
|
||||
|
||||
whipeDocLines = (project_id, mongoPath, callback)->
|
||||
update =
|
||||
$unset: {}
|
||||
update.$unset["#{mongoPath}.lines"] = ""
|
||||
update.$unset["#{mongoPath}.rev"] = ""
|
||||
db.projects.update _id: ObjectId(project_id+''), update, callback
|
||||
|
||||
|
||||
removeDocLinesFromProject = (docs, project, callback)->
|
||||
jobs = _.map docs, (doc)->
|
||||
(cb)->
|
||||
findDocInProject project, doc._id, (err, doc, mongoPath)->
|
||||
whipeDocLines project._id, mongoPath, cb
|
||||
async.parallelLimit jobs, 5, callback
|
||||
|
||||
processNext = (project_id, callback)->
|
||||
if !project_id? or project_id.length == 0
|
||||
return callback()
|
||||
checkIfFileHasBeenProccessed project_id, (err, hasBeenProcessed)->
|
||||
if hasBeenProcessed
|
||||
console.log "#{project_id} already procssed, skipping"
|
||||
return callback()
|
||||
console.log "#{project_id} processing"
|
||||
getAllDocs project_id, (err, docs, project)->
|
||||
if err?
|
||||
console.error err, project_id, "could not get all docs"
|
||||
return callback(err)
|
||||
else
|
||||
getWhichDocsCanBeDeleted docs, (err, docsToBeDeleted, unmigratedDocs)->
|
||||
if err?
|
||||
console.error err, project_id, "could not save docs into mongo"
|
||||
return callback(err)
|
||||
markUnmigratedDocs project_id, unmigratedDocs, (err)->
|
||||
removeDocLinesFromProject docsToBeDeleted, project, (err)->
|
||||
if err?
|
||||
return callback(err)
|
||||
markProjectAsProcessed project_id, (err)->
|
||||
setTimeout(
|
||||
-> callback(err)
|
||||
,0)
|
||||
|
||||
exports.migrate = (client, done = ->)->
|
||||
getProjectIds (err, ids)->
|
||||
printProgress()
|
||||
jobs = _.map ids, (id)->
|
||||
return (cb)->
|
||||
processNext(id, cb)
|
||||
async.series jobs, (err)->
|
||||
if err?
|
||||
console.error err, "at end of jobs"
|
||||
else
|
||||
console.log "finished"
|
||||
done(err)
|
||||
|
||||
|
||||
exports.rollback = (next)->
|
||||
next()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sharelatex",
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.4",
|
||||
"description": "An online collaborative LaTeX editor",
|
||||
"dependencies": {
|
||||
"async": "^0.9.0",
|
||||
|
||||
@@ -1,219 +0,0 @@
|
||||
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 : '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:
|
||||
host: "localhost"
|
||||
port: "6379"
|
||||
password: ""
|
||||
|
||||
# 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 : 'http://localhost:3000'
|
||||
|
||||
# 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: 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,
|
||||
# but should be set to true in production.
|
||||
cacheStaticAssets: false
|
||||
|
||||
# If you are running ShareLaTeX over https, set this to true to send the
|
||||
# cookie with a secure flag (recommended).
|
||||
secureCookie: false
|
||||
|
||||
# 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: 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
|
||||
# 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: [
|
||||
{name: "English", code: "en"}
|
||||
]
|
||||
|
||||
# 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
|
||||
@@ -14,6 +14,18 @@ server {
|
||||
proxy_read_timeout 3m;
|
||||
proxy_send_timeout 3m;
|
||||
}
|
||||
|
||||
location /socket.io {
|
||||
proxy_pass http://localhost:3026;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_x_forwarded_host;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_read_timeout 3m;
|
||||
proxy_send_timeout 3m;
|
||||
}
|
||||
|
||||
location /stylesheets {
|
||||
expires 1y;
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Create random secret keys (twice, once for http auth pass, once for cookie secret).
|
||||
sed -i "0,/CRYPTO_RANDOM/s/CRYPTO_RANDOM/$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 64 | head -n 1)/" /etc/sharelatex/settings.coffee
|
||||
sed -i "0,/CRYPTO_RANDOM/s/CRYPTO_RANDOM/$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 64 | head -n 1)/" /etc/sharelatex/settings.coffee
|
||||
|
||||
sudo adduser --system --group --home /var/www/sharelatex --no-create-home sharelatex
|
||||
|
||||
mkdir -p /var/log/sharelatex
|
||||
chown sharelatex:sharelatex /var/log/sharelatex
|
||||
|
||||
mkdir -p /var/lib/sharelatex
|
||||
mkdir -p /var/lib/sharelatex/data/user_files
|
||||
mkdir -p /var/lib/sharelatex/tmp/uploads
|
||||
mkdir -p /var/lib/sharelatex/data/compiles
|
||||
mkdir -p /var/lib/sharelatex/data/cache
|
||||
mkdir -p /var/lib/sharelatex/tmp/dumpFolder
|
||||
chown -R sharelatex:sharelatex /var/lib/sharelatex
|
||||
service sharelatex-web restart
|
||||
service sharelatex-document-updater restart
|
||||
service sharelatex-clsi restart
|
||||
service sharelatex-filestore restart
|
||||
service sharelatex-track-changes restart
|
||||
service sharelatex-docstore restart
|
||||
service sharelatex-chat restart
|
||||
service sharelatex-tags restart
|
||||
service sharelatex-spelling restart
|
||||
@@ -25,4 +25,4 @@ script
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
cd /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production PATH=$PATH:$LATEX_PATH $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
||||
end script
|
||||
Reference in New Issue
Block a user