couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Belrose <kafe...@gmail.com>
Subject Ansible plumbing for building RPMs
Date Sun, 17 Jan 2016 12:49:00 GMT
Hi all, 

Some time ago, I have written some Ansible playbooks and roles to build RPMs for CouchDB 1.6.1
(CouchDB itself and SpiderMonkey 1.85). I’ve focused on CentOS 6.x as this is the environment
that we use in production (we are not on CentOS 7 yet). The RPMs are built with FPM (https://github.com/jordansissel/fpm
<https://github.com/jordansissel/fpm>) which is quite easy to use ( I am no RPM expert,
but it seems to work just fine). I’ve done a quick check, and the same approach seems to
work fine when building CouchDB 2.0 from the latest Github sources. Essentially I do the following
(via Jenkins): I spin a CentOS VM which is my build server. I then execute the Ansible playbook
on that build server to build the RPMs for SpiderMonkey and CouchDB. The RPMs can then be
fetched via SSH or HTTP. 

You can have a look at [1] to see the kind of work the Ansible playbook does (this won’t
work out of the box as it needs other files, but I just want to illustrate roughly how it
works).

As I am investigating CouchDB 2.x, I am planning on writing a new version to support 2.0,
I am more than happy to share it as well.

[1] 

---
- name: create the directory to store the RPMs
  file: path={{ RPMS_DIRECTORY }} state=directory 

- name: install build tools
  yum: name={{ item }}
  with_items:
  - zip
  - unzip
  - rpm-build

- name: check if fpm is already installed
  shell: gem list fpm --version {{ FPM_VERSION }} -i
  ignore_errors: true
  register: check_fpm

- include: install_fpm.yaml
  when: check_fpm.stdout.find('true')==-1

- name: download the source code for Mozilla SpiderMonkey 1.85
  get_url: url=http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz dest=/tmp

- name: unarchive the tar file
  shell: chdir=/tmp tar -xzf js185-1.0.0.tar.gz

- name: compile Mozilla SpiderMonkey 1.8.5
  shell: chdir=/tmp/js-1.8.5/js/src {{ item }}
  with_items:
  - ./configure
  - make --silent 
  - make DESTDIR=install --silent install 

- name: fix the libmozjs185.so.1.0 symlink
  file: state=link path=/tmp/js-1.8.5/js/src/install/usr/local/lib/libmozjs185.so.1.0 src=libmozjs185.so.1.0.0
force=yes
  tags: fix_symlink1

- name: fix the libmozjs185.so symlink
  file: state=link path=/tmp/js-1.8.5/js/src/install/usr/local/lib/libmozjs185.so src=libmozjs185.so.1.0
force=yes
  tags: fix_symlink2

- name: package Mozilla SpiderMonkey 1.8.5 as an rpm with fpm
  shell: fpm -s dir -t rpm -n js -v 1.85 -f -p {{ RPMS_DIRECTORY }} -C /tmp/js-1.8.5/js/src/install
usr 

- name: install SpiderMonkey from the RPM file (this is required in order to compile CouchDB)
  yum: name={{ RPMS_DIRECTORY }}/js-1.85-1.x86_64.rpm

- name: install Erlang
  yum: name=erlang

- name: download the source code for Apache CouchDB 1.6.1
  get_url: url=http://www.eu.apache.org/dist/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz
dest=/tmp

- name: unarchive the source code for Apache CouchDB 1.6.1
  shell: chdir=/tmp tar -xzf apache-couchdb-1.6.1.tar.gz

- name: install icu-devel
  yum: name=libicu-devel

- name: compile Apache Couchdb 1.6.1
  shell: chdir=/tmp/apache-couchdb-1.6.1 {{ item }}
  with_items:
  - ./configure --with-erlang=/usr/lib64/erlang/usr/include
  - make --silent
  - make DESTDIR=/tmp/couchdb --silent install

- name: package Apache CouchDB 1.6.1 as an rpm with fpm
  shell: fpm -s dir -t rpm -n couchdb -v 1.6.1 -f -p {{ RPMS_DIRECTORY }} -C /tmp/couchdb
usr

- name: install the Apache2 webserver 
  yum: name=httpd

- name: add a symlink to serve the RPMS via Apache2
  file: path=/var/www/html/rpms src={{ RPMS_DIRECTORY }} state=link

- name: ensure Apache2 is running
  service: name=httpd state=started

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message