[Groonga-commit] groonga/packages.groonga.org at 3261d6e [master] Set up base build system

Zurück zum Archiv-Index

Kouhei Sutou null+****@clear*****
Fri Sep 26 23:05:55 JST 2014


Kouhei Sutou	2014-09-26 23:05:55 +0900 (Fri, 26 Sep 2014)

  New Revision: 3261d6eebb7c6de0d2af1df78a2d8c43b3c5f95c
  https://github.com/groonga/packages.groonga.org/commit/3261d6eebb7c6de0d2af1df78a2d8c43b3c5f95c

  Message:
    Set up base build system

  Added files:
    .gitignore
    .rspec
    .travis.yml
    Gemfile
    README.md
    Rakefile
    Vagrantfile
    ansible/playbook.yml
    ansible/templates/packages.groonga.org.conf.j2
    spec/packages.groonga.org/apatche2_spec.rb
    spec/spec_helper.rb

  Added: .gitignore (+2 -0) 100644
===================================================================
--- /dev/null
+++ .gitignore    2014-09-26 23:05:55 +0900 (c1aab45)
@@ -0,0 +1,2 @@
+/.vagrant/
+/vagrant_ansible_*

  Added: .rspec (+1 -0) 100644
===================================================================
--- /dev/null
+++ .rspec    2014-09-26 23:05:55 +0900 (4e1e0d2)
@@ -0,0 +1 @@
+--color

  Added: .travis.yml (+5 -0) 100644
===================================================================
--- /dev/null
+++ .travis.yml    2014-09-26 23:05:55 +0900 (4f89b92)
@@ -0,0 +1,5 @@
+notifications:
+  recipients:
+    - groonga-commit �� lists.sourceforge.jp
+before_install:
+  - sudo apt-get install -qq -y -V vagrant ansible

  Added: Gemfile (+4 -0) 100644
===================================================================
--- /dev/null
+++ Gemfile    2014-09-26 23:05:55 +0900 (951b30d)
@@ -0,0 +1,4 @@
+source "https://rubygems.org/"
+
+gem "rake"
+gem "serverspec"

  Added: README.md (+9 -0) 100644
===================================================================
--- /dev/null
+++ README.md    2014-09-26 23:05:55 +0900 (26886e5)
@@ -0,0 +1,9 @@
+# README
+
+This repository is for packages.groonga.org.
+
+## How to test
+
+    % sudo apt install -V vagrant ansible
+    % bundle install
+    % rake

  Added: Rakefile (+8 -0) 100644
===================================================================
--- /dev/null
+++ Rakefile    2014-09-26 23:05:55 +0900 (68f94b2)
@@ -0,0 +1,8 @@
+require "rake"
+require "rspec/core/rake_task"
+
+RSpec::Core::RakeTask.new(:spec) do |t|
+  t.pattern = "spec/**/*_spec.rb"
+end
+
+task :default => :spec

  Added: Vagrantfile (+19 -0) 100644
===================================================================
--- /dev/null
+++ Vagrantfile    2014-09-26 23:05:55 +0900 (431d82e)
@@ -0,0 +1,19 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  name = "packages.groonga.org"
+  config.vm.define(name) do |node|
+    node.vm.box = "ubuntu-14.04-x86_64"
+    node.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box"
+    node.vm.provision :ansible do |ansible|
+      ansible.playbook = "ansible/playbook.yml"
+      ansible.groups = {
+        "package-servers" => [name],
+      }
+    end
+  end
+end

  Added: ansible/playbook.yml (+16 -0) 100644
===================================================================
--- /dev/null
+++ ansible/playbook.yml    2014-09-26 23:05:55 +0900 (5ede113)
@@ -0,0 +1,16 @@
+- hosts: package-servers
+  sudo: yes
+  tasks:
+    - name: Install Apache
+      apt: name=apache2
+    - name: Put Apache configuration
+      template: src=templates/packages.groonga.org.conf.j2 dest=/etc/apache2/sites-available/packages.groonga.org.conf
+    - name: Enable our Apache configuration
+      command: a2ensite packages.groonga.org
+    - name: Disable default Apache configuration
+      command: a2dissite 000-default
+      notify:
+        - Restart Apache
+  handlers:
+    - name: Restart Apache
+      service: name=apache2 state=restarted

  Added: ansible/templates/packages.groonga.org.conf.j2 (+31 -0) 100644
