Hey everyone, I was just wondering, if there are a...
# orm-help
p
Hey everyone, I was just wondering, if there are any complete guides on how to deploy a full prisma application to a root server running Ubuntu. I would like to host my first project like this to save some money until it scales up, concerning user counts. (including graphql-yoga server)
h
I used this
docker-compose.yml
to create a prisma cluster on my server
but I don’t have a guide
p
@horia.ancas Thank you very much. I will look into the repository.
@max Do you have any experience with setting up a complete prod system (with graphql-yoga, prisma and db) on one server? I've read your posts at https://www.graph.cool/forum/t/advice-on-best-practise-deploying-graphql-yoga-server-w-prisma-in-production/2348 and it seemed to me, that you also may have some knowledge about that one server setup.
l
The Prisma DigitalOcean tutorial should work for any Ubuntu VPS install. I don’t recall anything DO specific. You’ll want to combine that tutorial with setting up a production Node app. DO has great tutorials on that.
m
@pasa Patrick, yes you can set it all up on one server. You may find my tutorial helpful: https://github.com/maxdarque/prisma-docker My setup is AWS Lambda + Apex/Up for the server, Prisma running on docker on a free EC2 instance, and AWS RDS MySQL. I have only had my server running locally on docker with: Dockerfile
Copy code
FROM node:8.9.4-alpine

# create a work directory inside the container
RUN mkdir /app
WORKDIR /app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied where available (npm@5+)
COPY package*.json ./
COPY yarn.lock ./

# install utilities
RUN npm install -g yarn

# install dependencies
RUN yarn

COPY dist/. /app/dist/.
COPY src/. /app/src/. 

EXPOSE 8080

CMD [ "yarn", "start" ]
docker-compose.yml
Copy code
version: "3"
services:
  graphql-server:
    image: max/graphql-server:0.1
    container_name: "graphql-server"
    restart: always
    ports: 
      - "0.0.0.0:${PORT}:8080"
    env_file: .env
Does that answer your question?
under small load, prisma on docker uses ~500mb RAM and ~10% of one CPU
p
@max Thank you very much, I will try my best. 😄
First I have to clean out my dev server now and afterwards, I'm gonna try to set everything up.
👍 1
m
@pasa I also have this tutorial for setting up Apex/Up https://github.com/maxdarque/up-graphql-yoga-server-example
With the free tier on AWS, it costs me a few dollars a month to run my server plus $10 a month for
Up Pro
p
Well technically I should be able to run everything on my root server. Performance is not that big of a concern at the moment. Accessibility, on the other hand, is. When I reach some scale, I will scale up my setup too.
👍 1
@max Do I have to eject prisma, to be able to select a custom db and much more important set a more secure password than "graphcool"?
m
@pasa What do you mean by eject? Are you referring to a particular Prisma instance?
Where did you see that the password needed to be be "graphcool"?
SQL_INTERNAL_DATABASE needs to be set to graphcool
you set your own pwd: DB_USERNAME=db-username DB_PWD=db-pwd
p
@max Thank you very much, for your answers. I'm currently setting up everything. When I run docker-compose up I get the Warning: 'SQL exception occurred: Unknown table 'replica_host_status' in information_schema' tough. Any thoughts about this? What could cause it and should I worry about it?
@max By the way. The db is running on my root server.