前端技术之:Prisma Demo服务部署过程记录
安装前提条件:
1、已经安装了docker运行环境
2、以下命令执行记录发生在MackBook环境
3、已经安装了PostgreSQL(我使用的是11版本)
4、Node开发运行环境可以正常工作
首先需要通过Node包管理器安装Prisma工具:
npm install -g prisma
然后,创建并初始化prisma项目:
prisma init prisma-study
? Set up a new Prisma server or deploy to an existing server? (Use arrow keys)
You can set up Prisma for local development (based on docker-compose)
❯ Use existing database Connect to existing database
Create new database Set up a local database using Docker
Or deploy to an existing Prisma server:
Demo server Hosted demo environment incl. database (requires login)
Use other server Manually provide endpoint of a running Prisma server
选择使用已存在的数据库(Use existing database)后,回车确认选择。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to?
MySQL MySQL compliant databases like MySQL or MariaDB
❯ PostgreSQL PostgreSQL database
移动上下箭头键盘按键,选择PostgreSQL后,再次回车确认选择。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? (Use arrow keys)
❯ No
Yes (experimental - Prisma migrations not yet supported)
Warning: Introspecting databases with existing data is currently an experimental feature. If you find any issues, please report them here: https://github.co
m/prisma/prisma/issues
提示是否在选择的数据库中包含已存在数据。因为是一个新库,所以默认选择No,然后回车确认。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? No
? Enter database host (localhost)
输入数据库的主机地址(注意,因为prisma会运行在docker中,所以,这儿需要配置宿主机IP,在类Linux系统上可以通过ifconfig命令来获取IP)。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? No
? Enter database host 10.111.152.242
? Enter database port (5432)
回车确认使用默认的Postgres数据库的端口。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? No
? Enter database host 10.xxx.xxx.xxx(此处为你的docker宿主机IP)
? Enter database port 5432
? Enter database user
输入数据库的用户名后回车确认。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? No
? Enter database host 10.xxx.xxx.xxx(此处为你的docker宿主机IP)
? Enter database port 5432
? Enter database user postgres
? Enter database password
输入数据库用户对应的密码后回车确认。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? No
? Enter database host 10.xxx.xxx.xxx(此处为你的docker宿主机IP)
? Enter database port 5432
? Enter database user postgres
? Enter database password study
? Enter database name
输入使用的数据库名称后回车。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? No
? Enter database host 10.xxx.xxx.xxx(此处为你的docker宿主机IP)
? Enter database port 5432
? Enter database user postgres
? Enter database password study
? Enter database name study
? Use SSL? (Y/n)
提示是否使用安全的网络协议,这里选择不使用(输入n后回车)。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? No
? Enter database host 10.xxx.xxx.xxx(此处为你的docker宿主机IP)
? Enter database port 5432
? Enter database user postgres
? Enter database password study
? Enter database name study
? Use SSL? No
Connecting to database 18ms
? Select the programming language for the generated Prisma client
Prisma TypeScript Client
Prisma Flow Client
❯ Prisma JavaScript Client
Prisma Go Client
Don't generate
这里选择产生JavaScript客户端脚本(Prisma JavaScript Client)。
? Set up a new Prisma server or deploy to an existing server? Use existing database
? What kind of database do you want to deploy to? PostgreSQL
? Does your database contain existing data? No
? Enter database host 10.xxx.xxx.xxx(此处为你的docker宿主机IP)
? Enter database port 5432
? Enter database user postgres
? Enter database password study
? Enter database name study
? Use SSL? No
Connecting to database 18ms
? Select the programming language for the generated Prisma client Prisma JavaScript Client
Created 3 new files:
prisma.yml Prisma service definition
datamodel.prisma GraphQL SDL-based datamodel (foundation for database)
docker-compose.yml Docker configuration file
Next steps:
1. Open folder: cd prisma-study
2. Start your Prisma server: docker-compose up -d
3. Deploy your Prisma service: prisma deploy
4. Read more about Prisma server:
http://bit.ly/prisma-server-overview
Generating schema... 20ms
Saving Prisma Client (JavaScript) at /Users/chunrong.liu/dev/study/prisma-study/generated/prisma-client/
至此,Prisma项目创建并初始化完毕。
接下来按昭Next steps下面的步骤提示执行后续操作。
通过以下命令切换当前目录至刚创建的项目目录(prisma-study)中。
cd prisma-study/
通过docker编排命令在docker中运行prisma服务器。
docker-compose up -d
执行后命令行提示如下:
Creating prisma-study_prisma_1 … done
此时服务运行成功。
通过以下命令部署prisma服务。
$ prisma deploy
Creating stage default for service default ✔
Deploying service `default` to stage `default` to server `local` 476ms
Changes:
User (Type)
+ Created type `User`
+ Created field `id` of type `GraphQLID!`
+ Created field `name` of type `String!`
+ Created field `updatedAt` of type `DateTime!`
+ Created field `createdAt` of type `DateTime!`
Applying changes 1.2s
Your Prisma GraphQL database endpoint is live:
HTTP: http://localhost:4466
WS: ws://localhost:4466
用流程器打开http://localhost:4466/链接地址,可以看到如下的UI界面。
运行如下命令可以看到演练数据:
$ prisma playground
Serving playground at http://localhost:3000/playground
此时会自动打开浏览器,并显示如下界面:
关于数据库无法连接的问题:
https://blog.csdn.net/liuchunming033/article/details/44810899
官方参考资料地址:
https://www.prisma.io/docs/quickstart/
前端技术之:Prisma Demo服务部署过程记录相关推荐
- Sonic 开源移动端云真机测试平台 - 设备中心接入安卓设备实例演示,Agent端服务部署过程详解
Sonic 开源移动端云真机测试平台 - Agent端服务部署与安卓设备接入演示 一加8手机连接效果图展示 第一章:环境准备 ① agent-sources 资源包下载 ② Android SDK安装 ...
- Skywalking8.5.0-ES7 Rancher部署及ES高可用部署过程记录
背景 近期本司内部需要用到Skywalking进行链路追踪和日志收集,故记录下部署过程,方便后期学习与查询. ElasticSearch高可用部署 ## 1.docker启动elasticsearch ...
- Spring Boot集成阿里云视频点播服务的过程记录
阿里云视频点播 效果预览 视频点播 视频点播概述 功能 优势 流程 环境准备 开通视频点播 创建RAM用户并授权 上传SDK 上传流程 下载上传SDK 安装上传SDK 集成Java上传SDK 异常说明 ...
- Linkis计算中间件部署过程记录
#Linkis安装 sudo useradd hadoop vim /etc/sudoershadoop ALL=(ALL) NOPASSWD: NOPASSWD: ALL vim /home/had ...
- 2019DevFest | 从互联网前端到2B交付型前端-探索面向交付的实用前端技术栈
2019年11月23日,由天津GDG发起,天津多个技术社区主办的"天津人工智能开发者峰会暨天津技术社群联合峰会"在天津渤龙山庄酒店举行.本次大会内容丰富,涵盖人工智能.大数据.互联 ...
- 解密国内BAT等大厂前端技术体系-腾讯篇(长文建议收藏)
1 引言 为了了解当前前端的发展趋势,让我们从国内各大互联网大厂开始,了解他们的最新动态和未来规划.这是解密大厂前端技术体系的第三篇,前两篇已经讲述了阿里和百度在前端技术这几年的技术发展.这一篇从腾讯 ...
- 解密腾讯前端技术体系
1 引言 为了了解当前前端的发展趋势,让我们从国内各大互联网大厂开始,了解他们的最新动态和未来规划.这是解密大厂前端技术体系的第三篇,前两篇已经讲述了阿里和百度在前端技术这几年的技术发展.这一篇从腾讯 ...
- 【视野】解密腾讯完整前端技术体系
1 引言 为了了解当前前端的发展趋势,让我们从国内各大互联网大厂开始,了解他们的最新动态和未来规划.这是解密大厂前端技术体系的第三篇,前两篇已经讲述了阿里和百度在前端技术这几年的技术发展.这一篇从腾讯 ...
- 记一次Tomcat服务部署,启动过滤器异常,问题查找过程
前言 因工作需要,在搭建新的环境时,需要部署war服务,然后初次选择容器时决定使用tomcat8.5,结果遇到了问题,在同事提醒下使用tomcat9才得以解决,但是不能只解决问题,还需要查询产生原因, ...
- 网络云存储技术Windows server 2012 (项目二十 基于NLB的企业Web站点服务部署)
网络云存储技术Windows server 2012 (项目二十 基于NLB的企业Web站点服务部署) 前言 网络存储技术,是以互联网为载体实现数据的传输与存储,它采用面向网络的存储体系结构,使数据处 ...
最新文章
- 转:WinForm程序中两份mdf文件问题的解决方法
- windbg学习-----n(Set Number base)
- LeetCode:917. 仅仅反转字母
- 【BZOJ1923】外星千足虫,高斯消元解xor方程组
- 控件时出现“未能实例化控件******,VS2008 中无法使用ACTIVEX控件的解决
- 树莓派4B控制步进电机(电机28BYJ4+驱动板ULN2003)
- unity3d 700种 材质球_活动策划:这10种气球创意玩法,让活动现场的布置更高级。...
- 梦回山海推广码jn0010 梦回山海推广码
- Cython基础使用
- Big Data 导论HadoopHDFS
- CAN 总线通信 简要概括
- Flying Saucer生成pdf报表
- How to Review a Technical Paper
- python怎么用散点图_Python利用matplotlib绘制散点图的新手教程
- 仿b站demo(效果图)
- java如何将汉字转换为拼音_将汉字转换为汉语拼音java实现
- 如何更清楚的购买自己需要的电脑——配置篇
- vue项目中去空格 回车
- 007:Scrapy核心架构和高级运用
- Maven项目依赖外部jar进行打包的两种方式