Set up dev environment with Vagrant

This commit is contained in:
James Allen 2014-08-15 13:34:57 +01:00
parent 811f168f66
commit 19e6147266
12 changed files with 29 additions and 482 deletions

View file

@ -207,7 +207,7 @@ module.exports = (grunt) ->
checkLatexmk: (callback = (error) ->) -> checkLatexmk: (callback = (error) ->) ->
grunt.log.write "Checking latexmk is installed... " grunt.log.write "Checking latexmk is installed... "
exec "latexmk --version", (error, stdout, stderr) -> exec "latexmk --version", (error, stdout, stderr) ->
if error? and error.message.match("command not found") if error? and error.message.match("not found")
grunt.log.error "FAIL." grunt.log.error "FAIL."
grunt.log.errorlns """ grunt.log.errorlns """
Either latexmk is not installed or is not in your PATH. Either latexmk is not installed or is not in your PATH.
@ -241,7 +241,7 @@ module.exports = (grunt) ->
checkAspell: (callback = (error) ->) -> checkAspell: (callback = (error) ->) ->
grunt.log.write "Checking aspell is installed... " grunt.log.write "Checking aspell is installed... "
exec "aspell dump dicts", (error, stdout, stderr) -> exec "aspell dump dicts", (error, stdout, stderr) ->
if error? and error.message.match("command not found") if error? and error.message.match("not found")
grunt.log.error "FAIL." grunt.log.error "FAIL."
grunt.log.errorlns """ grunt.log.errorlns """
Either aspell is not installed or is not in your PATH. Either aspell is not installed or is not in your PATH.
@ -326,7 +326,7 @@ module.exports = (grunt) ->
checkMake: (callback = (error) ->) -> checkMake: (callback = (error) ->) ->
grunt.log.write "Checking make is installed... " grunt.log.write "Checking make is installed... "
exec "make --version", (error, stdout, stderr) -> exec "make --version", (error, stdout, stderr) ->
if error? and error.message.match("command not found") if error? and error.message.match("not found")
grunt.log.error "FAIL." grunt.log.error "FAIL."
grunt.log.errorlns """ grunt.log.errorlns """
Either make is not installed or is not in your path. Either make is not installed or is not in your path.

2
Vagrantfile vendored
View file

@ -23,7 +23,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
chef.add_recipe 'mongodb' chef.add_recipe 'mongodb'
chef.add_recipe 'nodejs' chef.add_recipe 'nodejs'
chef.add_recipe 'texlive' chef.add_recipe 'texlive'
chef.add_recipe 'sharelatex' chef.add_recipe 'packages'
# You may also specify custom JSON attributes: # You may also specify custom JSON attributes:
chef.json = {} chef.json = {}

View file

@ -1,5 +1,5 @@
sharelatex Cookbook redis Cookbook
=================== ==============
TODO: Enter the cookbook description here. TODO: Enter the cookbook description here.
e.g. e.g.
@ -11,14 +11,14 @@ TODO: List your cookbook requirements. Be sure to include any requirements this
e.g. e.g.
#### packages #### packages
- `toaster` - sharelatex needs toaster to brown your bagel. - `toaster` - redis needs toaster to brown your bagel.
Attributes Attributes
---------- ----------
TODO: List you cookbook attributes here. TODO: List you cookbook attributes here.
e.g. e.g.
#### sharelatex::default #### redis::default
<table> <table>
<tr> <tr>
<th>Key</th> <th>Key</th>
@ -27,7 +27,7 @@ e.g.
<th>Default</th> <th>Default</th>
</tr> </tr>
<tr> <tr>
<td><tt>['sharelatex']['bacon']</tt></td> <td><tt>['redis']['bacon']</tt></td>
<td>Boolean</td> <td>Boolean</td>
<td>whether to include bacon</td> <td>whether to include bacon</td>
<td><tt>true</tt></td> <td><tt>true</tt></td>
@ -36,17 +36,17 @@ e.g.
Usage Usage
----- -----
#### sharelatex::default #### redis::default
TODO: Write usage instructions for each cookbook. TODO: Write usage instructions for each cookbook.
e.g. e.g.
Just include `sharelatex` in your node's `run_list`: Just include `redis` in your node's `run_list`:
```json ```json
{ {
"name":"my_node", "name":"my_node",
"run_list": [ "run_list": [
"recipe[sharelatex]" "recipe[redis]"
] ]
} }
``` ```

View file

