nodes:
  www:
    ami: ami-efd61d86
    instance-type: "m1.small"
    username: ubuntu
  
    ## following only necessary for deployment
    availability-zone: "us-east-1a" # customers *could* specify this, probably shouldn't care.
    public-key: "backend/www.id_rsa.pub"
    private-key: "backend/www.id_rsa"
    security-groups: ["www"]

jobs:  
  build:
    template: build
    node: www   # name of node to use. unique per-project
    commands:
      - rvm use jruby-1.6.5@circle --default
      - bundle install
      - lein deps:
          pwd: backend
      - rake test
      - lein midje:
          pwd: backend
          environment:
            CIRCLE_ENV: "staging"
    #  on-success: deploy # another build to trigger if this one is successful
    notify-email:
      # Recognized keys, :committer, :owner, or email literals.
      - :committer
      - :owner

  deploy:
    template: deploy
    node: www
    notify-email:
      - :owner

    commands:
      - rvm use jruby-1.6.5@circle --default
      - bundle install
      - lein deps:
          pwd: backend
      - rake server
      - sudo /etc/init.d/nginx start

schedule:
  commit:
    job: build
  nightly:
    job: long-tests  
  
    # branches:
    #   only:
    #   exclude:  
nodes:
  www:
    ami: ami-efd61d86
    instance-type: "m1.small"
    username: ubuntu
  
    ## following only necessary for deployment
    availability-zone: "us-east-1a" # customers *could* specify this, probably shouldn't care.
    public-key: "backend/www.id_rsa.pub"
    private-key: "backend/www.id_rsa"
    security-groups: ["www"]

jobs:  
  build:
    template: build
    node: www   # name of node to use. unique per-project
    commands:
      - rvm use jruby-1.6.5@circle --default
      - bundle install
      - lein deps:
          pwd: backend
      - rake test
      - lein midje:
          pwd: backend
          environment:
            CIRCLE_ENV: "staging"
    #  on-success: deploy # another build to trigger if this one is successful
    notify-email:
      # Recognized keys, :committer, :owner, or email literals.
      - :committer
      - :owner

  deploy:
    template: deploy
    node: www
    notify-email:
      - :owner

    commands:
      - rvm use jruby-1.6.5@circle --default
      - bundle install
      - lein deps:
          pwd: backend
      - rake production:server
      - sudo /etc/init.d/nginx start

schedule:
  commit:
    job: build
  nightly:
    job: long-tests  
  
    # branches:
    #   only:
    #   exclude:  
Use the production:server option, to detach
Use the production:server option, to detach
