๐ง (WIP) Please don't use it because it's still under development :P
- GraphQL & NodeJs & Prisma & Typescript
- Optimized AWS EC2 & AWS RDS.
git clone https://github.com/hmmhmmhm/prisma-template.git
npm install
npm start
๐ค This template helps a connection with the DB server to actually use it.
You can connect to DB server that is compatible with Prisma. See Primsa Support Database List
This template recommends using AWS RDS as a Database service. The AWS RDS gives you free control over performance and ensures reliable service.
See Connect Prisma With AWS RDS Guide
๐ It is recommended that the DB version be used exactly like the manual. The latest version has a very high probability of error. (In particular, the version 8 of MySQL was not available at all.)
๐ค In the security group, direct ports should be specified and opened in the in-bound and outbound options. (Example: If you are operating an RDS server on a port 3306, you must specify port 3306. Perhaps an option named "MYSQL/Aurora" exists.)
If you do not know anything about Prisma setting, you can obtain the default setting value for Prisma by using the command below.
sudo npm i -g prisma
prisma init hello-world
If you proceed with the above process, you will get the "docker-compose.yml" file. Move the file to "[template path]/docker-compose.yml".
๐ฉ๐ปโ๐ป If you using mysql, delete the schema key that exists in environment -> databases -> default.
๐ฉ๐ปโ๐ป If you using prisma admin page, change to false the rawAccess key that exists in environment -> databases -> default.
๐ค If you want your DB to be accessible not only from within AWS but from other IPs outside, the "Publicly accessible" option should be set to yes.
In prisma 1, you must use the docker without fail, I would like to recommend a preconfigured uuntu image with a preinstalled version of the docker.
๐ฝ Recommended EC2 Image Name: ubuntu-lts-18.04-base-1542848667
โป๏ธ How to Install Node v13.x
sudo apt -y update && sudo apt -y upgrade
curl -sL https://deb.nodesource.com/setup_13.x | sudo bash -
sudo apt-get install -y nodejs
sudo apt-get install gcc g++ make
๐ Configuration your .env keys.
Before you run the server, modify the .env file that exists in the top-level path of the project.
PRISMA_SECRET="prisma_type_your_any_key"
PRISMA_MANAGEMENT_API_SECRET="prisma_type_your_any_key"
APP_SECRET="app_type_your_any_key"
See detail of secret manage kes.
See detail of authentication keys.
๐ฅพ Install & Run Prisma Docker Server
Use the command below to install the docker image before running the server.
sudo docker-compose up -d
๐ง If there is a problem with the Prisma docker server, you can run the docker server again with the command below.
sudo docker-compose kill
sudo docker-compose down
sudo docker-compose up -d
๐ง If there is a problem with the Prisma docker server, you can run the docker server again with the command below.
sudo docker-compose logs
sudo docker ps (you can check docker list)
๐ฅพ Run Prisma Instance Server
Use the command below to start the prisma server as production mode.
sudo npm run production-build
sudo npm run production
or you can start immediately as below,
sudo npm run start
You will be can enter the Prisma Playground, and Prisma Admin Server,
Prisma Playground URL: http://<YOUR_DOMAIN_OR_IP>:4000
Prisma Admin Page URL: http://<YOUR_DOMAIN_OR_IP>:4466
๐ง The administrator page must access the page and enter the token by clicking on the cog-shaped icon. Token can be obtained by typing prisma token on the server where the docker server is running.
sudo npm install -g prisma
prisma token
If you have finished all of the above, the installation process is now complete. Now modify the files in the paths below to configure the Graphql server.
Model Path: (PROJECT_FOLDER)/prisma/datamodel.graphql
Schema Path: (PROJECT_FOLDER)/src/schema.graphql
Resolver Path: (PROJECT_FOLDER)/src/resolvers/
MIT LIncesed.