[Groonga-commit] groonga/packages.groonga.org at 06efbc8 [master] packages.groonga.org is ready on ConoHa!

Zurück zum Archiv-Index

Kouhei Sutou null+****@clear*****
Sat Sep 27 21:35:02 JST 2014


Kouhei Sutou	2014-09-27 21:35:02 +0900 (Sat, 27 Sep 2014)

  New Revision: 06efbc8de363bd362635a4c0e73867282239d51e
  https://github.com/groonga/packages.groonga.org/commit/06efbc8de363bd362635a4c0e73867282239d51e

  Message:
    packages.groonga.org is ready on ConoHa!

  Added files:
    .dir-locals.el
    ansible/files/aliases
    ansible/files/create-snapshot-package.sh
    ansible/files/footer.html
    ansible/files/listchanges.conf
    ansible/files/main.cf
    hosts
  Modified files:
    Rakefile
    Vagrantfile
    ansible/playbook.yml
  Renamed files:
    ansible/files/packages.groonga.org.conf
      (from ansible/templates/packages.groonga.org.conf.j2)

  Added: .dir-locals.el (+2 -0) 100644
===================================================================
--- /dev/null
+++ .dir-locals.el    2014-09-27 21:35:02 +0900 (4c468e2)
@@ -0,0 +1,2 @@
+((sh-mode .  ((indent-tabs-mode . nil)
+              (sh-basic-offset  . 2))))

  Modified: Rakefile (+7 -0)
===================================================================
--- Rakefile    2014-09-27 19:47:31 +0900 (68f94b2)
+++ Rakefile    2014-09-27 21:35:02 +0900 (d1990e8)
@@ -6,3 +6,10 @@ RSpec::Core::RakeTask.new(:spec) do |t|
 end
 
 task :default => :spec
+
+desc "Apply the Ansible configurations"
+task :deploy do
+  sh("ansible-playbook",
+     "--inventory-file", "hosts",
+     "ansible/playbook.yml")
+end

  Modified: Vagrantfile (+1 -0)
===================================================================
--- Vagrantfile    2014-09-27 19:47:31 +0900 (431d82e)
+++ Vagrantfile    2014-09-27 21:35:02 +0900 (2090c2c)
@@ -14,6 +14,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
       ansible.groups = {
         "package-servers" => [name],
       }
+      ansible.host_key_checking = false
     end
   end
 end

  Added: ansible/files/aliases (+2 -0) 100644
===================================================================
--- /dev/null
+++ ansible/files/aliases    2014-09-27 21:35:02 +0900 (3c43518)
@@ -0,0 +1,2 @@
+root: packages �� groonga.org
+postmaster: root

  Added: ansible/files/create-snapshot-package.sh (+148 -0) 100755
