diff --git a/setup/ansible-inventory b/setup/ansible-inventory index 5dae0328f..8268b7ae7 100644 --- a/setup/ansible-inventory +++ b/setup/ansible-inventory @@ -38,6 +38,15 @@ iojs-build-freebsd101-64-1 iojs-build-containers-1 iojs-build-containers-2 +[iojs-raspbian] +iojs-ns-pi1-1 +iojs-ns-pi1-2 +iojs-ns-pi1p-1 +iojs-ns-pi2-1 +iojs-ns-pi2-2 +iojs-ns-pi2-3 +iojs-ns-pi2-4 + [iojs-www] iojs-www diff --git a/setup/raspberry-pi/README.md b/setup/raspberry-pi/README.md new file mode 100644 index 000000000..54a556b84 --- /dev/null +++ b/setup/raspberry-pi/README.md @@ -0,0 +1,26 @@ +# io.js Build Raspberry Pi Setup + +For setting up Raspberry Pi boxes + +```text +Host iojs-ns-pi1-1 + HostName xx.xx.xx.xx + User pi +... +``` + +Note that these hostnames are also used in the *ansible-inventory* file. The IP addresses will need to be updated each time the servers are reprovisioned. + +To set up a host, run: + +```text +$ ansible-playbook -i ../ansible-inventory ansible-playbook.yaml +``` + +Start-up of the Jenkins slaves is manual (for now), run: + +```text +$ ssh iojs@iojs-ns-pi1-1 ./start.sh +``` + +**Users**: The ansible-vars.yaml file contains a list of users who's GitHub public keys are pulled and placed into authorized_keys for both root and iojs users. This file should be updates when new users are added to the build project who are able to help maintain the containerized builds. diff --git a/setup/raspberry-pi/ansible-playbook.yaml b/setup/raspberry-pi/ansible-playbook.yaml new file mode 100644 index 000000000..5c99e0477 --- /dev/null +++ b/setup/raspberry-pi/ansible-playbook.yaml @@ -0,0 +1,80 @@ +--- +- hosts: iojs-raspbian + sudo: yes + + tasks: + + - include_vars: ansible-vars.yaml + tags: vars + + - name: General | APT Update + apt: update_cache=yes + tags: general + + - name: General | APT Upgrade + apt: upgrade=dist + tags: general + + - name: General | Install required packages + apt: name={{ item }} update_cache=yes state=latest + with_items: packages + tags: general + + - name: General | update-alternatives for gcc + alternatives: name=gcc link=/usr/bin/gcc path=/usr/bin/gcc-4.8 + + - name: General | update-alternatives for cc + alternatives: name=cc link=/usr/bin/cc path=/usr/bin/gcc-4.8 + + - name: General | update-alternatives for g++ + alternatives: name=g++ link=/usr/bin/g++ path=/usr/bin/g++-4.8 + + - name: General | update-alternatives for c++ + alternatives: name=c++ link=/usr/bin/c++ path=/usr/bin/g++-4.8 + + - name: General | update-alternatives for cpp + alternatives: name=cpp link=/usr/bin/cpp path=/usr/bin/g++-4.8 + + - name: General | Increase file descriptor limits + lineinfile: dest=/etc/security/limits.conf line="{{ item }}" + with_items: + - "* hard nofile 500000" + - "* soft nofile 500000" + - "root hard nofile 500000" + - "root soft nofile 500000" + tags: general + + - name: User | Add {{ server_user }} user + user: name="{{ server_user }}" shell=/bin/bash + tags: user + + - name: User | Download pubkey(s) + get_url: url=https://github.com/{{ item }}.keys dest=/tmp/{{ item }}.keys + delegate_to: 127.0.0.1 + with_items: ssh_users + tags: user + + - name: General | Create authorized_keys for {{ server_user }} + authorized_key: user="{{ server_user }}" key="{{ lookup('file', '/tmp/' + item + '.keys') }}" + with_items: ssh_users + tags: user + + - name: Jenkins | Download Jenkins' slave.jar to {{ server_user }} + command: curl -sL https://jenkins-iojs.nodesource.com/jnlpJars/slave.jar -o /home/{{ server_user }}/slave.jar + tags: jenkins + + - name: Jenkins | Copy start.sh script + copy: src=./resources/start.sh dest=/home/{{ server_user }}/start.sh owner={{ server_user }} group={{ server_user }} mode=0755 + tags: jenkins + + - name: Jenkins | Copy secrets to start.sh script + replace: dest=/home/{{ server_user }}/start.sh regexp="\{\{secret\}\}" replace="{{ server_secret }}" + tags: jenkins + + - name: Jenkins | Copy server ids to start.sh script + replace: dest=/home/{{ server_user }}/start.sh regexp="\{\{id\}\}" replace="{{ server_id }}" + tags: jenkins + + - name: Jenkins | Copy arch to start.sh script + replace: dest=/home/{{ server_user }}/start.sh regexp="\{\{server_arch\}\}" replace="{{ server_arch }}" + tags: jenkins diff --git a/setup/raspberry-pi/ansible-vars.yaml b/setup/raspberry-pi/ansible-vars.yaml new file mode 100644 index 000000000..d072f2c3b --- /dev/null +++ b/setup/raspberry-pi/ansible-vars.yaml @@ -0,0 +1,17 @@ +--- +server_user: iojs +ssh_users: + - rvagg + - wblankenship + - jbergstrom +packages: + - openjdk-7-jre + - python-all + - python-software-properties + - automake + - libtool + - curl + - git + - gcc-4.8 + - g++-4.8 + - ccache diff --git a/setup/raspberry-pi/host_vars/.gitignore b/setup/raspberry-pi/host_vars/.gitignore new file mode 100644 index 000000000..78db71e9f --- /dev/null +++ b/setup/raspberry-pi/host_vars/.gitignore @@ -0,0 +1 @@ +iojs-* diff --git a/setup/raspberry-pi/resources/start.sh b/setup/raspberry-pi/resources/start.sh new file mode 100644 index 000000000..bf63baad4 --- /dev/null +++ b/setup/raspberry-pi/resources/start.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +rm -f nohup.out +ARCH={{server_arch}} DESTCPU=arm PATH=/usr/lib/ccache/:$PATH JOBS=1 NODE_COMMON_PIPE=/home/iojs/test.pipe OSTYPE=linux-gnu nohup java -jar slave.jar -jnlpUrl https://jenkins-iojs.nodesource.com/computer/iojs-nodesource-raspbian-wheezy-{{id}}/slave-agent.jnlp -secret {{secret}} &