Skip to Content
✨ AI powered documentation for ResilientDB Ecosystem and Apps
DocumentationResilient DB GraphQLSetting Up ResilientDB GraphQL

Setting Up ResilientDB GraphQL

This guide will help you set up ResilientDB GraphQL on your system. Follow these steps to get started.

Prerequisites

  • Python 3.10 or higher
  • pip (Python package manager)
  • Virtual environment (recommended)
  • Nginx (for production deployment)

Installation

  1. Clone the repository:
git clone https://github.com/apache/incubator-resilientdb-graphql.git cd incubator-resilientdb-graphql
  1. Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Start the development server:
python3 app.py

The server will be available at http://localhost:5000/graphql

Production Deployment

For production deployment, follow these steps:

  1. Install Nginx:
sudo apt-get install nginx -y
  1. Configure Nginx as a reverse proxy:
sudo vim /etc/nginx/conf.d/flask.conf

Add the following configuration:

server { listen 80; server_name your_domain_or_ip; location / { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }
  1. Create a systemd service:
sudo vim /etc/systemd/system/flask.service

Add the following configuration:

[Unit] Description=Gunicorn instance to serve Flask After=network.target [Service] User=root Group=www-data WorkingDirectory=/path/to/your/app Environment="PATH=/path/to/your/app/venv/bin" ExecStart=/path/to/your/app/venv/bin/gunicorn --bind 0.0.0.0:8000 wsgi:app [Install] WantedBy=multi-user.target
  1. Start and enable the service:
sudo systemctl daemon-reload sudo systemctl start flask sudo systemctl enable flask

Troubleshooting

If you encounter any issues during installation, make sure you have all the prerequisites installed and your Python version is compatible.

Common issues and solutions:

  1. Port already in use

    • Check if another service is using port 5000
    • Change the port in your configuration
  2. Permission denied

    • Ensure you have the correct permissions for the installation directory
    • Use sudo for system-wide installations
  3. Dependency conflicts

    • Use a virtual environment to isolate dependencies
    • Check for conflicting package versions

Next Steps

Once you have completed the setup, you can start using ResilientDB GraphQL. Check out the Usage Guide for examples and best practices.

Last updated on