Skip to content

Instantly share code, notes, and snippets.

@frans-k
Last active October 31, 2018 20:16
Show Gist options
  • Save frans-k/5895115 to your computer and use it in GitHub Desktop.
Save frans-k/5895115 to your computer and use it in GitHub Desktop.
My wercker.yml for Rails 4, Ruby 2, Postgresql, Rspec, Heroku deploy and automatic Heroku migrations. Had some issues with it, so hopefully it's helpful to someone.
box: wercker/ubuntu12.04-ruby2.0.0
services:
- wercker/postgresql
build:
steps:
- bundle-install
- rails-database-yml:
service: postgresql
- script:
name: echo ruby information
code: |
echo "ruby version $(ruby --version) running!"
echo "from location $(which ruby)"
echo -p "gem list: $(gem list)"
- script:
name: Set up db
code: bundle exec rake db:schema:load RAILS_ENV=test
- script:
name: rspec
code: bundle exec rspec
deploy:
steps:
- heroku-deploy
- script:
name: Update database
code: heroku run rake db:migrate --app $TARGET_NAME
@nglx
Copy link

nglx commented Sep 24, 2013

When I cat database from wercker it seems to be correct:

test:
    adapter: postgresql
    encoding: "utf8"
    database: <%= ENV['WERCKER_POSTGRESQL_DATABASE'] %><%= ENV['TEST_ENV_NUMBER'] %>
    username: <%= ENV['WERCKER_POSTGRESQL_USERNAME'] %>
    password: <%= ENV['WERCKER_POSTGRESQL_PASSWORD'] %>
    host: <%= ENV['WERCKER_POSTGRESQL_HOST'] %>
    port: <%= ENV['WERCKER_POSTGRESQL_PORT'] %>

@madaarya
Copy link

hi @managr actually i have same problem for connecting database. But after some check and test, you just remove service option on rails-database-yml step build.

Hope it helps

@brunoocasali
Copy link

My config file is:

ruby: 2.2.3
box: phusion/passenger-ruby22
services:
  - postgres
build:
  steps:
    - bundle-install
    - rails-database-yml
    - script:
        name: echo ruby information
        code: |
            echo "ruby version $(ruby --version) running!"
            echo "from location $(which ruby)"
            echo -p "gem list: $(gem list)"
    - script:
        name: Set up db
        code: bundle exec rake db:schema:load RAILS_ENV=test

    - script:
        name: rspec
        code: bundle exec rspec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment