diff --git a/README.md b/README.md index 10a38fb6..e606d283 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ [![Build Status](https://travis-ci.org/servo/saltfs.svg)](https://travis-ci.org/servo/saltfs) -## What's going on? +## What's going on? Salt is a configuration management tool that we use to automate Servo's infrastructure. See [the tutorials](http://docs.saltstack.com/en/latest/topics/tutorials/) to get -started. +started. ## Contributing @@ -19,4 +19,4 @@ into trouble, file [an issue](https://github.com/servo/saltfs/issues/new)! ## Travis TravisCI is set up to test these configurations as described -[here](https://lambdaops.com/automation/travis/travis%20ci/configuration%20management/continuous%20integration/salt/chef/saltstack/salt%20stack/2014/01/29/travis-for-salt-states/). +[here](https://lambdaops.com/automation/travis/travis%20ci/configuration%20management/continuous%20integration/salt/chef/saltstack/salt%20stack/2014/01/29/travis-for-salt-states/). diff --git a/android-dependencies.sls b/android-dependencies.sls index a461ae90..ab907e4f 100644 --- a/android-dependencies.sls +++ b/android-dependencies.sls @@ -1,42 +1,23 @@ -{% if '64' in grains["cpuarch"] %} -#TODO: need to do these first on new ubuntus. -#dpkg --add-architecture i386 -#apt-get update -libc6:i386: - pkg: - - installed - -libstdc++6:i386: - pkg: - - installed -{% endif %} - -default-jdk: - pkg.installed - -ant: - pkg.installed - -s3cmd: - pip.installed - -expect: - pkg.installed - -gcc: - pkg.installed - -g++: - pkg.installed - -lib32z1: - pkg.installed - -libstdc++6: - pkg.installed - -libgl1-mesa-dev: - pkg.installed +android-dependencies: + pkg.installed: + - pkgs: + {% if '64' in grains['cpuarch'] %} + # TODO: need to do these first on new ubuntus. + # dpkg --add-architecture i386 + # apt-get update + - libc6:i386 + - libstdc++6:i386 + {% endif %} + - default-jdk + - ant + - expect + - gcc + - g++ + - lib32z1 + - libstdc++6 + - libgl1-mesa-dev + pip.installed: + - s3cmd android-sdk-download: file.managed: @@ -72,7 +53,7 @@ android-sdk-update: - watch: - cmd: android-sdk-download - require: - - pkg: default-jdk + - pkg: android-dependencies android-ndk-download: file.managed: @@ -81,20 +62,14 @@ android-ndk-download: - source_hash: sha1=87e159831a6759d5fb84545c445e551995185634 - user: servo - group: servo - -android-ndk-chmod: - cmd.wait: - - name: chmod a+x /home/servo/android-ndk-r10c-linux-x86_64.bin - - user: servo - - watch: - - file: android-ndk-download + - mode: 777 android-ndk-install: cmd.wait: - name: /home/servo/android-ndk-r10c-linux-x86_64.bin - user: servo - watch: - - cmd: android-ndk-chmod + - file: android-ndk-download android-ndk-toolset-configuration: cmd.wait: diff --git a/buildbot-master.sls b/buildbot/master.sls similarity index 79% rename from buildbot-master.sls rename to buildbot/master.sls index c718a6a0..0614d88d 100644 --- a/buildbot-master.sls +++ b/buildbot/master.sls @@ -9,8 +9,7 @@ boto: pip.installed buildbot-master: - service: - - running + service.running: - enable: True /home/servo/buildbot/master: @@ -21,8 +20,6 @@ buildbot-master: - group: servo - dir_mode: 755 - file_mode: 644 - - require_in: - - service: buildbot-master - watch_in: - service: buildbot-master @@ -32,24 +29,19 @@ buildbot-master: - user: root - group: root - mode: 644 - - require_in: - - service: buildbot-master - watch_in: - service: buildbot-master buildbot-github-listener: - service: - - running + service.running: - enable: True - + /usr/local/bin/github_buildbot.py: file.managed: - source: salt://buildbot/github_buildbot.py - user: root - group: root - mode: 755 - - reuqire_in: - - service: buildbot-github-listener - watch_in: - service: buildbot-github-listener @@ -60,8 +52,5 @@ buildbot-github-listener: - user: root - group: root - mode: 644 - - reuqire_in: - - service: buildbot-github-listener - watch_in: - service: buildbot-github-listener - diff --git a/buildbot/master/public_html/bg_gradient.jpg b/buildbot/master/public_html/bg_gradient.jpg index 6c2e5ddf..6a9285be 100644 Binary files a/buildbot/master/public_html/bg_gradient.jpg and b/buildbot/master/public_html/bg_gradient.jpg differ diff --git a/buildbot-slave.sls b/buildbot/slave.sls similarity index 69% rename from buildbot-slave.sls rename to buildbot/slave.sls index 34344bbc..05b52220 100644 --- a/buildbot-slave.sls +++ b/buildbot/slave.sls @@ -1,58 +1,34 @@ -{% if grains["kernel"] != "Darwin" %} -{% set users_path = "/home" %} -{% else %} -{% set users_path = "/Users" %} -{% endif %} +{% from 'common/map.jinja' import config as common with context %} buildbot-slave.pip: pip.installed: - name: buildbot-slave == 0.8.12 -{{ users_path }}/servo/buildbot/slave: +{{ common.servo_home }}/buildbot/slave: file.recurse: - source: salt://buildbot/slave - template: jinja - user: servo - {% if grains["kernel"] != "Darwin" %} - - group: servo - {% else %} + {% if grains['kernel'] == 'Darwin' %} - group: staff + {% else %} + - group: servo {% endif %} - dir_mode: 755 - file_mode: 644 - {% if grains["kernel"] != "Darwin" %} + {% if grains['kernel'] != 'Darwin' %} - watch_in: - service: buildbot-slave {% endif %} -{% if grains["kernel"] != "Darwin" %} - -/etc/init/buildbot-slave.conf: - file.managed: - - source: salt://buildbot/buildbot-slave.conf - - user: root - {% if grains["kernel"] != "Darwin" %} - - group: root - {% else %} - - group: wheel - {% endif %} - - mode: 644 - - watch_in: - - service: buildbot-slave - -buildbot-slave: - service: - - running - - enable: True - -{% else %} +{% if grains['kernel'] == 'Darwin' %} /Library/LaunchDaemons/net.buildbot.buildslave.plist: file.managed: - source: salt://buildbot/net.buildbot.buildslave.plist - user: root - group: wheel - - mode: 644 + - mode: 644 launchctl unload /Library/LaunchDaemons/net.buildbot.buildslave.plist: cmd.run @@ -60,5 +36,20 @@ launchctl unload /Library/LaunchDaemons/net.buildbot.buildslave.plist: launchctl load -w /Library/LaunchDaemons/net.buildbot.buildslave.plist: cmd.run +{% else %} + +/etc/init/buildbot-slave.conf: + file.managed: + - source: salt://buildbot/buildbot-slave.conf + - user: root + - group: root + - mode: 644 + - watch_in: + - service: buildbot-slave + +buildbot-slave: + service.running: + - enable: True + {% endif %} diff --git a/builder.sls b/builder.sls deleted file mode 100644 index e69de29b..00000000 diff --git a/common.sls b/common.sls deleted file mode 100644 index 15e17187..00000000 --- a/common.sls +++ /dev/null @@ -1,166 +0,0 @@ -{% if grains['kernel'] != 'Darwin' %} -python-pip: - pkg.installed -python-dev: - pkg.installed -{% endif %} - -servo: - user.present: - - fullname: Tom Servo - - shell: /bin/bash -{% if grains['kernel'] != 'Darwin' %} - - home: /home/servo -{% else %} - - home: /Users/servo -{% endif %} - -host.servo-master: - host.present: - - name: servo-master - - ip: 96.126.125.232 - -host.servo-linux1: - host.present: - - name: servo-linux1 - - ip: 66.228.48.56 - -host.servo-linux2: - host.present: - - name: servo-linux2 - - ip: 173.255.201.95 - -host.servo-linux3: - host.present: - - name: servo-linux3 - - ip: 45.79.167.177 - -host.servo-linux-android1: - host.present: - - name: servo-linux-android1 - - ip: 72.14.176.110 - -host.servo-mac1: - host.present: - - name: servo-mac1 - - ip: 208.52.161.130 - -host.servo-mac3: - host.present: - - name: servo-mac3 - - ip: 63.135.170.19 - -host.servo-head: - host.present: - - name: servo-head - - ip: 96.126.114.185 - -sshkey-jack: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/jack.pub - -sshkey-gw: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/gw.pub - -sshkey-jdm: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/jdm.pub - -sshkey-larsberg: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/larsberg.pub - -sshkey-simonsapin: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/simonsapin.pub - -sshkey-pcwalton: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/pcwalton.pub - -sshkey-manishearth: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/manishearth.pub - -sshkey-edunham: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/edunham.pub - -sshkey-mbrubeck: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/mbrubeck.pub - -sshkey-mwu: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/mwu.pub - -sshkey-ms2ger: - ssh_auth: - - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} - - source: salt://ssh/Ms2ger.pub diff --git a/common/init.sls b/common/init.sls new file mode 100644 index 00000000..1447ca14 --- /dev/null +++ b/common/init.sls @@ -0,0 +1,29 @@ +{% from tpldir ~ '/map.jinja' import config with context %} + +{% if grains['kernel'] != 'Darwin' %} +python-pkgs: + pkg.installed: + - pkgs: + - python-pip + - python-dev +{% endif %} + +servo: + user.present: + - fullname: Tom Servo + - shell: /bin/bash + - home: {{ config.servo_home }} + +{% for hostname, ip in config.hosts.items() %} +host-{{ hostname }}: + host.present: + - name: {{ hostname }} + - ip: {{ ip }} +{% endfor %} + +{% for ssh_user in config.ssh_users %} +sshkey-{{ ssh_user }}: + ssh_auth.present: + - user: {{ config.root_user }} + - source: salt://{{ tpldir }}/ssh/{{ ssh_user }}.pub +{% endfor %} diff --git a/common/map.jinja b/common/map.jinja new file mode 100644 index 00000000..6413f834 --- /dev/null +++ b/common/map.jinja @@ -0,0 +1,38 @@ +{% + set config = salt['grains.filter_by']({ + 'defaults': { + 'servo_home': '/home/servo', + 'root_user': 'root', + 'hosts': { + 'servo-master': '96.126.125.232', + 'servo-linux1': '66.228.48.56', + 'servo-linux2': '173.255.201.95', + 'servo-linux3': '45.79.167.177', + 'servo-linux-android1': '72.14.176.110', + 'servo-mac1': '208.52.161.130', + 'servo-mac3': '63.135.170.19', + 'servo-head': '96.126.114.185' + }, + 'ssh_users': [ + 'edunham', + 'gw', + 'jack', + 'jdm', + 'larsberg', + 'manishearth', + 'mbrubeck', + 'Ms2ger', + 'mwu', + 'pcwalton', + 'simonsapin' + ] + }, + 'Darwin': { + 'servo_home': '/Users/servo', + 'root_user': 'administrator' + } + }, + base='defaults', + grain='kernel' + ) +%} diff --git a/ssh/Ms2ger.pub b/common/ssh/Ms2ger.pub similarity index 100% rename from ssh/Ms2ger.pub rename to common/ssh/Ms2ger.pub diff --git a/ssh/edunham.pub b/common/ssh/edunham.pub old mode 100755 new mode 100644 similarity index 100% rename from ssh/edunham.pub rename to common/ssh/edunham.pub diff --git a/ssh/gw.pub b/common/ssh/gw.pub similarity index 100% rename from ssh/gw.pub rename to common/ssh/gw.pub diff --git a/ssh/jack.pub b/common/ssh/jack.pub similarity index 100% rename from ssh/jack.pub rename to common/ssh/jack.pub diff --git a/ssh/jdm.pub b/common/ssh/jdm.pub similarity index 100% rename from ssh/jdm.pub rename to common/ssh/jdm.pub diff --git a/ssh/larsberg.pub b/common/ssh/larsberg.pub similarity index 100% rename from ssh/larsberg.pub rename to common/ssh/larsberg.pub diff --git a/ssh/manishearth.pub b/common/ssh/manishearth.pub similarity index 100% rename from ssh/manishearth.pub rename to common/ssh/manishearth.pub diff --git a/ssh/mbrubeck.pub b/common/ssh/mbrubeck.pub old mode 100755 new mode 100644 similarity index 100% rename from ssh/mbrubeck.pub rename to common/ssh/mbrubeck.pub diff --git a/ssh/mwu.pub b/common/ssh/mwu.pub similarity index 100% rename from ssh/mwu.pub rename to common/ssh/mwu.pub diff --git a/ssh/pcwalton.pub b/common/ssh/pcwalton.pub similarity index 100% rename from ssh/pcwalton.pub rename to common/ssh/pcwalton.pub diff --git a/ssh/simonsapin.pub b/common/ssh/simonsapin.pub similarity index 100% rename from ssh/simonsapin.pub rename to common/ssh/simonsapin.pub diff --git a/homu.sls b/homu/init.sls similarity index 88% rename from homu.sls rename to homu/init.sls index c80bb8ce..15ff508a 100644 --- a/homu.sls +++ b/homu/init.sls @@ -13,8 +13,6 @@ https://github.com/barosl/homu: - user: servo - group: servo - mode: 644 - - require_in: - - service: homu - watch_in: - service: homu @@ -30,8 +28,7 @@ install_homu: - editable: /home/servo/homu homu: - service: - - running + service.running: - enable: True - require: - pip: install_homu @@ -42,7 +39,5 @@ homu: - user: root - group: root - mode: 644 - - require_in: - - service: homu - watch_in: - service: homu diff --git a/nginx/default b/nginx/default index 3d9ac364..6cace48b 100644 --- a/nginx/default +++ b/nginx/default @@ -1,7 +1,7 @@ server { listen 80 default_server; server_name build.servo.org; - + location / { proxy_pass http://localhost:8010/; diff --git a/nginx.sls b/nginx/init.sls similarity index 80% rename from nginx.sls rename to nginx/init.sls index fff08b09..5138f4cd 100644 --- a/nginx.sls +++ b/nginx/init.sls @@ -1,9 +1,9 @@ nginx: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - enable: True + - require: + - pkg: nginx /etc/nginx/sites-available/default: file.managed: diff --git a/servo-dependencies.sls b/servo-dependencies.sls index 7420abb9..251b64ae 100644 --- a/servo-dependencies.sls +++ b/servo-dependencies.sls @@ -1,16 +1,4 @@ -cmake: - pkg.installed - -git: - pkg.installed - -virtualenv: - pip.installed - -ghp-import: - pip.installed - -{% if grains["kernel"] != "Darwin" %} +{% if grains['kernel'] != 'Darwin' %} FIX enable multiverse: pkgrepo.absent: - name: deb http://archive.ubuntu.com/ubuntu trusty multiverse @@ -22,49 +10,31 @@ enable multiverse: agree to eula: cmd.run: - name: echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections - -libglib2.0-dev: - pkg.installed - -libgl1-mesa-dri: - pkg.installed - -freeglut3-dev: - pkg.installed - -libfreetype6-dev: - pkg.installed - -xorg-dev: - pkg.installed - -libssl-dev: - pkg.installed - -libbz2-dev: - pkg.installed - -ttf-mscorefonts-installer: - pkg.installed - -xserver-xorg-input-void: - pkg.installed - -xserver-xorg-video-dummy: - pkg.installed - -xpra: - pkg.installed - -libosmesa6-dev: - pkg.installed - -gperf: - pkg.installed - -{% else %} - -pkg-config: - pkg.installed - {% endif %} + +servo-dependencies: + pkg.installed: + - pkgs: + - cmake + - git + {% if grains['kernel'] == 'Darwin' %} + - pkg-config + {% else %} + - libglib2.0-dev + - libgl1-mesa-dri + - freeglut3-dev + - libfreetype6-dev + - xorg-dev + - libssl-dev + - libbz2-dev + - ttf-mscorefonts-installer + - xserver-xorg-input-void + - xserver-xorg-video-dummy + - xpra + - libosmesa6-dev + - gperf + {% endif %} + pip.installed: + - pkgs: + - virtualenv + - ghp-import diff --git a/top.sls b/top.sls index 3b849666..cf249156 100644 --- a/top.sls +++ b/top.sls @@ -4,13 +4,13 @@ base: - servo-dependencies 'servo-master': - - buildbot-master + - buildbot.master - homu - nginx 'servo-(linux|mac|macpro)\d+': - match: pcre - - buildbot-slave + - buildbot.slave 'servo-linux\d+': - match: pcre @@ -23,11 +23,11 @@ base: 'servo-linux-android\d+': - match: pcre - - buildbot-slave + - buildbot.slave - android-dependencies - gonk-dependencies 'servo-head': - match: pcre - - buildbot-slave + - buildbot.slave - android-dependencies diff --git a/xvfb.sls b/xvfb/init.sls similarity index 73% rename from xvfb.sls rename to xvfb/init.sls index 0c771e95..3a844dc5 100644 --- a/xvfb.sls +++ b/xvfb/init.sls @@ -6,11 +6,10 @@ - mode: 644 xvfb: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - enable: True + - require: + - pkg: xvfb - watch: - file: /etc/init/xvfb.conf -