Development Setup with Slash GraphQL

Hi all,

this is more or less a continuation from a previous post.
I am struggling with a development setup. Whenever I try to learn a new technology I’m doing this using TDD and building a small app. Doing it that way gives me a better feeling on how the development workflow will look like and usually shows me some edge cases of the technology (which is usually more than the 101 blog post you find online). On top of that, I’m trying to set up a small CI/CD pipeline with that technology.

Now, for DGraph I’m wondering what the right approach might be. Especially if I want to test drive out the functionality but also want to switch to Slash Graphql later on. I could test with a docker container for example. What is your approach in this case? And how can you do the transition?

What is your way for a ‘clean’ project (I found this blog post, but here the auther tests against a concrete running Slash DGraph instance)?

Furthermore, I am a big fan of the JAM stack at the moment (Vercel, Netlify,…). How can you integrate Slash Graphql for such scenarios?

Thanks in advance & best regards,
LJ1090

Hi @LJ1090!

For your local environment, IMO Docker is the way to go, but as containers are ephemeral by nature I’d have some automation around loading your dataset/sample data into the Dgraph container. Additionally, here’s a docker-compose snippet you can append to your compose files with two Dgraph backing instances (https://github.com/dgraph-io/dgraph/raw/master/contrib/config/docker/docker-compose.yml):

# This Docker Compose file can be used to quickly bootup Dgraph Zero
# and Alpha in different Docker containers.

# It mounts /tmp/data on the host machine to /dgraph within the
# container. You can change /tmp/data to a more appropriate location.
# Run `docker-compose up` to start Dgraph.

version: "3.2"
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080
  alpha:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=alpha:7080 --zero=zero:5080
  ratel:
    image: dgraph/dgraph:latest
    ports:
      - 8000:8000
    command: dgraph-ratel

This link (https://dgraph.io/docs/slash-graphql/migrating-from-hosted-dgraph/) might help regarding migrating from the Dgraph docker container to Slash GraphQL.

The following links may also be helpful:

Regarding integrating a jamstack app w/ GraphQL, one option is to maybe use a JS framework that has a data layer built on top of GraphQL? This article (GraphQL and the Jamstack | StepZen blog) recommends Gatsby and Gridsome (the latter of which is based on Vue). The Dgraph Tutorial Center (http://dgraph.io/learn) also has tutorials regarding building frontend applications w/ Slash GraphQL that may also be useful for your project.

1 Like