Hello everyone I'll be building a single page appl...
# orm-help
f
Hello everyone I'll be building a single page application soon that in essence all it needs to do is support CRUD features. I am thinking of using Apollo Client with a GraphQL backend. I was planning on simply using Graphcool, I played with it a year ago and it seemed quite straightforward. Now I see Graphcool has this thing called Prisma which if I understand correctly is a framework which allows for hosting GraphQL server oneself. I guess my question would be if my understanding is correct and in addition to that, what are the advantages of running my own GraphQL server over choosing to use hosted solutions like Graphcool used to have a year ago.
j
Go with Prisma. Sure it’s a little bit more work to set up but so much more flexible. The Prisma project also has a lot more momentum than GC BaaS. I don’t want to be a hater but I had a number of reliability issues with with GC BaaS.
The way Prisma works you have 2 servers. A dedicated Prisma server which gives you the CRUD API, and then another server with the business logic that the client interacts with. The client never interacts with the Prisma server directly, they interact with the “business logic” server, which in turn interacts with the Prisma service.
f
@Jim thanks for your response. What is the advantage of having the client talk to a "business logic" server rather than querying the Prisma service?
j
Its a lot more flexible and actually easier to work with when things get more complex. I ran into issues when i needed custom permissions to edit / update. But as said, the main issue for me was reliability.
f
Hmh I plan to maintain this project for a long time so I might go for the most flexible solution.
@Jim do you have an example of a docker-compose file? I am interested in setting a pipeline for automated testing too.
m
I have a Dockerfile/docker-compose.yml that I use to deploy to AWS (for use with lambda--so its based on AMI Linux) that I can share if that would be helpful.
f
@medelman absolutely, there are not many learning resources in this regard
n
@faure have you checked https://www.graph.cool/forum/t/sparkles-awesome-prisma/2878?u=nilan? let me know if that doesn't cover your need, so we can improve our tutorials 😊
m
This is my Dockerfile
Copy code
FROM amazonlinux:2
LABEL com.jamesapp.version="0.0.2-beta"

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

RUN yum update -y && yum install -y \
    apt-transport-https \
    build-essential \
    ca-certificates \
    curl \
    make \
    git \
    libssl-dev \
    wget \
    tar.x86_64 \
    && yum clean all

WORKDIR /home/usr/app

ENV NVM_DIR="/home/usr/.nvm"
ENV NODE_VERSION=8.10.0

RUN curl -o- <https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh> | bash \
    && . $NVM_DIR/nvm.sh \
    && nvm install $NODE_VERSION \
    && nvm alias default $NODE_VERSION \
    && nvm use default

ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
ENV PATH      $NVM_DIR/versions/node/v$NODE_VERSION/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH

RUN curl -o- "<https://bootstrap.pypa.io/get-pip.py>" | python

RUN pip install awscli --upgrade

RUN node -e "console.log('Running Node.js ' + process.version)"

RUN npm i -g yarn

COPY package.json .

RUN yarn && yarn global add serverless prisma graphql-cli

ENV SLS_DEBUG=*

COPY . .
This is my docker-compose.yml file
Copy code
version: '2'
services:
  dev:
    build: .
    env_file:
      - .env
    volumes:
      - .:/home/usr/app
    ports:
      - "5000:5000"
    command: tail -F /dev/null
I then will exec in and run commands, but you can obv modify to suit your needs/start automatically