@ -0,0 +1,7 @@
name 'packages'
maintainer 'ShareLaTeX'
maintainer_email 'team@sharelatex.com'
license 'AGPLv3'
description 'Installs/Configures packages'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'

View file

@ -0,0 +1,9 @@
#
# Cookbook Name:: packages
# Recipe:: default
#
# Copyright 2014, ShareLaTeX
#
package 'git'
package 'vim'

View file

@ -1,12 +0,0 @@
# CHANGELOG for sharelatex
This file is used to list changes made in each version of sharelatex.
## 0.1.0:
* Initial release of sharelatex
- - -
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.

View file

@ -1,8 +0,0 @@
name 'sharelatex'
maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
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'

View file

@ -1,121 +0,0 @@
action :start do
package "git"
package "build-essential"
r = new_resource
deploy_to = "/var/www/" + r.name
node_environment = "production"
directory deploy_to do
user r.user if r.user
recursive true
end
env = {
"HOME" => deploy_to
}
directory "#{deploy_to}/releases" do
user r.user if r.user
recursive true
end
shared_dir = "#{deploy_to}/shared"
directory shared_dir do
user r.user if r.user
recursive true
end
directory "#{shared_dir}/config" do
user r.user if r.user
recursive true
end
directory "#{shared_dir}/log" do
user r.user if r.user
recursive true
end
deploy_revision deploy_to do
repository r.repository
revision r.revision
user r.user if r.user
purge_before_symlink [
"log", "config", "node_modules"
]
create_dirs_before_symlink []
symlinks({
"log" => "log",
"config" => "config"
})
symlink_before_migrate({
"node_modules" => "node_modules"
})
environment env
migrate true
migration_command "npm install; grunt install"
before_migrate do
directory "#{deploy_to}/shared/node_modules" do
user r.user if r.user
recursive true
end
end
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}"
author "ShareLaTeX <team@sharelatex.com>"
start on started mountall
stop on shutdown
respawn
limit nofile 8192 8192
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 #{env} node app.js >> log/production.log 2>&1
end script
EOS
notifies :restart, "service[#{r.name}]"
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
end
file "/etc/logrotate.d/#{r.name}" do
content <<-EOS
#{deploy_to}/shared/log/*.log {
rotate 7
size 5M
missingok
compress
copytruncate
}
EOS
end
end

View file

@ -1,47 +0,0 @@
#
# Cookbook Name:: sharelatex
# Recipe:: default
#
# Copyright 2014, ShareLaTeX
#
# 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"
group "www-data"
recursive true
end
end
sharelatex_app "web-sharelatex" do
repository "https://github.com/sharelatex/web-sharelatex.git"
revision "master"
end
sharelatex_app "document-updater-sharelatex" do
repository "https://github.com/sharelatex/document-updater-sharelatex.git"
revision "master"
end
sharelatex_app "filestore-sharelatex" do
repository "https://github.com/sharelatex/filestore-sharelatex.git"
revision "master"
end
sharelatex_app "track-changes-sharelatex" do
repository "https://github.com/sharelatex/track-changes-sharelatex.git"
revision "master"
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

View file

@ -1,13 +0,0 @@
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
@action = :start
end

View file

