prismagraphql/prisma
The Data Layer for Modern Applications
50M+
Prisma is a performant open-source infrastructure layer simplifying databases workflows. Learn how to get started with Prisma here.
The Docker CLI and Docker Compose CLI are used to manage the Prisma servers.
Here's a quick rundown of the most important commands:
docker-compose up -d
: Start a new Prisma server to which you can deploy your Prisma services.docker-compose stop
: Stops the Prisma server.docker-compose pull
: Downloads the latest Prisma images from Docker Hubdocker logs
: Shows the logs of the Prisma server (helpful for debugging).Note that these commands need to be executed in the directory where the Docker Compose file for your Prisma server is available.
Here is an overview of all properties you need to configure on the prisma
Docker image inside your Docker Compose file. The all-uppercase words represent placeholders for the configuration variables you need to provide for your Prisma setup.
version: '3'
services:
prisma:
image: prismagraphql/prisma:__LATEST_PRISMA_VERSION__
restart: always
ports:
- "4466:4466"
environment:
PRISMA_CONFIG: |
managementApiSecret: __YOUR_MANAGEMENT_API_SECRET__
port: __YOUR_PRISMA_SERVER_PORT__
databases:
default:
connector: __YOUR_DATABASE_CONNECTOR__
migrations: __ENABLE_DB_MIGRATIONS__
host: __YOUR_DATABASE_HOST__
port: __YOUR_DATABASE_PORT__
user: __YOUR_DATABASE_USER__
password: __YOUR_DATABASE_PASSWORD__
Most notably most of your configuration takes place in the PRISMA_CONFIG
environment variable.
Root properties
These are the root properties of PRISMA_CONFIG
:
Key | Type | Description |
---|---|---|
managementApiSecret | string | The Management API secret is used by the Prisma CLI to generate authentication tokens and authenticate its requests against the Prisma server. Example: mysecret42 |
port | number | The port on which the Prisma server is running. Example: 4466 |
databases | object | Specifies to which databases the Prisma server should connect to. |
Database properties
Each database object in the databases
object needs to include the following properties:
Key | Type | Description |
---|---|---|
host | string | The IP address or URL of the machine hosting the database. Example: 127.0.0.1 |
port | number | The post where the database is running. |
user | string | The database user. Example: root |
password | string | The password for the database user specified in user . Example: myDBpassword42 |
To get insights into the internals of your Prisma server, you can check the logs of the Docker container.
View the raw logs from the running Docker containers:
docker-compose logs
Verify that the containers are running:
docker ps
You should see an output similar to this:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2b799c529e73 prismagraphql/prisma:1.7 "/bin/sh -c /app/sta…" 17 hours ago Up 7 hours 0.0.0.0:4466->4466/tcp myapp_prisma_1
757dfba212f7 mysql:5.7 "docker-entrypoint.s…" 17 hours ago Up 7 hours 3306/tcp prisma-db
This is helpful when you're getting an error message saying Error response from daemon: No such container
.
If your local Prisma server is in an unrecoverable state, it might be necessary to completely reset it:
docker-compose kill
docker-compose down
docker-compose up -d
Read more about Prisma in the official documentation.
docker pull prismagraphql/prisma