mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Update upstart scripts
This commit is contained in:
parent
cfa18a0e0b
commit
7ba417d3a8
11 changed files with 190 additions and 47 deletions
|
@ -126,8 +126,10 @@ 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", () ->
|
||||
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()
|
||||
|
||||
Helpers =
|
||||
installService: (repo_src, dir, callback = (error) ->) ->
|
||||
|
@ -375,13 +377,18 @@ module.exports = (grunt) ->
|
|||
grunt.log.write "OK."
|
||||
return callback()
|
||||
|
||||
buildUpstartScripts: () ->
|
||||
template = fs.readFileSync("package/upstart/sharelatex-template").toString()
|
||||
for service in SERVICES
|
||||
fs.writeFileSync "package/upstart/sharelatex-#{service.name}", template.replace(/__SERVICE__/g, service.name)
|
||||
|
||||
buildDeb: (callback = (error) ->) ->
|
||||
# TODO: filestore uses local 'uploads' directory, not configurable in settings
|
||||
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",
|
||||
"--directories", "/var/data/sharelatex"
|
||||
"--directories", "/var/lib/sharelatex"
|
||||
"--directories", "/var/log/sharelatex"
|
||||
)
|
||||
|
||||
|
@ -391,9 +398,8 @@ module.exports = (grunt) ->
|
|||
"--depends", "nodejs > 0.10.0"
|
||||
)
|
||||
|
||||
template = fs.readFileSync("package/upstart/sharelatex-template").toString()
|
||||
@buildUpstartScripts()
|
||||
for service in SERVICES
|
||||
fs.writeFileSync "package/upstart/sharelatex-#{service.name}", template.replace(/SERVICE/g, service.name)
|
||||
command.push(
|
||||
"--deb-upstart", "package/upstart/sharelatex-#{service.name}"
|
||||
)
|
||||
|
@ -409,8 +415,8 @@ module.exports = (grunt) ->
|
|||
|
||||
for dir in ["user_files", "uploads", "compiles", "cache", "dump"]
|
||||
after_install_script += """
|
||||
mkdir -p /var/data/sharelatex/#{dir}
|
||||
chown sharelatex:sharelatex /var/data/sharelatex/#{dir}
|
||||
mkdir -p /var/lib/sharelatex/#{dir}
|
||||
chown sharelatex:sharelatex /var/lib/sharelatex/#{dir}
|
||||
|
||||
"""
|
||||
|
||||
|
|
27
package/upstart/sharelatex-chat
Normal file
27
package/upstart/sharelatex-chat
Normal file
|
@ -0,0 +1,27 @@
|
|||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
stop on shutdown
|
||||
|
||||
respawn
|
||||
|
||||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
SERVICE=chat
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
|
@ -1,4 +1,4 @@
|
|||
description "sharelatex-clsi"
|
||||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
|
@ -9,11 +9,19 @@ respawn
|
|||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
echo $$ > /var/run/sharelatex-clsi.pid
|
||||
chdir /var/www/sharelatex/clsi
|
||||
exec sudo -u sharelatex -g sharelatex env SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee NODE_ENV=production node app.js >> /var/log/sharelatex/clsi.log 2>&1
|
||||
end script
|
||||
SERVICE=clsi
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
|
@ -1,4 +1,4 @@
|
|||
description "sharelatex-docstore"
|
||||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
|
@ -9,11 +9,19 @@ respawn
|
|||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
echo $$ > /var/run/sharelatex-docstore.pid
|
||||
chdir /var/www/sharelatex/docstore
|
||||
exec sudo -u sharelatex -g sharelatex env SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee NODE_ENV=production node app.js >> /var/log/sharelatex/docstore.log 2>&1
|
||||
end script
|
||||
SERVICE=docstore
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
|
@ -1,4 +1,4 @@
|
|||
description "sharelatex-document-updater"
|
||||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
|
@ -9,11 +9,19 @@ respawn
|
|||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
echo $$ > /var/run/sharelatex-document-updater.pid
|
||||
chdir /var/www/sharelatex/document-updater
|
||||
exec sudo -u sharelatex -g sharelatex env SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee NODE_ENV=production node app.js >> /var/log/sharelatex/document-updater.log 2>&1
|
||||
end script
|
||||
SERVICE=document-updater
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
|
@ -1,4 +1,4 @@
|
|||
description "sharelatex-filestore"
|
||||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
|
@ -9,11 +9,19 @@ respawn
|
|||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
echo $$ > /var/run/sharelatex-filestore.pid
|
||||
chdir /var/www/sharelatex/filestore
|
||||
exec sudo -u sharelatex -g sharelatex env SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee NODE_ENV=production node app.js >> /var/log/sharelatex/filestore.log 2>&1
|
||||
end script
|
||||
SERVICE=filestore
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
27
package/upstart/sharelatex-spelling
Normal file
27
package/upstart/sharelatex-spelling
Normal file
|
@ -0,0 +1,27 @@
|
|||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
stop on shutdown
|
||||
|
||||
respawn
|
||||
|
||||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
SERVICE=spelling
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
27
package/upstart/sharelatex-tags
Normal file
27
package/upstart/sharelatex-tags
Normal file
|
@ -0,0 +1,27 @@
|
|||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
stop on shutdown
|
||||
|
||||
respawn
|
||||
|
||||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
SERVICE=tags
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
|
@ -1,4 +1,4 @@
|
|||
description "sharelatex-SERVICE"
|
||||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
|
@ -9,11 +9,19 @@ respawn
|
|||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
echo $$ > /var/run/sharelatex-SERVICE.pid
|
||||
chdir /var/www/sharelatex/SERVICE
|
||||
exec sudo -u sharelatex -g sharelatex env SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee NODE_ENV=production node app.js >> /var/log/sharelatex/SERVICE.log 2>&1
|
||||
end script
|
||||
SERVICE=__SERVICE__
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
|
@ -1,4 +1,4 @@
|
|||
description "sharelatex-track-changes"
|
||||
description "sharelatex-web"
|
||||
author "ShareLaTeX <team@sharelatex.com>"
|
||||
|
||||
start on started mountall
|
||||
|
@ -9,11 +9,19 @@ respawn
|
|||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
echo $$ > /var/run/sharelatex-track-changes.pid
|
||||
chdir /var/www/sharelatex/track-changes
|
||||
exec sudo -u sharelatex -g sharelatex env SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee NODE_ENV=production node app.js >> /var/log/sharelatex/track-changes.log 2>&1
|
||||
end script
|
||||
SERVICE=track-changes
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
|
@ -9,11 +9,19 @@ respawn
|
|||
limit nofile 8192 8192
|
||||
|
||||
pre-start script
|
||||
mkdir -p /var/log/sharelatex
|
||||
mkdir -p /var/log/sharelatex
|
||||
end script
|
||||
|
||||
script
|
||||
echo $$ > /var/run/sharelatex-web.pid
|
||||
chdir /var/www/sharelatex/web
|
||||
exec sudo -u sharelatex -g sharelatex env SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee NODE_ENV=production node app.js >> /var/log/sharelatex/web.log 2>&1
|
||||
end script
|
||||
SERVICE=web
|
||||
USER=sharelatex
|
||||
GROUP=sharelatex
|
||||
# You may need to replace this with an absolute
|
||||
# path to Node.js if it's not in your system PATH.
|
||||
NODE=node
|
||||
SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee
|
||||
|
||||
echo $$ > /var/run/sharelatex-$SERVICE.pid
|
||||
chdir /var/www/sharelatex/$SERVICE
|
||||
exec sudo -u $USER -g $GROUP env SHARELATEX_CONFIG=$SHARELATEX_CONFIG NODE_ENV=production $NODE app.js >> /var/log/sharelatex/$SERVICE.log 2>&1
|
||||
end script
|
Loading…
Reference in a new issue