@ -1,268 +0,0 @@
Path = require('path')
http = require('http')
http.globalAgent.maxSockets = 300
# Make time interval config easier.
seconds = 1000
minutes = 60 * seconds
# These credentials are used for authenticating api requests
# between services that may need to go over public channels
httpAuthUser = "sharelatex"
httpAuthPass = "password"
httpAuthUsers = {}
httpAuthUsers[httpAuthUser] = httpAuthPass
sessionSecret = "secret-please-change"
module.exports =
# File storage
# ------------
#
# ShareLaTeX needs somewhere to store binary files like images.
# There are currently two options:
# Your local filesystem (the default)
# Amazon S3
filestore:
# which backend persistor to use.
# choices are
# s3 - Amazon S3
# fs - local filesystem
backend: "fs"
stores:
# where to store user and template binary files
#
# For Amazon S3 this is the bucket name to store binary files
#
# 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: "/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
# key: ""
# secret: ""
# Databases
# ---------
mongo:
url : 'mongodb://127.0.0.1/sharelatex'
redis:
web:
host: "localhost"
port: "6379"
password: ""
api:
host: "localhost"
port: "6379"
password: ""
mysql:
clsi:
database: "clsi"
username: "clsi"
password: ""
dialect: "sqlite"
storage: "/var/lib/sharelatex/clsi.sqlite"
# Service locations
# -----------------
# Configure which ports to run each service on. 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"
clsi:
port: clsiPort = 3013
host: "localhost"
filestore:
port: filestorePort = 3009
host: "localhost"
trackchanges:
port: trackchangesPort = 3015
host: "localhost"
# Tell each service where to find the other services. If everything
# is running locally then this is easy, but they exist as separate config
# options incase you want to run some services on remote hosts.
apis:
web:
url: "http://localhost:#{webPort}"
user: httpAuthUser
pass: httpAuthPass
documentupdater:
url : "http://localhost:#{docUpdaterPort}"
clsi:
url: "http://localhost:#{clsiPort}"
filestore:
url: "http://localhost:#{filestorePort}"
trackchanges:
url: "http://localhost:#{trackchangesPort}"
thirdPartyDataStore:
url : "http://localhost:3002"
emptyProjectFlushDelayMiliseconds: 5 * seconds
tags:
url :"http://localhost:3012"
spelling:
url : "http://localhost:3005"
versioning:
snapshotwaitms:3000
url: "http://localhost:4000"
username: httpAuthUser
password: httpAuthPass
recurly:
privateKey: ""
apiKey: ""
subdomain: ""
chat:
url: "http://localhost:3010"
templates:
port: 3007
blog:
port: 3008
templates_api:
url: "http://localhost:3007"
# Where your instance of ShareLaTeX can be found publically. Used in emails
# that are sent out, generated links, etc.
siteUrl : 'http://localhost:3000'
# Same, but with http auth credentials.
httpAuthSiteUrl: 'http://#{httpAuthUser}:#{httpAuthPass}@localhost:3000'
# Security
# --------
security:
sessionSecret: sessionSecret
httpAuthUsers: httpAuthUsers
# Default features
# ----------------
#
# You can select the features that are enabled by default for new
# new users.
defaultFeatures: defaultFeatures =
collaborators: -1
dropbox: true
versioning: true
plans: plans = [{
planCode: "personal"
name: "Personal"
price: 0
features: defaultFeatures
}]
# Spelling languages
# ------------------
#
# You must have the corresponding aspell package installed to
# be able to use a language.
languages: [
{name: "English", code: "en"}
]
# Email support
# -------------
#
# ShareLaTeX uses nodemailer (http://www.nodemailer.com/) to send transactional emails.
# To see the range of transport and options they support, see http://www.nodemailer.com/docs/transports
#email:
# Who should emails be from by default?
# fromAddress: ""
# The default replyTo field, if it should be set
# replyTo: ""
# lifecycle: false
## Example transport and parameter settings for Amazon SES
# transport: "SES"
# parameters:
# AWSAccessKeyID: ""
# AWSSecretKey: ""
# Third party services
# --------------------
#
# ShareLaTeX's regular newsletter is managed by Markdown mail. Add your
# credentials here to integrate with this.
# markdownmail:
# secret: ""
# list_id: ""
#
# Fill in your unique token from various analytics services to enable
# them.
# analytics:
# mixpanel:
# token: ""
# ga:
# token: ""
# heap:
# token: ""
#
# ShareLaTeX's help desk is provided by tenderapp.com
# tenderUrl: ""
#
# Production Settings
# -------------------
# 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.
cacheStaticAssets: false
# If you are running ShareLaTeX over https, set this to true to send the
# cookie with a secure flag (recommended).
secureCookie: false
# Internal configs
# ----------------
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: "/var/lib/sharelatex/compiles"
# Where to cache downloaded URLs for the CLSI
clsiCacheDir: "/var/lib/sharelatex/clsi-cache"
# Automatic Snapshots
# -------------------
automaticSnapshots:
# How long should we wait after the user last edited to
# take a snapshot?
waitTimeAfterLastEdit: 5 * minutes
# Even if edits are still taking place, this is maximum
# time to wait before taking another snapshot.
maxTimeBetweenSnapshots: 30 * minutes
# Smoke test
# ----------
# Provide log in credentials and a project to be able to run
# some basic smoke tests to check the core functionality.
#
# smokeTest:
# user: ""
# password: ""
# projectId: ""
# Filestore health check
# ----------------------
# Project and file details to check in filestore when calling /health_check
# health_check:
# project_id: ""
# file_id: ""

View file

@ -1,2 +1,2 @@
default[:texlive][:schema] = "small" default[:texlive][:schema] = "small"
default[:texlive][:bin_dir] = "/usr/local/texlive/2013/bin/x86_64-linux" default[:texlive][:bin_dir] = "/usr/local/texlive/2014/bin/x86_64-linux"