Skip to content

Instantly share code, notes, and snippets.

@nickcarenza
Last active August 29, 2015 14:06
Show Gist options
  • Save nickcarenza/4328123457e08d3c10fb to your computer and use it in GitHub Desktop.
Save nickcarenza/4328123457e08d3c10fb to your computer and use it in GitHub Desktop.
Saltstack - HHVM - Composer State
# Check for latest version based on environment
pull-latest-repo:
git.latest:
- name: [email protected]:you/your-app.git
- rev: {{ salt['pillar.get']('environment') }}
- target: /sites/your-app
- always_fetch: True
# If the previous state made changes, run composer install with environment-specific options
/path/to/repository:
composer.installed:
- composer: /usr/local/bin/composer
- php: hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false
{% if salt['pillar.get']('environment') == 'development' %}
- prefer_source: True
{% else %}
- no_dev: True
- optimize: True
- prefer_dist: True
{% endif %}
- watch:
- git: pull-latest-repo
# Composer
# ----------------
# @link http://docs.saltstack.com/en/latest/ref/states/all/salt.states.composer.html
# @link https://blog.engineyard.com/2014/hhvm-hack-part-2
#
# Note: The command line options suggested in the links didn't work for me but this solution does
Get Composer:
require:
- service: hhvm
cmd.run:
- name: 'CURL=`which curl`; $CURL -sS https://getcomposer.org/installer | hhvm --php -d default_socket_timeout=30'
- unless: test -f /usr/local/bin/composer
- cwd: /root/
Install Composer:
cmd.wait:
- name: mv /root/composer.phar /usr/local/bin/composer
- cwd: /root/
- watch:
- cmd: Get Composer
/path/to/repository:
composer.installed:
- composer: /usr/local/bin/composer
- php: hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment