Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist: Support SmartOS #60

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ 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)


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

[iojs-build-smartos]
iojs-build-smartos ansible_python_interpreter=/opt/local/bin/python ansible_ssh_user=root ansible_ssh_host=165.225.129.118

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

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

Note that these hostnames are also used in the *[ansible-inventory](http://docs.ansible.com/intro_inventory.html)* 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.
70 changes: 70 additions & 0 deletions setup/smartos/ansible-playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
- hosts: iojs-build-smartos

remote_user: root

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 | 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
15 changes: 15 additions & 0 deletions setup/smartos/ansible-vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
server_user: iojs
ssh_users:
- geek
- rvagg
- jbergstroem
packages:
- openjdk7-1.7.65
- git-2.1.0
- gcc49-4.9.1
- gcc49-libs-4.9.1nb1
- gccmakedep-1.0.3
- gmake-4.0
- automake-1.14.1nb1
- libtool-2.4.2nb2
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-*
58 changes: 58 additions & 0 deletions setup/smartos/resources/jenkins_manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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='smartos' />
</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-walmart-smartos14-{{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>