#Issue on Connecting Postgres
1 messages · Page 1 of 1 (latest)
Hi @eternal spoke ,first of all, I suggest you double-check your credentials and try again. If you have started permify and postgres in Docker, you need to replace "localhost" with "host.docker.internal" to make it work.
Thanks fixed it needed to pass host.docker.internal
postgres://admin:admin@host.docker.internal:5432/test
Hi one more issue I create database on psql and permify on k8s also get connected but the migration did not ran on the database do I need to any flag, when I write in schema getting this error
{
"code": 13,
"message": "ERROR: relation \"schema_definitions\" does not exist (SQLSTATE 42P01)",
"details": []
}```
Hi @eternal spoke , thanks for sharing the issue I'am on it.
You can Check this pull request https://github.com/Permify/permify/pull/297
and you can use this command with your credentials
permify migrate up --database-engine=postgres
--databaseuri=postgres://postgres:secret@localhost:5432/permify
This command migrate all Tables ın permify migration files
if you have any problem again you can tag me again Happy Coding 
@shy wadi how can I run this command with kubernetes yaml file?
you can create a kubernetes job for this
for example
apiVersion: batch/v1
kind: Job
metadata:
name: permify-migrate
spec:
template:
spec:
containers:
- name: permify-migrate
image: <your-docker-image>
command: ["permify"]
args: ["migrate", "up", "--database-engine=postgres", "--databaseuri=postgres://postgres:secret@localhost:5432/permify"]
restartPolicy: Never
backoffLimit: 4
if you can access Postgresl from outside, you can log in to the permify pod or from your local yourself and run this command once, it will be enough to migrate once anyway
But when I was testing locally it created the tables on my local postgres but when using aws RDS it was unable to create the tables will this work ?
if you use Amazon RDS for PostgreSQL , yes
can you check if the aws rds information is correct or if there may be an authorization error
from RDS Configs?
I am using super user for rds
yes it is connected to the DB I think if permify find invalid info regarding DB it will not expose the ports of http and grpc
also this command will work with the existing docker ?
when an instance is opened on onegin mongo, there are network ip limits at first, even if you are a super user, do you check the network interface settings on the rds part?
yes this command is active and you can use
Can you tell how can I confirm this ?
example for this is mysql
https://simplebackups.com/blog/allow-a-remote-ip-to-connect-to-your-amazon-rds-mysql-instance/
you can check your security groups from aws
like this
rpc error: code = Unknown desc = Manifest generation error (cached): rpc error: code = FailedPrecondition desc = Failed to unmarshal "permify-deployment.yaml": failed to unmarshal manifest: error converting YAML to JSON: yaml: line 24: did not find expected key
name: permify
command: [ "permify" ]
args: [ "migrate", "up", "--database-engine=postgres", "--databaseuri=$(DB_URI)" ]
- "serve"
- "--database-engine=postgres"
- "--database-uri=$(DB_URI)"
- "--database-max-open-connections=20"
- "--authn-enabled"
- "--authn-method=preshared"
- "--authn-preshared-keys=$(PRE_SHARED_KEYS)"
env:
- name: DB_URI
valueFrom:
secretKeyRef:
name: permify-dev-secrets
key: DB_URI
- name: PRE_SHARED_KEYS
valueFrom:
secretKeyRef:
name: permify-dev-secrets
key: PRE_SHARED_KEYS```
getting this error when adding migrate cmd
migrate is not a service
when you use the migrate command, the service does not start, the code stops running
My bad I forgot its a job
first you run migrate and after run the permify serve
np 🙂
you can exacute migrate job from your computer first time
like from this
are you use brew?
or you can clone repo from github
and run this command in repo directory like this
go run cmd/permify/permify.go migrate up --database-engine=postgres
--databaseuri=postgres://postgres:secret@localhost:5432/permify
with your pg creds
@shy wadi getting this error
you can use migrate command one time in your local computer
db is not accessible from local
I can manually run the migration on the DB right no issue in that ?
yes you can manualy migrate migrations files to db