dokku / dokku-postgres

a postgres plugin for dokku
MIT License
484 stars 97 forks source link

Rewritten link command generates invalid host #28

Closed wingrunr21 closed 9 years ago

wingrunr21 commented 9 years ago

Hey,

It looks like the revamped link commands that were introduced in 63047297ea661454da22c79883dd927400b089cc are not functioning correctly. The host name that is generated for DATABASE_URL does not appear to be able to be resolved. This causes deploys to fail. Rolling back to the prior implementations resolves the issue (as that seems to inject the IP address vs a hostname).

wingrunr21 commented 9 years ago

For a bit more info, it looks like the generated hostname (for my case) is being set to: dokku-postgres-program_pushfitnesscolorado_com. The actual docker container is named dokku.postgres.program_pushfitnesscolorado_com.

The hostname of the actual VPS is program.pushfitnesscolorado.com. The postgres container is named program_pushfitnesscolorado_com.

The rest of dokku is working correctly (vhost generation and such).

josegonzalez commented 9 years ago

Can you do docker inspect CID on that container?

wingrunr21 commented 9 years ago

Truncated obviously:

...
"Config": {
        "Hostname": "6c56bf3c44b6",
        "Domainname": "",
}
...
Flink commented 9 years ago

I need to test this, but I think the problem might be the underscores in the hostname.

Flink commented 9 years ago

Ok, so underscores seems to be accepted in a hostname (ping works correctly) but when testing with a rails app, I have the following error:

Message from application: the scheme postgres does not accept registry part: postgres:e8ece2babb9a2d5afc4df3ba695c2e39@dokku-postgres-program_pushfitnesscolorado_com:5432 (or bad hostname?)

Renaming the docker link to dokku-postgres-program-pushfitnesscolorado-com instead seems to work as expected. I’ll make a patch ;)

Flink commented 9 years ago

@wingrunr21 fixed in latest master, thank you for reporting!

josegonzalez commented 9 years ago

@Flink you think this is ready to port elsewhere?

Flink commented 9 years ago

I’ll port it at the same time I’m porting the revamped link/unlink commands (since otherwise we still use IP instead of hostnames)