GCP
Learn how to deploy R2R into Google Cloud
Deploying R2R on Google Cloud Platform
Google Cloud Platform (GCP) offers a robust and scalable environment for deploying R2R (RAG to Riches). This guide will walk you through the process of setting up R2R on a Google Compute Engine instance, making it accessible both locally and publicly.
Overview
Deploying R2R on GCP involves the following main steps:
- Creating a Google Compute Engine instance
- Installing necessary dependencies
- Setting up R2R
- Configuring port forwarding for local access
- Exposing ports for public access (optional)
This guide assumes you have a Google Cloud account and the necessary permissions to create and manage Compute Engine instances.
Creating a Google Compute Engine Instance
- Log in to the Google Cloud Console.
- Navigate to “Compute Engine” > “VM instances”.
- Click “Create Instance”.
- Choose the following settings:
- Name: Choose a name for your instance
- Region and Zone: Select based on your location/preferences
- Machine Configuration:
- Series: N1
- Machine type: n1-standard-4 (4 vCPU, 15 GB memory) or higher
- Boot disk:
- Operating System: Ubuntu
- Version: Ubuntu 22.04 LTS
- Size: 500 GB
- Firewall: Allow HTTP and HTTPS traffic
- Click “Create” to launch the instance.
Installing Dependencies
SSH into your newly created instance using the Google Cloud Console or gcloud command:
Now, run the following commands to install the necessary R2R dependencies:
Setting up R2R
- Serve your R2R backend:
- Double check the health of the system:
- Test ingesting and searching a sample document from a remote environment:
Replace <your-instance-external-ip>
with your Google Compute Engine instance’s external IP address.
Configuring Port Forwarding for Local Access
To access R2R from your local machine, use SSH port forwarding:
Exposing Ports for Public Access (Optional)
To make R2R publicly accessible:
-
In the Google Cloud Console, go to “VPC network” > “Firewall”.
-
Click “Create Firewall Rule”.
-
Configure the rule:
- Name: Allow-R2R
- Target tags: r2r-server
- Source IP ranges: 0.0.0.0/0
- Specified protocols and ports: tcp:7272
-
Click “Create”.
-
Add the network tag to your instance:
- Go to Compute Engine > VM instances.
- Click on your instance name.
- Click “Edit”.
- Under “Network tags”, add “r2r-server”.
- Click “Save”.
-
Ensure R2R is configured to listen on all interfaces (0.0.0.0).
After starting your R2R application, users can access it at:
Security Considerations
- Use HTTPS (port 443) with a valid SSL certificate for production.
- Restrict source IP addresses in the firewall rule if possible.
- Regularly update and patch your system and applications.
- Monitor incoming traffic for suspicious activities.
- Remove or disable the firewall rule when not needed for testing.
Conclusion
You have now successfully deployed R2R on Google Cloud Platform. The application should be accessible locally through SSH tunneling and optionally publicly through direct access to the Compute Engine instance. Remember to configure authentication and implement proper security measures before exposing your R2R instance to the public internet.
For more information on configuring and using R2R, refer to the configuration documentation.