dokku-pg-plugin icon indicating copy to clipboard operation
dokku-pg-plugin copied to clipboard

Rails database.yml file not parsing correctly

Open LeverageBlue opened this issue 9 years ago • 7 comments

I am using Dokku v0.3.15 + Ubuntu v14.

Creating a new db through the plugin appears to be generating an correct DATABASE_URL with the latest from master branch.

[email protected]#: dokku postgresql:link myapp myappdb
docker: "inspect" requires a minimum of 1 argument. See 'docker inspect --help'. 
time="2015-03-22T19:50:08-04:00" level="fatal" msg="json: cannot unmarshal array into Go value of type map[string]interface {}" 
-----> Creating /home/dokku/app/ENV 
-----> Setting config vars and restarting app 
DATABASE_URL: postgres://root:XXXXXXX@:/db 
-----> Releasing app ... 
-----> Release complete! 
-----> Deploying app ... 
-----> Deploy complete!

(Notice missing hostname.)

So when I ran a db:migrate, I got a URI::InvalidURIError (something to the effect of http://stackoverflow.com/questions/29071069/dokku-rails-postgresql-error-uriinvalidurierror-the-scheme-postgres-doe).

Luckily, I had an older version of the dokku-pg-plugin (I suppose you could check out an earlier commit), so I manually installed the older plugin and it works:

local$ scp postgresql.tar [email protected]:/var/lib/dokku/plugins/
[email protected]#: cd /var/lib/dokku/plugins/
[email protected]#: tar xf postgresql.tar
[email protected]:/var/lib/dokku/plugins# dokku postgresql:link myapp myappdb
time="2015-03-22T20:22:33-04:00" level="fatal" msg="json: cannot unmarshal array into Go value of type map[string]interface {}" 
-----> Setting config vars and restarting app
       DATABASE_URL: postgres://root:[email protected]:/db
-----> Releasing app ...
-----> Deploying app ...
-----> Running pre-flight checks
       check-deploy: /home/dokku/app/CHECKS not found. attempting to retrieve it from container ...
       CHECKS file not found in container. skipping checks.
-----> Running post-deploy
-----> Configuring app.leverage.blue...
-----> Creating http nginx.conf
-----> Running nginx-pre-reload
       Reloading nginx
-----> Shutting down old container in 60 seconds
=====> Application deployed:
       http://myapp.example.com

(Notice hostname appears correctly.)

Has something changed in the DATABASE_URL generation logic that causes hostname to go astray?

Thank you!

LeverageBlue avatar Mar 23 '15 00:03 LeverageBlue

I'm having the same issue.

Oddly enough I managed to find a work around by giving both my app and its database the same name.

RossKinsella avatar Mar 23 '15 18:03 RossKinsella

+1.

RossKinsella's solution worked for me.

alexandred avatar Mar 30 '15 03:03 alexandred

Me as well. And naming the database and app the same worked as a fix for me as well.

vroomanj avatar Apr 07 '15 00:04 vroomanj

Similar issue but all was fine when I just named the database container the same as the app.

cbartlett avatar May 07 '15 18:05 cbartlett

kudos to @RossKinsella naming the app same as database works for me.

aldoforce avatar May 08 '15 14:05 aldoforce

Giving same name did not resolve issue for me

dzmitrys-dev avatar Jun 21 '15 12:06 dzmitrys-dev

Same issue, and giving the same name to the app/db hasn't solved it. Is it possible to define the host manually before rake db migrate?

mtchllbrrn avatar Jul 01 '15 04:07 mtchllbrrn