===================================================================
--- /dev/null
+++ ansible/templates/packages.groonga.org.conf.j2    2014-09-26 23:05:55 +0900 (304c4b6)
@@ -0,0 +1,31 @@
+<VirtualHost *:80>
+	# The ServerName directive sets the request scheme, hostname and port that
+	# the server uses to identify itself. This is used when creating
+	# redirection URLs. In the context of virtual hosts, the ServerName
+	# specifies what hostname must appear in the request's Host: header to
+	# match this virtual host. For the default virtual host (this file) this
+	# value is not decisive as it is used as a last resort host regardless.
+	# However, you must set it for any further virtual host explicitly.
+	ServerName packages.groonga.org
+
+	ServerAdmin packages �� groonga.org
+	DocumentRoot /var/www/html
+
+	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
+	# error, crit, alert, emerg.
+	# It is also possible to configure the loglevel for particular
+	# modules, e.g.
+	#LogLevel info ssl:warn
+
+	ErrorLog ${APACHE_LOG_DIR}/error.log
+	CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+	# For most configuration files from conf-available/, which are
+	# enabled or disabled at a global level, it is possible to
+	# include a line for only one particular virtual host. For example the
+	# following line enables the CGI configuration for this host only
+	# after it has been globally disabled with "a2disconf".
+	#Include conf-available/serve-cgi-bin.conf
+</VirtualHost>
+
+# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

  Added: spec/packages.groonga.org/apatche2_spec.rb (+19 -0) 100644
===================================================================
--- /dev/null
+++ spec/packages.groonga.org/apatche2_spec.rb    2014-09-26 23:05:55 +0900 (99045ee)
@@ -0,0 +1,19 @@
+require "spec_helper"
+
+describe package("apache2") do
+  it {should be_installed}
+end
+
+describe service("apache2") do
+  it {should be_enabled}
+  it {should be_running}
+end
+
+describe port(80) do
+  it {should be_listening}
+end
+
+describe file("/etc/apache2/sites-enabled/packages.groonga.org.conf") do
+  it {should be_file}
+  its(:content) {should match /ServerName packages.groonga.org/}
+end

  Added: spec/spec_helper.rb (+43 -0) 100644
===================================================================
--- /dev/null
+++ spec/spec_helper.rb    2014-09-26 23:05:55 +0900 (1a6f446)
@@ -0,0 +1,43 @@
+require "serverspec"
+require "pathname"
+require "net/ssh"
+
+include SpecInfra::Helper::Ssh
+include SpecInfra::Helper::DetectOS
+
+RSpec.configure do |c|
+  if ENV["ASK_SUDO_PASSWORD"]
+    require "highline/import"
+    c.sudo_password = ask("Enter sudo password: ") { |q| q.echo = false }
+  else
+    c.sudo_password = ENV["SUDO_PASSWORD"]
+  end
+  c.before :all do
+    block = self.class.metadata[:block]
+    file = block.source_location.first
+    host = File.basename(Pathname.new(file).dirname)
+    if c.host != host
+      c.ssh.close if c.ssh
+      c.host  = host
+      options = Net::SSH::Config.for(c.host)
+      user    = options[:user] || Etc.getlogin
+      system("vagrant", "up", host)
+      system("vagrant", "provision", host)
+      config = `vagrant ssh-config #{host}`
+      if config != ""
+        config.each_line do |line|
+          if match = /HostName (.*)/.match(line)
+            host = match[1]
+          elsif  match = /User (.*)/.match(line)
+            user = match[1]
+          elsif match = /IdentityFile (.*)/.match(line)
+            options[:keys] =  [match[1].gsub(/"/,"")]
+          elsif match = /Port (.*)/.match(line)
+            options[:port] = match[1]
+          end
+        end
+      end
+      c.ssh = Net::SSH.start(host, user, options)
+    end
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index