diff --git a/Vagrantfile b/Vagrantfile index 40fa80750f..0f9f595fce 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -21,6 +21,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| chef.add_recipe 'redis-server' chef.add_recipe 'mongodb' chef.add_recipe 'nodejs' + chef.add_recipe 'texlive' chef.add_recipe 'sharelatex' # You may also specify custom JSON attributes: diff --git a/chef/cookbooks/sharelatex/metadata.rb b/chef/cookbooks/sharelatex/metadata.rb index a6562c6cff..319ee0441b 100644 --- a/chef/cookbooks/sharelatex/metadata.rb +++ b/chef/cookbooks/sharelatex/metadata.rb @@ -5,3 +5,4 @@ license 'All rights reserved' description 'Installs/Configures sharelatex' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.0' +depends 'texlive' diff --git a/chef/cookbooks/sharelatex/providers/app.rb b/chef/cookbooks/sharelatex/providers/app.rb index 499a58cfb1..42581bb121 100644 --- a/chef/cookbooks/sharelatex/providers/app.rb +++ b/chef/cookbooks/sharelatex/providers/app.rb @@ -68,6 +68,11 @@ action :start do notifies :restart, "service[#{r.name}]" end + env = "" + r.environment.each do |key, value| + env += "#{key}=#{value} " + end + file "/etc/init/#{r.name}.conf" do content <<-EOS description "#{r.name}" @@ -83,9 +88,11 @@ action :start do script echo $$ > /var/run/#{r.name}.pid chdir #{deploy_to}/current - exec sudo -u #{r.user} env NODE_ENV=#{node_environment} SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee node app.js >> log/production.log + exec sudo -u #{r.user} env NODE_ENV=#{node_environment} SHARELATEX_CONFIG=/etc/sharelatex/settings.coffee #{env} node app.js >> log/production.log 2>&1 end script EOS + + notifies :restart, "service[#{r.name}]" end directory "/etc/sharelatex" diff --git a/chef/cookbooks/sharelatex/recipes/default.rb b/chef/cookbooks/sharelatex/recipes/default.rb index e7bb3221b4..0448ef8037 100644 --- a/chef/cookbooks/sharelatex/recipes/default.rb +++ b/chef/cookbooks/sharelatex/recipes/default.rb @@ -5,9 +5,14 @@ # Copyright 2014, ShareLaTeX # -for dir in ["compiles", "clsi-cache", "user_files"] do +# For filestore conversions +package "imagemagick" +package "optipng" + +for dir in ["", "compiles", "clsi-cache", "user_files"] do directory "/var/lib/sharelatex/#{dir}" do - user "www-data" + user "www-data" + group "www-data" recursive true end end @@ -35,5 +40,8 @@ end sharelatex_app "clsi-sharelatex" do repository "https://github.com/sharelatex/clsi-sharelatex.git" revision "master" + environment({ + "PATH" => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:#{node[:texlive][:bin_dir]}" + }) end diff --git a/chef/cookbooks/sharelatex/resources/app.rb b/chef/cookbooks/sharelatex/resources/app.rb index 22b4cacf60..3e76eb16f6 100644 --- a/chef/cookbooks/sharelatex/resources/app.rb +++ b/chef/cookbooks/sharelatex/resources/app.rb @@ -3,6 +3,8 @@ actions :start attribute :revision, :kind_of => String, :default => "master" attribute :repository, :kind_of => String attribute :user, :kind_of => String, :default => "www-data" +attribute :group, :kind_of => String, :default => "www-data" +attribute :environment, :kind_of => Hash, :default => {} def initialize(*args) super diff --git a/chef/cookbooks/texlive/CHANGELOG.md b/chef/cookbooks/texlive/CHANGELOG.md new file mode 100644 index 0000000000..e1b59f6e0c --- /dev/null +++ b/chef/cookbooks/texlive/CHANGELOG.md @@ -0,0 +1,12 @@ +# CHANGELOG for latex + +This file is used to list changes made in each version of latex. + +## 0.1.0: + +* Initial release of latex + +- - - +Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. + +The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown. diff --git a/chef/cookbooks/texlive/README.md b/chef/cookbooks/texlive/README.md new file mode 100644 index 0000000000..06f25ec5e4 --- /dev/null +++ b/chef/cookbooks/texlive/README.md @@ -0,0 +1,68 @@ +latex Cookbook +============== +TODO: Enter the cookbook description here. + +e.g. +This cookbook makes your favorite breakfast sandwhich. + +Requirements +------------ +TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc. + +e.g. +#### packages +- `toaster` - latex needs toaster to brown your bagel. + +Attributes +---------- +TODO: List you cookbook attributes here. + +e.g. +#### latex::default +
Key | +Type | +Description | +Default | +
---|---|---|---|
['latex']['bacon'] | +Boolean | +whether to include bacon | +true | +