Skip to content

Commit

Permalink
cli: add volume to docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed May 8, 2018
1 parent 6195c19 commit 7bdb452
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ services:
default:
connector: mysql
migrations: true
host: db
host: mysql
port: 3306
db:
mysql:
restart: always
environment:
MYSQL_ROOT_PASSWORD: prisma
volumes:
- db-persistence:/var/lib/mysql
volumes:
mysql:
",
"prisma.yml": "endpoint: http://localhost:4466
datamodel: datamodel.graphql",
Expand Down
14 changes: 11 additions & 3 deletions cli/packages/prisma-cli-core/src/utils/EndpointDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,27 @@ const defaultPorts = {

const databaseServiceDefinitions = {
postgres: `
db:
postgres:
image: postgres
restart: always
environment:
POSTGRES_USER: prisma
POSTGRES_PASSWORD: prisma
volumes:
- postgres:/var/lib/postgresql/data
volumes:
postgres:
`,
mysql: `
db:
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: prisma
volumes:
- db-persistence:/var/lib/mysql
volumes:
mysql:
`,
}

Expand Down Expand Up @@ -224,7 +232,7 @@ export class EndpointDialog {
user: type === 'mysql' ? 'root' : 'prisma',
password: 'prisma',
type,
host: 'db',
host: type === 'mysql' ? 'mysql' : 'postgres',
port: defaultPorts[type],
}
dockerComposeYml += this.printDatabaseConfig(credentials)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Object {
"workspaceSlug": undefined,
},
"database": Object {
"host": "db",
"host": "mysql",
"password": "prisma",
"port": 3306,
"type": "mysql",
Expand All @@ -45,12 +45,16 @@ services:
default:
connector: mysql
migrations: true
host: db
host: mysql
port: 3306
db:
mysql:
restart: always
environment:
MYSQL_ROOT_PASSWORD: prisma
volumes:
- db-persistence:/var/lib/mysql
volumes:
mysql:
",
"endpoint": "http://localhost:4466",
"localClusterRunning": false,
Expand Down Expand Up @@ -83,7 +87,7 @@ Object {
"workspaceSlug": undefined,
},
"database": Object {
"host": "db",
"host": "mysql",
"password": "prisma",
"port": 3306,
"type": "mysql",
Expand All @@ -109,12 +113,16 @@ services:
default:
connector: mysql
migrations: true
host: db
host: mysql
port: 3306
db:
mysql:
restart: always
environment:
MYSQL_ROOT_PASSWORD: prisma
volumes:
- db-persistence:/var/lib/mysql
volumes:
mysql:
",
"endpoint": "http://localhost:4466",
"localClusterRunning": true,
Expand Down Expand Up @@ -150,12 +158,16 @@ services:
default:
connector: mysql
migrations: true
host: db
host: mysql
port: 3306
db:
mysql:
restart: always
environment:
MYSQL_ROOT_PASSWORD: prisma
volumes:
- db-persistence:/var/lib/mysql
volumes:
mysql:
",
"prisma.yml": "endpoint: http://localhost:4466
datamodel: datamodel.graphql",
Expand Down

0 comments on commit 7bdb452

Please sign in to comment.