Prisma Cloud & Heroku - Environments

prisma-cloud

#1

Hi,

first I :heart: Prisma, great product & community - great to be a part of it, so thanks!

I have a kind of generall question, which I am currently unable to solve on my own. It is regarding prisma-cloud and Heroku. What I try to achieve is having multiple environments - dev& prod.
It would be more then great if I could use the dev environment while developing, therefor I would use prisma deploy dev and fork the prod database to the dev database.
And when the changes are approved I would simply set it to production.

For me it is kind of confusing how to deal with prisma services on prisma cloud. What I tried is to setup a two servers with two databases on the servers tab, but I dont think that this is the right solution.

Unfortunatelly I cannot find a tutorial for that use case, so I hope you guys could shed some light into that!

Thank you


#2

Seems I gave up too fast. Here is how I solved it:

  1. Setup a Prisma Server from the “Servers - Tab”
  2. Add new Server and Database on Heroku (prisma-dev)
  3. Go to “Services - Tab”, install prisma cli and authenticate like explained
  4. prisma init NAME select “use existing prisma server” and then select the previously created server (prisma-dev)
  5. prisma deploy
  6. Delete the generated folder and run all steps again for production now
  7. Create .env.devand a .env.prod and add the urls for each environment server

.env.dev

PRISMA_ENDPOINT="URL_DEV"
PRISMA_SECRET="SECRET"
PRISMA_MANAGEMENT_SECRET="ANOTHER_SECRET"  // Not sure about that¹

prisma.yml

endpoint: ${env:PRISMA_ENDPOINT}
secret: ${env:PRISMA_SECRET}
datamodel: datamodel.prisma

generate:
  - generator: typescript-client
    output: ./generated/prisma-client/

¹. Because to deploy to Prisma Cloud you have to login into a user account, I think that the PRISMA_MANAGEMENT_SECRET is automatically set for you.

Can somebody confirm?