So this is my first time deploying (outside of Heroku) and haven’t had any luck. I was able to deploy my project through the fly launch, deploy, and added my secrets to the fly.toml file under:
[env]
PORT = "3000"
NODE_ENV = "production"
My knex File looks like this:
if (process.env.DATABASE_URL) {
pg.defaults.ssl = { rejectUnauthorized: false };
}
production: {
client: "pg",
migrations: { directory: "./database/migrations" },
seeds: { directory: "./database/seeds" },
connection: process.env.DATABASE_URL,
pool: { min: 2, max: 10 },
}
My dbConfig file includes
const:
environment = process.env.NODE_ENV || "development";
After deploying the app I received this:
*Postgres cluster nodeexpress-graphql-db created*
* Username: postgres*
* Password: <PASSWORD>*
* Hostname: nodeexpress-graphql-db.internal*
* Flycast: <HIDDEN>*
* Proxy port: 5432*
* Postgres port: 5433*
* Connection string: postgres://postgres:<PASSWORD>@nodeexpress-graphql-db.flycast:5432*
*Connect to postgres*
*Any app within the <MY> organization can connect to this Postgres using the above connection string*
*Postgres cluster nodeexpress-graphql-db is now attached to nodeexpress-graphql*
*The following secret was added to nodeexpress-graphql:*
* DATABASE_URL=postgres://nodeexpress_graphql:<PASSWORD (difference from db above)>@nodeexpress-graphql-db.flycast:5432/nodeexpress_graphql?sslmode=disable*
*Postgres cluster nodeexpress-graphql-db is now attached to nodeexpress-graphql*
On my .ENV file I have PORT=3000, i added the DATABASE_URL above, but when I try to enter the credentials on the PG app, for the name, I’m confused, is the name nodeexpress-graphql-db? Or just nodeexpress_graphql? Notice aboe, the DATABASE_URL has nodeexpress_graphql with an underscore so there’s two similar ones. I tried entering the credentials above and when i hit save on the pg admin app, i get this: “unable to connect to server: could not translate host name “nodeexpress-graphql-db.internal” to address: Unkown host”
Isn’t the ‘internal’’ name the host name? I’m not sure what I’m doing wrong, again, any help is greatly appreciated.