daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Oct 19th, 2018 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #
  2. # Cookbook Name:: django-lms
  3. # Recipe:: default
  4. #
  5. # Copyright 2012, Illinois Institute of Technology
  6. #
  7. # All rights reserved
  8.  
  9. packages = ["byobu",
  10.             "python-dev",
  11.             "libmysqlclient-dev",
  12.             "libldap2-dev",
  13.             "libsasl2-dev",
  14.             "npm",
  15.             "postgresql-9.1",
  16.             "postgresql-server-dev-9.1",
  17.             "libjpeg-dev",
  18.            ]
  19.  
  20. packages.each do |p|
  21.   package p
  22. end
  23.  
  24. # Fix PIL
  25.  
  26. script "install_something" do
  27.   interpreter "bash"
  28.   user "root"
  29.   cwd "/tmp"
  30.   code <<-EOH
  31.   sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
  32.   sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
  33.   sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/  
  34.   EOH
  35. end
  36.  
  37. execute "installless" do
  38.   action :run
  39.   command "npm install -g less"
  40.   environment ({'HOME' => '/home/vagrant'})
  41. end
  42.  
  43. execute "chown" do
  44.   command "chown #{node[:lms][:user]}:#{node[:lms][:user]} #{node[:lms][:deployment][:deploy_to]}"
  45.   action :run
  46.   environment ({'HOME' => '/home/vagrant'})
  47. end
  48.  
  49. python_virtualenv "#{node[:lms][:deployment][:deploy_to]}/venv"  do
  50.   owner node[:lms][:user]
  51.   group node[:lms][:user]
  52.   action :create
  53.   interpreter "python2.7"
  54. end
  55.  
  56. # Run me some pip
  57.  
  58. execute "pip" do
  59.   command "#{node[:lms][:deployment][:deploy_to]}/venv/bin/pip install -r #{node[:lms][:deployment][:deploy_to]}/django-lms/#{node[:lms][:requirementsfile]}"
  60.   user node[:lms][:user]
  61.   action :run
  62.   environment ({'HOME' => '/home/vagrant'})
  63. end
  64.  
  65. # Setup our postgres user and db
  66. # template "/tmp/config.conf" do
  67. #   source "config.conf.erb"
  68. # end
  69.  
  70.  
  71. # r = package "ruby-pg" do
  72. #   package_name "libpgsql-ruby"
  73. #   action :nothing
  74. # end
  75. # r.run_action(:upgrade)
  76.  
  77. # Snippet from opscode to reload gems
  78. # require 'rubygems'
  79. # Gem.clear_paths
  80. # require "pg"
  81.  
  82. execute "create-database-user" do
  83.   user "postgres"
  84.   command "createuser -U postgres -SdRw #{node[:lms][:user]}"
  85.   returns [0,1]
  86. end
  87.  
  88. execute "create-database" do
  89.   user "postgres"
  90.   command "createdb -U postgres -O #{node[:lms][:user]} -E utf8 -T template0 #{node[:lms][:db]}"
  91.   returns [0,1]
  92. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top