dockerlead
07/07/2022, 9:24 AMprismagraphql/prisma
Alex Ruheni
Assuming that we’ve already hosted our new MySQL database on the AWS RDS, what steps should I follow?The next step would be defining the
DATABASE_URL
environment variable for your project in your deployment provider for your API.
If you’re using a relational database in production, you will need to sync your API’s Prisma schema with the database schema before deploying the application using Prisma Migrate with npx prisma migrate deploy
if you have a migration history. prisma migrate deploy
applies any pending migrations to your database.
You can then generate Prisma Client in the deployment step – which will be used by your APIs – using npx prisma generate
.
I would recommend taking a look at our Getting Started guide to familiarize yourself with Prisma.
And, Is this docker image legit for production deployment?I’ll reach out to our product/ engineering team and I’ll let you know. Let me know if you have any further questions. 🙂prismagraphql/prisma
dockerlead
07/07/2022, 11:39 AMdockerlead
07/07/2022, 11:39 AMThe next step would be defining theCould you elaborate this part? I didn't fully get it.environment variable for your project in your deployment provider for your API.DATABASE_URL
Alex Ruheni
.env
file for you to set your database’s connection string as an environment variable. When you use Prisma CLI or Prisma Client, the .env
file content and the variables defined in there are put into the system’s environment, where Prisma can read it and use it.
When deploying your application, you will need to define the environment variables in your deployment platform (eg Vercel), which Prisma will use for applying pending migrations and connecting + querying your database. Docs: Environment Variablesdockerlead
07/07/2022, 3:22 PMdockerlead
07/07/2022, 3:23 PMdockerlead
07/07/2022, 3:24 PMversion: '3'
services:
prisma:
image: prismagraphql/prisma:1.34
restart: always
ports:
- '4466:4466'
environment:
PRISMA_CONFIG: |
port: 4466
managementApiSecret: abcdef
databases:
default:
connector: mysql
host: mysql
port: 3306
user: root
password: abcdef
rawAccess: true
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: abcdef
volumes:
- mysql:/var/lib/mysql
volumes:
mysql: ~
dockerlead
07/07/2022, 3:26 PMdockerlead
07/07/2022, 3:28 PM...
PRISMA_SECRET="prismasecret"
...
DB_ENDPOINT="<http://localhost:4466>"
...
PRISMA_MANAGEMENT_API_SECRET="ah791lejgh"
...
PRISMA_CLOUDSESSION_KEY=""
...
# This text is inserted by `prisma init`:
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: <https://pris.ly/d/prisma-schema#using-environment-variables>
# Prisma supports the native connection string format for PostgreSQL, MySQL and SQLite.
# See the documentation for all the connection string options: <https://pris.ly/d/connection-strings>
DATABASE_URL="<mysql://root:ah791lejgh@localhost:3306/default@default>"JWT_SECRET="secret"
...
dockerlead
07/07/2022, 3:31 PMDB_ENDPOINT
and DATABASE_URL
dockerlead
07/07/2022, 3:31 PMdockerlead
07/07/2022, 3:32 PMPROJECT_ROOT/src/generated/prisma-client/index.js
:dockerlead
07/07/2022, 3:33 PMdockerlead
07/07/2022, 3:35 PMdockerlead
07/07/2022, 3:37 PMdockerlead
07/07/2022, 3:37 PM"prisma-client-lib": "^1.34.12",
"prisma1": "^1.34.12",
Alex Ruheni
DB_ENDPOINT
is being used by Prisma 1 and DATABASE_URL
is being used by the latest version of Prisma (~2) 🤔dockerlead
07/07/2022, 3:39 PMAlex Ruheni
DATABASE_URL
and use it for running database migrations and querying your database respectively.dockerlead
07/07/2022, 3:51 PMprisma@3
(it's not prisma@4 because we are on node 12) right?Alex Ruheni
dockerlead
07/07/2022, 5:08 PMdockerlead
07/07/2022, 8:23 PMdockerlead
07/07/2022, 8:24 PMprisma1 export
dockerlead
07/07/2022, 8:25 PMUnzipping 10561ms
Uncaught exception, cleaning up: Error: Object {...,"onboarding":"plan",...} has the following unknown properties: onboarding
Validating data ✖
dockerlead
07/07/2022, 8:25 PMdockerlead
07/07/2022, 8:26 PMdockerlead
07/07/2022, 8:27 PMdockerlead
07/08/2022, 7:00 AMnikolasburk
dockerlead
07/08/2022, 7:44 AMdockerlead
07/08/2022, 7:44 AMnikolasburk
dockerlead
07/08/2022, 7:46 AMnikolasburk
prisma export
from the Prisma 1 CLI is not very stable, it’s probably not the right tool to migrate the data…nikolasburk
dockerlead
07/08/2022, 7:46 AMdockerlead
07/08/2022, 7:47 AMdockerlead
07/08/2022, 7:47 AMnikolasburk
But you know, there seems to be no way to create a plain sql dump off the prisma1 cloud by myselfWhere is your DB hosted? You should be able to connect to it directly to export the data…
dockerlead
07/08/2022, 7:49 AMdockerlead
07/08/2022, 7:49 AMnikolasburk
nikolasburk
databases:
default:
connector: mysql
host: mysql
port: 3306
user: root
password: abcdef
rawAccess: true
dockerlead
07/08/2022, 7:50 AMdockerlead
07/08/2022, 7:51 AMdockerlead
07/08/2022, 7:51 AMdockerlead
07/08/2022, 7:51 AMdockerlead
07/08/2022, 7:53 AMAfaik Prisma 1 Cloud only hosts the Prisma 1 server, but not actually your DBIt sounds like prisma1 is just like current version of prisma studio regarding what it was doing
dockerlead
07/08/2022, 7:54 AMdockerlead
07/08/2022, 7:54 AMnikolasburk
dockerlead
07/08/2022, 7:58 AMdockerlead
07/08/2022, 7:59 AMnikolasburk
I will also check with my colleagues if anybody knows where the actual db is.Yeah, this would definitely be able! You’re not using a Demo server, right? You pretty much need to find that Docker Compose file that was used to spin everything up.
dockerlead
07/08/2022, 10:06 PMdockerlead
07/08/2022, 10:07 PMdockerlead
07/08/2022, 10:08 PMdockerlead
07/08/2022, 10:08 PM