If you’re in a rush, you can also do this manually.
Something like this should do the trick:
-
Connect to your Postgres instance.
a.fly ssh console --app <app-name>
b.psql postgres://postgres:$OPERATOR_PASSWORD@$FLY_APP_NAME.internal:5432
-
Create a new database
a.\l+
to list databases.
b.CREATE DATABASE <database-name>;
-
Create a new user
a.\du+
to list users.
b.CREATE USER <user-name> WITH LOGIN PASSWORD 'password';
-
Grant access to database
a.GRANT ALL PRIVILEGES ON DATABASE <database-name> TO <user-name>;
-
Set your DATABASE_URL secret on your target consumer app.
a. Your URL should look like:
postgres://<user>:<password>@<postgres-app>.internal:5432/<database-name>
b. Test the above URL usingpsql
to ensure it works before setting it.
c.fly secrets set DATABASE_URL=<database-url> --app <app-name>