Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up travis ci with phoenix + heroku

I'm running into issues with automating deployments with Travis CI to Heroku for my Phoenix app. Here's Travis CI build error:

(Mix) The database for AgilePulse.Repo couldn't be created: tcp connect: connection refused - :econnrefused

Here's my .travis.yml config:

language: elixir
elixir:
  - 1.3.2
otp_release:
  - 19.0
sudo: false
addons:
  postgresql: '9.5'
notifications:
  email: false
env:
  - MIX_ENV=test
before_script:
  - cp config/travis_ci_test.exs config/test.secret.exs
  - mix do ecto.create, ecto.migrate

Here's my travis_ci_test.exs:

use Mix.Config

# Configure your database
config :agile_pulse, AgilePulse.Repo,
  adapter: Ecto.Adapters.Postgres,
  username: "postgres",
  password: "",
  database: "travis_ci_test",
  hostname: "localhost",
  pool: Ecto.Adapters.SQL.Sandbox

Any pointers would be greatly appreciated!

Additional info:

  • GitHub repo: https://github.com/cscairns/agile-pulse-api
like image 564
keruilin Avatar asked Sep 10 '16 20:09

keruilin


1 Answers

On a second look: judging by the travis log you posted, looks like you're bootstrapping an Ubuntu 12.04 Precise for your build; I suspect that Postgres 9.5 is not available on precise:

https://docs.travis-ci.com/user/database-setup/#Using-a-different-PostgreSQL-Version

Could you try switching to Postgres 9.4 and see if that works?

like image 142
Svilen Avatar answered Nov 17 '22 19:11

Svilen