Skip to content

Commit

Permalink
dist: Support SmartOS
Browse files Browse the repository at this point in the history
Add two new buildbots with hardware support from Joyent.
Most work from @geek. Closes #64.

PR-URL: #64
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
jbergstroem committed Mar 14, 2015
1 parent 6a10343 commit eecc421
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ The following companies are contributing hardware to this project:
* [DigitalOcean](http://digitalocean.com/) (via Mikeal Rogers)
* [Rackspace](http://rackspace.com/) (via Paul Querna)
* [IBM](http://www.ibm.com/) / [Softlayer](http://www.softlayer.com/) (via Dave Ings and Andrew Low)
* [Walmart](http://www.walmartlabs.com/) (via Wyatt Preul)
* [Joyent](http://joyent.com/) (via TJ Fontaine)


People
Expand Down
7 changes: 7 additions & 0 deletions setup/ansible-inventory
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ iojs-build-ubuntu1204-64-1
iojs-build-ubuntu1004-64-1
iojs-build-ubuntu1004-32-1

[iojs-build-smartos]
iojs-build-smartos-64-1
iojs-build-smartos-32-1

[iojs-build-containers]
iojs-build-containers-1
iojs-build-containers-2
Expand All @@ -47,3 +51,6 @@ iojs-jenkins
iojs-build-centos7
iojs-build-centos6
iojs-build-centos5

[iojs-smartos:children]
iojs-build-smartos
24 changes: 24 additions & 0 deletions setup/smartos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# io.js Build SmartOS Setup

To set up hosts, make sure you add them to your ssh config first:
```
Host iojs-build-smartos-64-1
HostName 165.225.137.91
User root
Host iojs-build-smartos-32-1
HostName 165.225.138.254
User root
```

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
```

**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.
77 changes: 77 additions & 0 deletions setup/smartos/ansible-playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
- hosts: iojs-build-smartos

remote_user: root

vars:
- ansible_python_interpreter: "/usr/bin/env python"

tasks:

- include_vars: ansible-vars.yaml
tags: vars

- name: General | pkgin Update
command: pkgin up
tags: general

- name: General | Install required packages
command: pkgin -y in {{ item }}
with_items: packages
tags: general

- name: User | Add {{ server_user }} group
command: groupadd {{ server_user }}
tags: user

- name: User | Add {{ server_user }} user
user: name="{{ server_user }}" shell=/bin/bash append=yes groups=staff,{{ server_user }}
tags: user

- name: User | Unlock {{ server_user }} user
command: passwd -N {{ server_user }}
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 root
authorized_key: user="root" key="{{ lookup('file', '/tmp/' + item + '.keys') }}"
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
command: curl -sL https://jenkins-iojs.nodesource.com/jnlpJars/slave.jar -o /home/{{ server_user }}/slave.jar
tags: jenkins

- name: Jenkins | Copy SMF manifest
copy: src=./resources/jenkins_manifest.xml dest=/home/{{ server_user }}/jenkins_manifest.xml owner={{ server_user }} group={{ server_user }} mode=0755
tags: jenkins

- name: Jenkins | Copy secrets into manifest
replace: dest=/home/{{ server_user }}/jenkins_manifest.xml regexp="\{\{secret\}\}" replace="{{ server_secret }}"
tags: jenkins

- name: Jenkins | Copy server id into manifest
replace: dest=/home/{{ server_user }}/jenkins_manifest.xml regexp="\{\{id\}\}" replace="{{ server_id }}"
tags: jenkins

- name: Jenkins | Copy destination cpu architecture into manifest
replace: dest=/home/{{ server_user }}/jenkins_manifest.xml regexp="\{\{destcpu\}\}" replace="{{ destcpu }}"
tags: jenkins

- name: Jenkins | Import jenkins SMF manifest
command: svccfg -v import /home/{{ server_user }}/jenkins_manifest.xml
tags: jenkins

- name: Jenkins | Start service
command: svcadm enable svc:/application/jenkins:default
tags: jenkins
18 changes: 18 additions & 0 deletions setup/smartos/ansible-vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
server_user: iojs
# override through host_vars if needed. we need it since we currently
# run 32-bit tests on a 64-bit host. default is 64-bit.
destcpu: x64
ssh_users:
- geek
- rvagg
- jbergstroem
packages:
- openjdk7
- git
- gcc49
- gcc49-libs
- gccmakedep
- gmake
- automake
- libtool
1 change: 1 addition & 0 deletions setup/smartos/host_vars/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
iojs-build-smartos-*
61 changes: 61 additions & 0 deletions setup/smartos/resources/jenkins_manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='jenkins'>
<service name='application/jenkins' type='service' version='1'>

<create_default_instance enabled='true' />

<single_instance />

<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default' />
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>

<method_context working_directory="/home/iojs">
<method_credential user='iojs' group='iojs' privileges='basic,net_privaddr' />
<method_environment>
<envvar name='NODE_COMMON_PIPE' value='/home/iojs/test.pipe' />
<envvar name='OSTYPE' value='solaris' />
<envvar name='JOBS' value='8' />
<envvar name='DESTCPU' value='{{destcpu}}' />
<envvar name='PATH' value='/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin' />
</method_environment>
</method_context>

<exec_method type='method'
name='start'
exec='/opt/local/bin/java -Xmx512m -jar slave.jar -jnlpUrl https://jenkins-iojs.nodesource.com/computer/iojs-joyent-smartos-{{id}}/slave-agent.jnlp -secret {{secret}} >> /home/iojs/jenkins_console.log'
timeout_seconds='60' />

<exec_method type="method"
name="stop"
exec=":kill"
timeout_seconds="60" />

<exec_method name='refresh'
type='method'
exec=':kill -HUP'
timeout_seconds='60' />

<property_group name="startd" type="framework">
<propval name="duration" type="astring" value="child"/>
<propval name="ignore_error" type="astring" value="core,signal"/>
</property_group>

<property_group name="application" type="application"></property_group>

<stability value='Evolving' />

<template>
<common_name>
<loctext xml:lang='C'>Jenkins Continuous Build Server</loctext>
</common_name>
<documentation>
<doc_link name='hudson.dev.java.net' uri='http://jenkins-ci.org/' />
</documentation>
</template>
</service>
</service_bundle>

0 comments on commit eecc421

Please sign in to comment.