Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

relation "instance" does not exist #5

Closed
sglebs opened this issue Mar 31, 2015 · 9 comments
Closed

relation "instance" does not exist #5

sglebs opened this issue Mar 31, 2015 · 9 comments

Comments

@sglebs
Copy link

sglebs commented Mar 31, 2015

I followed the documented steps but I get this error when trying to create the service instance:

tsuru service-add postgresapi namoroondb

Error: Failed to create the instance namoroondb: relation "instance" does not exist
LINE 1: SELECT 1 FROM instance WHERE name='namoroondb'

Any ideas? Thanks!

@sroze
Copy link
Contributor

sroze commented Mar 31, 2015

Are you sure that you created the database ?

tsuru run --app postgresapi -- python manage.py upgrade_db

@sglebs
Copy link
Author

sglebs commented Mar 31, 2015

You mean

tsuru app-run --app postgresapi -- python manage.py upgrade_db

Just did. It was not in the Readme.

Now we moved a bit forward:

tsuru app-run --app postgresapi -- python manage.py upgrade_db
tsuru service-add postgresapi namoroondb
Error: Failed to create the instance namoroondb: permission denied to create role

I will check where my mistake is and report back.

@sroze
Copy link
Contributor

sroze commented Mar 31, 2015

It is in the Install service section.

For your next problem, you're user may not be an administrator that is able to create roles and databases.

@sglebs
Copy link
Author

sglebs commented Mar 31, 2015

You may want to fix the docs. tsuru run is not a valid command (heroic run is, though). You want to fix the Readme to:

tsuru app-run --app postgresapi -- python manage.py upgrade_db

Regarding the password: since it is a DEV box, I will share here the exact values I used during install:

tsuru env-set -a postgresapi POSTGRESAPI_DATABASE=postgresapi
tsuru env-set -a postgresapi POSTGRESAPI_USER=postgresapi
tsuru env-set -a postgresapi POSTGRESAPI_PASSWORD=postgresapi
tsuru env-set -a postgresapi POSTGRESAPI_HOST=172.17.42.1
tsuru env-set -a postgresapi POSTGRESAPI_PORT=5432
tsuru env-set -a postgresapi POSTGRESAPI_SALT=salt

tsuru env-set -a postgresapi POSTGRESAPI_SHARED_HOST=172.17.42.1
tsuru env-set -a postgresapi POSTGRESAPI_SHARED_PORT=5432
tsuru env-set -a postgresapi POSTGRESAPI_SHARED_ADMIN=postgresadmin
tsuru env-set -a postgresapi POSTGRESAPI_SHARED_ADMIN_PASSWORD=postgresapi
tsuru env-set -a postgresapi POSTGRESAPI_SHARED_PUBLIC_HOST=postgresapi.192.168.46.226.nip.io

I will try psql to see if these really work or if I had a typo during the PostgreSQL setup.

Thanks!

@fsouza
Copy link
Contributor

fsouza commented Mar 31, 2015

Ah, it used to exist, but it's now app-run. Sorry about that.

@sglebs
Copy link
Author

sglebs commented Mar 31, 2015

pdAdmin lets me in fine, using postgresapi/postgresapi. And I see the postgresapi role:

CREATE ROLE postgresapi LOGIN
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;

And this is what I see for the postgresadmin role:

CREATE ROLE postgresadmin LOGIN
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;

Anything wrong there?

@sglebs
Copy link
Author

sglebs commented Mar 31, 2015

Using pgAdmin again I was also able to connect using posgresadmin/postgresapi. So, it is not a password problem.

Could it be bad role defaults?

@sglebs
Copy link
Author

sglebs commented Mar 31, 2015

I guess I need to go to the database and manually tweak the roles, just as I had to do with the mysqlapi? (tsuru/mysqlapi#35)

tsuru service-add postgresapi namoroondb
Error: Failed to create the instance namoroondb: permission denied to create role

Any idea on what exactly I need to tweak on the database? Thanks!

@sroze
Copy link
Contributor

sroze commented Jul 28, 2015

@sglebs the POSTGRESAPI_USER must be able to create roles and databases.

@sroze sroze closed this as completed Jul 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants