Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. #----------------------------------------
  2. # Example base manifest
  3. #----------------------------------------
  4.  
  5. # Set up provisioning stages. I usually keep this to three:
  6. #
  7. # pre for apt configuration, apt update/upgrade, and base packages
  8. # main for most of the work
  9. # last for final stage things like creating DB schemas
  10.  
  11. # Used as a directory reference in user module
  12.  
  13. # A basic class which represents stuff for my pre phase
  14.  
  15.  
  16. Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
  17.  
  18. # Assign classes to phases
  19.  
  20. include apt
  21.  
  22. apt::ppa { 'ppa:ondrej/php5':
  23. before => Exec["update_apt"]
  24. }
  25.  
  26. apt::key { 'couchbase':
  27. key => 'A3FAA648D9223EDA',
  28. key_source => 'https://gist.githubusercontent.com/ShubhamAdpushup/fb4ae32189fc0a88de5f/raw/61f662d23100aefb0e0214a593b2c40024145364/gistfile1.txt',
  29. }
  30.  
  31. apt::source { 'couchbase':
  32. location => 'http://packages.couchbase.com/ubuntu',
  33. repos => 'precise/main',
  34. release => 'precise',
  35. key => 'A3FAA648D9223EDA',
  36. require => Apt::Key['couchbase'],
  37.  
  38. before => Exec["update_apt"]
  39. }
  40.  
  41. exec { "update_apt":
  42. command => "apt-get update"
  43. }
  44.  
  45. package { "build-essential":
  46. ensure => latest,
  47. require => Exec["update_apt"]
  48. }
  49.  
  50. package { [
  51. "python-software-properties",
  52. "tmux",
  53. "vim",
  54. "curl",
  55. "git",
  56. "memcached",
  57. "php-pear",
  58. "php5-dev",
  59. "libcouchbase2-core",
  60. "libcouchbase2-libevent",
  61. "libcouchbase2-bin",
  62. "libcouchbase-dev"
  63. ]:
  64. ensure => latest,
  65. require => Exec["update_apt"]
  66. }
  67.  
  68. package { ['php5', 'php5-fpm']:
  69. ensure => latest,
  70. require => Apt::Ppa["ppa:ondrej/php5"]
  71. }
  72.  
  73. exec { "fetch_couchbase":
  74. command => "wget http://packages.couchbase.com/releases/3.0.1/couchbase-server-community_3.0.1-ubuntu12.04_amd64.deb",
  75. creates => "/opt/couchbase"
  76. } -> exec { "install_couchbase":
  77. command => "sudo dpkg --install couchbase-server-community_3.0.1-ubuntu12.04_amd64.deb",
  78. creates => "/opt/couchbase",
  79. require => Exec["fetch_couchbase"]
  80. }
  81.  
  82. include php
  83.  
  84. vcsrepo { "/home/vagrant/php-couchbase/":
  85. ensure => present,
  86. provider => git,
  87. source => 'https://github.com/couchbaselabs/php-couchbase.git',
  88. revision => 'master'
  89. }
  90.  
  91. exec { "install_couchbase_ext":
  92. command => "phpize && ./configure && make && make install",
  93. cwd => "/home/vagrant/php-couchbase/",
  94. creates => "/usr/lib/php5/20121212/couchbase.so",
  95. require => Vcsrepo["/home/vagrant/php-couchbase/"]
  96. }
  97.  
  98. file { "/etc/php5/mods-available/zzcouchbase.ini":
  99. ensure => present,
  100. content => "extension=couchbase.so",
  101. require => Exec["install_couchbase_ext"]
  102. }
  103.  
  104. exec {"enable_mod":
  105. command => "php5enmod zzcouchbase",
  106. require => File["/etc/php5/mods-available/zzcouchbase.ini"]
  107. }
  108.  
  109. service { 'php5-fpm':
  110. ensure => running,
  111. enable => true,
  112. require => Package["php5-fpm"]
  113. }
  114.  
  115. php::config { 'display_errors=On':
  116. file => "/etc/php5/fpm/php.ini",
  117. section => "PHP"
  118. }
  119.  
  120. php::config { 'error_reporting=E_ALL':
  121. file => "/etc/php5/fpm/php.ini",
  122. section => "PHP"
  123. }
  124.  
  125. php::extension{'curl':
  126. ensure => installed,
  127. package => "php5-curl"
  128. }
  129.  
  130.  
  131. php::fpm::config {'fpm-listen':
  132. setting => "listen",
  133. value => "127.0.0.1:9000",
  134. file => "/etc/php5/fpm/pool.d/www.conf",
  135. section => "www",
  136. }
  137.  
  138. class {'nginx':
  139. sendfile => 'off'
  140. }
  141.  
  142.  
  143. nginx::resource::vhost { 'adpushup.com':
  144. www_root => '/var/www/adpushup.com',
  145. try_files => [ '$uri $uri/ /index.php$is_args$args' ]
  146. }
  147.  
  148. nginx::resource::location { "adpushup_root":
  149. ensure => present,
  150. www_root => '/var/www/adpushup.com',
  151. vhost => "adpushup.com",
  152. location => '~ \.php$',
  153. index_files => ['index.php', 'index.html', 'index.htm'],
  154. fastcgi => "127.0.0.1:9000",
  155. location_cfg_append => {
  156. fastcgi_connect_timeout => '3m',
  157. fastcgi_read_timeout => '3m',
  158. fastcgi_send_timeout => '3m',
  159. fastcgi_param => ['SCRIPT_FILENAME $document_root$fastcgi_script_name'],
  160. }
  161. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement