From 5cd6c5c517fe1328296f14b8b3d4443fddf23508 Mon Sep 17 00:00:00 2001 From: xiaogaozi Date: Sun, 8 Jun 2014 20:10:00 +0800 Subject: [PATCH] Use librarian-puppet and update to latest Phabicator --- .gitignore | 3 +++ Puppetfile | 5 +++++ Puppetfile.lock | 15 +++++++++++++++ README.md | 10 +++++++--- Vagrantfile | 26 +++++++++++++++++++++----- bootstrap.sh | 26 -------------------------- manifests/default.pp | 20 ++++++++++---------- modules/nginx/templates/ph.conf.erb | 3 --- modules/phabricator/files/local.json | 12 ++++++++++++ modules/phabricator/manifests/init.pp | 14 ++++++++++++++ modules/php/manifests/init.pp | 9 +++++++++ 11 files changed, 96 insertions(+), 47 deletions(-) create mode 100644 Puppetfile create mode 100644 Puppetfile.lock delete mode 100755 bootstrap.sh create mode 100644 modules/phabricator/files/local.json create mode 100644 modules/phabricator/manifests/init.pp diff --git a/.gitignore b/.gitignore index 096a95a..34b22f5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,10 @@ libphutil/ phabricator/ modules/* !modules/nginx/ +!modules/phabricator/ !modules/php/ +.librarian/ +.tmp/ ### /Users/xiaogaozi/.gitignore-boilerplates/Global/vim.gitignore diff --git a/Puppetfile b/Puppetfile new file mode 100644 index 0000000..aa63f32 --- /dev/null +++ b/Puppetfile @@ -0,0 +1,5 @@ +forge "http://forge.puppetlabs.com" + +mod "puppetlabs/apt" +mod "puppetlabs/inifile" +mod "puppetlabs/mysql" diff --git a/Puppetfile.lock b/Puppetfile.lock new file mode 100644 index 0000000..096af13 --- /dev/null +++ b/Puppetfile.lock @@ -0,0 +1,15 @@ +FORGE + remote: http://forge.puppetlabs.com + specs: + puppetlabs/apt (1.5.0) + puppetlabs/stdlib (>= 2.2.1) + puppetlabs/inifile (1.1.0) + puppetlabs/mysql (2.2.3) + puppetlabs/stdlib (>= 3.2.0) + puppetlabs/stdlib (4.2.2) + +DEPENDENCIES + puppetlabs/apt (>= 0) + puppetlabs/inifile (>= 0) + puppetlabs/mysql (>= 0) + diff --git a/README.md b/README.md index 5accebb..300247e 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,16 @@ Phabricator development box using Vagrant -## Quickstart ## +## Quick Start ## ```bash -$ git clone https://github.com/xiaogaozi/vagrant-phabricator.git +$ git clone git@github.com:xiaogaozi/vagrant-phabricator.git $ cd vagrant-phabricator +$ git clone git@github.com:phacility/libphutil.git +$ git clone git@github.com:phacility/arcanist.git +$ git clone git@github.com:phacility/phabricator.git +$ librarian-puppet install $ vagrant up ``` -Phabricator is now running at http://192.168.33.10/ +Phabricator is now running at [http://192.168.33.10](http://192.168.33.10), you could also access through [http://ph.dev](http://ph.dev) if you edit your `/etc/hosts` file. diff --git a/Vagrantfile b/Vagrantfile index f530ef6..c0e4456 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,11 +7,11 @@ Vagrant.configure("2") do |config| # please see the online documentation at vagrantup.com. # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "debian-607-x64-vbox4210" + config.vm.box = "debian-73-x64-virtualbox-puppet" # The url from where the 'config.vm.box' box will be fetched if it # doesn't already exist on the user's system. - config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210.box" + config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-puppet.box" # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, @@ -47,9 +47,25 @@ Vagrant.configure("2") do |config| vb.customize ["modifyvm", :id, "--memory", "512"] end - config.vm.provision "shell", path: "bootstrap.sh" - - config.vm.provision :puppet do |puppet| + # Enable provisioning with Puppet stand alone. Puppet manifests + # are contained in a directory path relative to this Vagrantfile. + # You will need to create the manifests directory and a manifest in + # the file base.pp in the manifests_path directory. + # + # An example Puppet manifest to provision the message of the day: + # + # # group { "puppet": + # # ensure => "present", + # # } + # # + # # File { owner => 0, group => 0, mode => 0644 } + # # + # # file { '/etc/motd': + # # content => "Welcome to your Vagrant-built virtual machine! + # # Managed by Puppet.\n" + # # } + # + config.vm.provision :puppet, run: "always" do |puppet| puppet.module_path = "modules" end end diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index a8562f6..0000000 --- a/bootstrap.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Puppet modules bootstrap -# Copyright (C) 2013 xiaogaozi -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -install_module () { - if ! puppet module list | grep -q "$1"; then - puppet module install "$1" - fi -} - -install_module puppetlabs-apt -install_module puppetlabs-mysql diff --git a/manifests/default.pp b/manifests/default.pp index d598998..e296308 100644 --- a/manifests/default.pp +++ b/manifests/default.pp @@ -10,28 +10,24 @@ repos => 'main contrib non-free', include_src => false } - apt::source { 'debian_updates': location => 'http://http.debian.net/debian/', release => "${::lsbdistcodename}-proposed-updates", repos => 'main contrib non-free', include_src => false } - apt::source { 'debian_security': location => 'http://security.debian.org/', release => "${::lsbdistcodename}/updates", repos => 'main contrib non-free', include_src => false } - apt::source { 'puppetlabs': location => 'http://apt.puppetlabs.com', repos => 'main', key => '4BD6EC30', key_server => 'pgp.mit.edu', } - apt::source { 'dotdeb': location => 'http://packages.dotdeb.org', repos => 'all', @@ -39,21 +35,25 @@ key_source => 'http://www.dotdeb.org/dotdeb.gpg' } -Apt::Source['dotdeb'] -> Class['nginx'] -Apt::Source['dotdeb'] -> Class['php'] +# Update before install any packages +exec { 'apt-update': + command => '/usr/bin/apt-get update' +} +Apt::Source <| |> -> Exec['apt-update'] -> Package <| |> +# Install and configure nginx include nginx nginx::server { 'ph.dev': root => '/vagrant/phabricator/webroot' } +# And PHP include php +# And MySQL class { 'mysql::server': root_password => 'root', } -file { '/etc/profile.d/ph.sh': - ensure => present, - content => 'export PHABRICATOR_ENV=custom/myconfig' -} +# And Phabricator +include phabricator diff --git a/modules/nginx/templates/ph.conf.erb b/modules/nginx/templates/ph.conf.erb index a5f6386..a51c25f 100644 --- a/modules/nginx/templates/ph.conf.erb +++ b/modules/nginx/templates/ph.conf.erb @@ -18,9 +18,6 @@ server { fastcgi_pass localhost:9000; fastcgi_index index.php; - #custom environment variable - fastcgi_param PHABRICATOR_ENV "custom/myconfig"; - #required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200; diff --git a/modules/phabricator/files/local.json b/modules/phabricator/files/local.json new file mode 100644 index 0000000..0c8f225 --- /dev/null +++ b/modules/phabricator/files/local.json @@ -0,0 +1,12 @@ +{ + "environment.append-paths" : [ + "\/bin", + "\/usr\/bin", + "\/usr\/local\/bin" + ], + "repository.default-local-path" : "\/home\/vagrant", + "mysql.pass" : "root", + "mysql.user" : "root", + "mysql.host" : "127.0.0.1", + "phabricator.base-uri" : "http:\/\/ph.dev" +} diff --git a/modules/phabricator/manifests/init.pp b/modules/phabricator/manifests/init.pp new file mode 100644 index 0000000..48b519f --- /dev/null +++ b/modules/phabricator/manifests/init.pp @@ -0,0 +1,14 @@ +# -*- tab-width: 2; indent-tabs-mode: nil -*- +# vim: set tabstop=2 shiftwidth=2 softtabstop=2 expandtab: + +class phabricator { + file { '/vagrant/phabricator/conf/local/ENVIRONMENT': + ensure => present, + content => 'development' + } + + file { '/vagrant/phabricator/conf/local/local.json': + ensure => present, + source => 'puppet:///modules/phabricator/local.json' + } +} diff --git a/modules/php/manifests/init.pp b/modules/php/manifests/init.pp index 6dcfea4..50b6489 100644 --- a/modules/php/manifests/init.pp +++ b/modules/php/manifests/init.pp @@ -16,5 +16,14 @@ enable => true } + ini_setting { 'fpm/pool.d/www.conf listen': + ensure => present, + path => '/etc/php5/fpm/pool.d/www.conf', + section => 'www', + setting => 'listen', + value => '127.0.0.1:9000', + notify => Service['php5-fpm'] + } + Package['php5-fpm'] -> Service['php5-fpm'] }