<@ULP250DRT> i am looking to deploy prisma + apoll...
# random
s
@janpio i am looking to deploy prisma + apollo server on Google Cloud Run, similar to @jm i am uncertain how to handle it, devops isnt my primary area. I have a MySQL server successfully running with data on Cloud SQL and my express+apollo server w/ prisma running successfully on Cloud Run. I can connect to the DB properly from my local machine so I know it's running on the cloud. When i use graphql playground to test access to my DB from the Cloud Run service, i get
Copy code
"\nInvalid `prisma.objects.findMany()` invocation:\n\n\n  Can't reach database server at `xx.xxx.xxx.xx`:`3306`\n\nPlease make sure your database server is running at `xx.xxx.xxx.xx`:`3306`."
On my local machine I am using
DATABASE_URL="<mysql://username:password@xx.xxx.xxx.xx:3306/db_name?schema=public>"
but that connection string is clearly not working on Cloud Run. The Cloud Run docs provide a snippet to create a create a connection but I'm not sure how to convert that connection into a valid Prisma connection too... The Node.js snippet for Private IPs from the docs
Copy code
const createTcpPool = async config => {
  // Extract host and port from socket address
  const dbSocketAddr = process.env.DB_HOST.split(':');

  // Establish a connection to the database
  return await mysql.createPool({
    user: process.env.DB_USER, // e.g. 'my-db-user'
    password: process.env.DB_PASS, // e.g. 'my-db-password'
    database: process.env.DB_NAME, // e.g. 'my-database'
    host: dbSocketAddr[0], // e.g. '127.0.0.1'
    port: dbSocketAddr[1], // e.g. '3306'
    // ... Specify additional properties here.
    ...config,
  });
};
j
cc @Sytten
(might be worth to turn this into a help thing on our side if there is a universal solution - I clearly do not know enough about it)
s
@Spencer Curry basically you just need to use a particular URL format injected as an environment variable
See

https://youtu.be/WLsFF4mtqXQ?t=1094

for the format
What changed from last year is now they have a secret manager integration so its much easier, just put you string there and use the UI to inject it in env vars
DM me if you need further help
s
👀
im about to hop into a meeting but i will check this out later and DM you @Sytten if necessary
👍 1
s
@janpio just let me know if you want me to write the whole process in the doc
🙏 1
s
thank you so so much!
j
Asked the Docs team about that @Sytten and will let you know
👍 1