===================================================================
--- /dev/null
+++ ansible/files/create-snapshot-package.sh    2014-09-27 21:35:02 +0900 (83d3202)
@@ -0,0 +1,148 @@
+#!/bin/zsh
+
+set -u
+set -e
+
+run()
+{
+  "$@"
+  if test $? -ne 0; then
+    echo "Failed $@"
+    exit 1
+  fi
+}
+
+keep_n_days=7
+mysql_version=5.6.21
+
+today=$(date +%Y.%m.%d)
+mysql_base="mysql-${mysql_version}"
+
+run mkdir -p ~/work/
+
+output_dir="${HOME}/public/nightly/"
+run mkdir -p "${output_dir}"
+
+#rm -rf ~/work/nightly/
+#mkdir -p ~/work/nightly/
+
+export PKG_CONFIG_PATH=$HOME/work/nightly/lib/pkgconfig
+
+build_mysql() {
+  run cd ~/work/
+  if [ -d "${mysql_base}" ]; then
+    return 0
+  fi
+
+  mysql_tar_gz="${mysql_base}.tar.gz"
+  if [ ! -f "${mysql_tar_gz}" ]; then
+    download_base=http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6
+    run wget --quiet "${download_base}/${mysql_tar_gz}"
+  fi
+
+  run tar xf "${mysql_tar_gz}"
+  run cd "${mysql_base}"
+  run cmake . -DWITH_DEBUG=yes -DCMAKE_INSTALL_PREFIX=$HOME/work/nightly \
+    > cmake.log
+  run make > make.log 2> make.error.log
+}
+
+create_nightly_build() {
+  github_org=$1; shift
+  project_name=$1; shift
+  need_install=$1; shift
+  run cd ~/work
+  if [ ! -d ${project_name} ]; then
+    run git clone --quiet --recursive \
+      https://github.com/${github_org}/${project_name}.git
+    run cd ${project_name}
+    run ./autogen.sh > /dev/null
+    run cd -
+  else
+    run cd ${project_name}
+    run git checkout --quiet .
+    run git pull --quiet --rebase
+    run git submodule update --init
+    run ./autogen.sh > /dev/null
+    run cd -
+  fi
+  run cd ${project_name}
+  released_version=$(git describe --abbrev=0 | sed -e 's/^v//')
+  run cd -
+  version="${released_version}.${today}"
+  run rm -rf ${project_name}.build
+  run mkdir -p ${project_name}.build
+  run cd ${project_name}.build
+  run ../${project_name}/configure \
+    CFLAGS="-O0" CXXFLAGS="-O0" \
+    --prefix=$HOME/work/nightly \
+    "$@" \
+    > configure.log
+  run make > make.log 2> make.error.log
+  if [ "$need_install" = "yes" ]; then
+    run make install > /dev/null
+  fi
+  run make dist > /dev/null
+  run mkdir -p tmp
+  cd tmp
+  run tar xf ../*.tar.gz
+  run mv ${project_name}-* ${project_name}-${version}
+  run tar cfz ${project_name}-${version}.tar.gz ${project_name}-${version}
+  run mv ${project_name}-${version}.tar.gz ~/public/nightly/
+}
+
+package_mariadb_with_mroonga() {
+  run cd ~/work/mroonga.build/packages/source
+  groonga_tar_gz=$(echo ~/public/nightly/groonga-[0-9]*.${today}.tar.gz)
+  groonga_normalizer_mysql_tar_gz=$(echo ~/public/nightly/groonga-normalizer-mysql-[0-9]*.${today}.tar.gz)
+  run mkdir -p tmp/
+  run cp ${groonga_tar_gz} tmp/
+  run cp ${groonga_normalizer_mysql_tar_gz} tmp/
+  groonga_version=${groonga_tar_gz:t:r:r:s/groonga-//}
+  groonga_normalizer_mysql_version=${groonga_normalizer_mysql_tar_gz:t:r:r:s/groonga-normalizer-mysql-//}
+  run make archive \
+      GROONGA_VERSION=${groonga_version} \
+      GROONGA_NORMALIZER_MYSQL_VERSION=${groonga_normalizer_mysql_version} \
+      > /dev/null
+  for archive in files/mariadb-*.zip; do
+    run rm -rf tmp
+    run mkdir -p tmp
+    run cd tmp
+    run unzip -q ../${archive}
+    base_name=$(echo mariadb-*)
+    new_base_name=${base_name}.${today}
+    run mv ${base_name} ${new_base_name}
+    run zip -q -r ${new_base_name}.zip ${new_base_name}
+    run mv ${new_base_name}.zip ~/public/nightly/
+    run cd -
+  done
+  for archive in files/mariadb-*.tar.gz; do
+    run rm -rf tmp
+    run mkdir -p tmp
+    run cd tmp
+    run tar xzf ../${archive}
+    base_name=$(echo mariadb-*)
+    new_base_name=${base_name}.${today}
+    run mv ${base_name} ${new_base_name}
+    run tar czf ${new_base_name}.tar.gz ${new_base_name}
+    run mv ${new_base_name}.tar.gz ~/public/nightly/
+    run cd -
+  done
+}
+
+create_nightly_build groonga groonga yes \
+    --without-cutter \
+    --enable-document \
+    --with-ruby \
+    --enable-mruby
+create_nightly_build groonga groonga-normalizer-mysql yes
+build_mysql
+create_nightly_build mroonga mroonga no \
+  --without-cutter \
+  --enable-document \
+  --with-mysql-source="$HOME/work/${mysql_base}" \
+  --with-mysql-config="$HOME/work/${mysql_base}/scripts/mysql_config"
+package_mariadb_with_mroonga
+
+run find "${output_dir}/" -maxdepth 1 -type f -ctime +${keep_n_days} -print0 | \
+  run xargs --null --no-run-if-empty rm

  Added: ansible/files/footer.html (+2 -0) 100644
===================================================================
--- /dev/null
+++ ansible/files/footer.html    2014-09-27 21:35:02 +0900 (efb1a44)
@@ -0,0 +1,2 @@
+<p>Powered by <a href="https://www.conoha.jp/">ConoHa</a>.</p>
+<p>We're using <a href="https://www.conoha.jp/community">ConoHa support program</a>. Thanks!!!</p>

  Added: ansible/files/listchanges.conf (+6 -0) 100644
===================================================================
--- /dev/null
+++ ansible/files/listchanges.conf    2014-09-27 21:35:02 +0900 (7305864)
@@ -0,0 +1,6 @@
+[apt]
+frontend=mail
+email_address=root
+confirm=0
+save_seen=/var/lib/apt/listchanges.db
+which=news

  Added: ansible/files/main.cf (+28 -0) 100644
===================================================================
--- /dev/null
+++ ansible/files/main.cf    2014-09-27 21:35:02 +0900 (048ec0d)
@@ -0,0 +1,28 @@
+smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
+biff = no
+
+# appending .domain is the MUA's job.
+append_dot_mydomain = no
+
+readme_directory = no
+
+# TLS parameters
+smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
+smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
+smtpd_use_tls=yes
+smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
+smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
+
+smtpd_relay_restrictions =
+  permit_mynetworks
+  permit_sasl_authenticated
+  defer_unauth_destination
+myhostname = packages.groonga.org
+alias_maps = hash:/etc/aliases
+alias_database = hash:/etc/aliases
+myorigin = /etc/mailname
+mydestination = packages.groonga.org, localhost
+mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
+mailbox_size_limit = 0
+recipient_delimiter = +
+inet_interfaces = loopback-only

  Renamed: ansible/files/packages.groonga.org.conf (+8 -1) 87%
===================================================================
--- ansible/templates/packages.groonga.org.conf.j2    2014-09-27 19:47:31 +0900 (304c4b6)
+++ ansible/files/packages.groonga.org.conf    2014-09-27 21:35:02 +0900 (8df67f5)
@@ -9,7 +9,14 @@
 	ServerName packages.groonga.org
 
 	ServerAdmin packages �� groonga.org
-	DocumentRoot /var/www/html
+
+	DocumentRoot /home/packages/public
+	<Directory /home/packages/public/>
+		Options Indexes FollowSymLinks
+		AllowOverride None
+		Require all granted
+		ReadmeName /footer.html
+	</Directory>
 
 	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
 	# error, crit, alert, emerg.

  Modified: ansible/playbook.yml (+101 -1)
===================================================================
--- ansible/playbook.yml    2014-09-27 19:47:31 +0900 (5ede113)
+++ ansible/playbook.yml    2014-09-27 21:35:02 +0900 (124c2da)
@@ -1,16 +1,116 @@
 - hosts: package-servers
   sudo: yes
   tasks:
+    # Base
+    - name: Upgrade packages
+      apt:
+        update_cache=yes
+        cache_valid_time=3600
+        upgrade=safe
+    - name: Install base packages
+      apt: name={{ item }}
+      with_items:
+        - apt-listchanges
+        - vim
+        - zsh
+        - lv
+    - name: Use VIM as the default editor
+      command: update-alternatives --set editor /usr/bin/vim.basic
+    - name: Use e-mail for apt-listchanges
+      copy:
+        src=files/listchanges.conf
+        dest=/etc/apt/listchanges.conf
+
+    # User
+    - name: Install "packages" user
+      user: name=packages
+    - name: Create directories
+      file:
+        path=/home/packages/{{ item }}
+        state=directory
+        owner=packages
+        group=packages
+      with_items:
+        - bin/
+        - public/
+    - name: Put ~packages/.forward
+      copy:
+        content="packages �� groonga.org"
+        dest=~packages/.forward
+        owner=packages
+        group=packages
+
+    # Apache
     - 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
+      copy:
+        src=files/packages.groonga.org.conf
+        dest=/etc/apache2/sites-available/packages.groonga.org.conf
+    - name: Put footer file
+      copy:
+        src=files/footer.html
+        dest=/home/packages/public/footer.html
+        owner=packages
+        group=packages
     - name: Enable our Apache configuration
       command: a2ensite packages.groonga.org
     - name: Disable default Apache configuration
       command: a2dissite 000-default
       notify:
         - Restart Apache
+
+    # Postfix
+    - name: Install Postfix
+      apt: name=postfix
+    - name: Set /etc/aliases
+      copy:
+        src=files/aliases
+        dest=/etc/aliases
+      notify:
+        - Update /etc/aliases
+    - name: Set /etc/mailname
+      copy:
+        content="packages.groonga.org"
+        dest=/etc/mailname
+    - name: Put Postfix configuration
+      copy:
+        src=files/main.cf
+        dest=/etc/postfix/main.cf
+      notify:
+        - Restart Postfix
+
+    # Nightly package builder
+    - name: Install packages for nightly package builder
+      apt: name={{ item }}
+      with_items:
+        - git
+        - zsh
+        - autoconf
+        - libtool
+        - gcc
+        - g++
+        - make
+        - python-sphinx
+        - ruby
+    - name: Install nightly package builder
+      copy:
+        src=files/create-snapshot-package.sh
+        dest=/home/packages/bin/
+        owner=packages
+        group=packages
+        mode=0755
+    - name: Install cron
+      cron:
+        special_time: daily
+        name: Create nightly package
+        job: ~packages/bin/create-snapshot-package.sh
+        user: packages
+
   handlers:
     - name: Restart Apache
       service: name=apache2 state=restarted
+    - name: Update /etc/aliases
+      command: postalias /etc/aliases
+    - name: Restart Postfix
+      service: name=postfix state=restarted

  Added: hosts (+2 -0) 100644
===================================================================
--- /dev/null
+++ hosts    2014-09-27 21:35:02 +0900 (eea6309)
@@ -0,0 +1,2 @@
+[package-servers]
+157.7.238.131
-------------- next part --------------
HTML����������������������������...
Download 



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