GithubHelp home page GithubHelp logo

prisma-template's Introduction

Prisma Template!

๐Ÿšง (WIP) Please don't use it because it's still under development :P

PRISMA LOGO

๐Ÿš€ย Spec

  • GraphQL & NodeJs & Prisma & Typescript
  • Optimized AWS EC2 & AWS RDS.

๐Ÿงฉ Installation

git clone https://github.com/hmmhmmhm/prisma-template.git
npm install
npm start

๐Ÿงฉ Guide for Connect of RDS <-> Prisma

๐Ÿค” 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

๐Ÿ“™ 1 - Create AWS RDS Instance

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

โš ๏ธ NO HIGHEST DB VERSION

๐Ÿ˜“ 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.)

โš ๏ธ CHECK PORT FORWARDING

๐Ÿค“ 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.)

๐Ÿ“™ 2 - Pre Setup "docker-compose.yml"

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".

โ€ผ๏ธ(IMPORTANT) YOU MUST REMOVE "SCHEMA" KEY IN DOCKER-COMPOSE.YML

๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป If you using mysql, delete the schema key that exists in environment -> databases -> default.

โ€ผ๏ธ(IMPORTANT) YOU MUST SET FALSE "rawAccess" KEY IN DOCKER-COMPOSE.YML

๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป If you using prisma admin page, change to false the rawAccess key that exists in environment -> databases -> default.

โš ๏ธ IF YOU WANT CONNECT TO AT HOME CHECK PUBLICLY

๐Ÿค“ 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.

๐Ÿ“™ 3 - Create AWS EC2 Instance

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
๐Ÿ˜‡ YOU CAN USE DOCKER RE-INSTALL COMMAND

๐Ÿšง 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
๐Ÿ˜‡ YOU CAN ALSO CHECK DOCKER LOGS

๐Ÿšง 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

๐Ÿ“™ 4 - Check your endpoints

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

๐Ÿ˜“ YOU NEED TO CHECK YOUR ADMIN TOKEN

๐Ÿšง 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
๐Ÿ‘‹ FINISHED INSTALLATION

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/

๐Ÿ“™ LICENSE

MIT LIncesed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.