From 5b6eaf546b4f82186454b1cef04bbebbfe5326a3 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 31 Mar 2014 09:40:07 +0100 Subject: [PATCH] Fix settings to use global directories --- .../chef/cookbooks/sharelatex/providers/app.rb | 9 ++++++++- .../chef/cookbooks/sharelatex/recipes/default.rb | 13 +++++++------ .../templates/default/settings.coffee.erb | 10 +++++----- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/server-ce/chef/cookbooks/sharelatex/providers/app.rb b/server-ce/chef/cookbooks/sharelatex/providers/app.rb index 335dfa1627..499a58cfb1 100644 --- a/server-ce/chef/cookbooks/sharelatex/providers/app.rb +++ b/server-ce/chef/cookbooks/sharelatex/providers/app.rb @@ -65,7 +65,7 @@ action :start do end end - #notifies :restart, "service[#{r.name}]" + notifies :restart, "service[#{r.name}]" end file "/etc/init/#{r.name}.conf" do @@ -88,6 +88,13 @@ action :start do EOS end + directory "/etc/sharelatex" + template "/etc/sharelatex/settings.coffee" do + mode 0400 + user "www-data" + notifies :restart, "service[#{r.name}]" + end + service "#{r.name}" do provider Chef::Provider::Service::Upstart action :start diff --git a/server-ce/chef/cookbooks/sharelatex/recipes/default.rb b/server-ce/chef/cookbooks/sharelatex/recipes/default.rb index 72f4c76b07..e7bb3221b4 100644 --- a/server-ce/chef/cookbooks/sharelatex/recipes/default.rb +++ b/server-ce/chef/cookbooks/sharelatex/recipes/default.rb @@ -5,11 +5,11 @@ # Copyright 2014, ShareLaTeX # -directory "/etc/sharelatex" - -template "/etc/sharelatex/settings.coffee" do - mode 0400 - user "www-data" +for dir in ["compiles", "clsi-cache", "user_files"] do + directory "/var/lib/sharelatex/#{dir}" do + user "www-data" + recursive true + end end sharelatex_app "web-sharelatex" do @@ -35,4 +35,5 @@ end sharelatex_app "clsi-sharelatex" do repository "https://github.com/sharelatex/clsi-sharelatex.git" revision "master" -end \ No newline at end of file +end + diff --git a/server-ce/chef/cookbooks/sharelatex/templates/default/settings.coffee.erb b/server-ce/chef/cookbooks/sharelatex/templates/default/settings.coffee.erb index ac1a544368..96215179e0 100644 --- a/server-ce/chef/cookbooks/sharelatex/templates/default/settings.coffee.erb +++ b/server-ce/chef/cookbooks/sharelatex/templates/default/settings.coffee.erb @@ -36,7 +36,7 @@ module.exports = # # For local filesystem this is the directory to store the files in. # This path must exist, not be tmpfs and be writable to by the user sharelatex is run as. - user_files: Path.resolve(__dirname + "/../user_files") + user_files: "/var/lib/sharelatex/user_files" # Uncomment if you need to configure your S3 credentials # s3: # # if you are using S3, then fill in your S3 details below @@ -65,7 +65,7 @@ module.exports = username: "clsi" password: "" dialect: "sqlite" - storage: Path.resolve(__dirname + "/../db.sqlite") + storage: "/var/lib/sharelatex/clsi.sqlite" # Service locations # ----------------- @@ -230,15 +230,15 @@ module.exports = # Internal configs # ---------------- - path: + 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.resolve "data/dumpFolder" # Where to write the project to disk before running LaTeX on it - compilesDir: Path.resolve(__dirname + "/../compiles") + compilesDir: "/var/lib/sharelatex/compiles" # Where to cache downloaded URLs for the CLSI - clsiCacheDir: Path.resolve(__dirname + "/../cache") + clsiCacheDir: "/var/lib/sharelatex/clsi-cache" # Automatic Snapshots # -------------------