Skip to main content

Overview

Deploying Facet AI on your own infrastructure gives you complete control over your fine-tuning platform, data, and costs. This guide covers deploying both the backend services and frontend application.
Production Deployment: This deployment is recommended for production use, enterprise customers, or when you need full control over your infrastructure.

Architecture

Facet AI consists of two main components:

Cloud Services

  • Dataset preprocessing microservice
  • Training orchestration microservice
  • Training, inference, evaluation GPU workers
  • Model export service
  • API Gateway for unified access

Frontend Application

  • Next.js web application
  • User authentication and dashboard
  • Model management interface
  • Real-time training monitoring

Prerequisites

1

Google Cloud Platform Setup

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Note your project ID for later use
  4. Enable billing on your project
Some APIs require billing to be enabled. Make sure billing is active before deployment.
2

Authentication Setup

  1. Authenticate with Google Cloud:
  2. Set your project:
  3. Verify you have the correct permissions (Owner or Editor role)
Verify setup with: gcloud auth list and gcloud config get-value project
Our Terraform IaC includes both production and staging setups. The staging workspace is intended mainly for development and testing; see the staging section for details.

Deploy Backend Services

1

Clone and Setup

  1. Clone the cloud services repository:
  2. Copy and edit the configuration files for your environment:
  3. Edit terraform.tfvars or the appropriate *.tfvars with your project details:
2

Initialize and Deploy

Use our automated deployment script:
The make full-deploy command performs these steps automatically:
  1. Deploy core infrastructure (APIs, IAM, Artifact Registry, Storage, Firebase, networking)
  2. Build and push Docker images to Artifact Registry
  3. Deploy microservices and configure networking (Cloud Run and API Gateway)
Expect the deployment to take ~15-30 minutes depending on region and project size. The process runs unattended in most cases.

Deploy Frontend Application

1

Clone Frontend Repository

2

Configure Environment Variables

  1. Copy the example environment file:
  2. Fill in the environment variables from your backend deployment:
3

Running the Frontend

We recommend using bun for development, but npm or yarn also work.
Access the app at http://localhost:3000 in your browser.

Infrastructure Management

Available Commands

Staging

The staging workspace in the Terraform setup is mainly intended for development and testing. If you’d like a staging environment for your own development, follow the guide in our repo to set up a staging workspace in three commands: https://github.com/gemma-facet/cloud-services/tree/main/infrastructure
Running npm run dev in the frontend will automatically connect to the staging backend since we use Next.js environment variables to differentiate between staging and production. You can manually edit this by changing the .env file.

Infrastructure Components

Core Infrastructure

  • Google Cloud APIs and IAM roles
  • Artifact Registry for container images
  • Service accounts and permissions

Storage Layer

  • Google Cloud Storage buckets
  • Firestore database for metadata
  • Persistent disk volumes

Compute Services

  • Cloud Run services for microservices
  • Cloud Build for container building
  • Cloud Scheduler for batch jobs

Networking

  • API Gateway for unified access
  • VPC and firewall rules
  • Load balancing and SSL certificates

Troubleshooting

Terraform errors:
  • Ensure you have Owner/Editor role on the GCP project
  • Check that billing is enabled
  • Verify all required APIs are enabled
Authentication errors:
  • Run gcloud auth application-default login
  • Set quota project: gcloud auth application-default set-quota-project YOUR_PROJECT_ID
Cloud Run services not starting:
  • Check container logs in Cloud Console
  • Verify environment variables are set correctly
  • Ensure service account has proper permissions
Firebase authentication not working:
  • Enable Google sign-in in Firebase Console
  • Verify OAuth client configuration
  • Check Firebase config in frontend environment variables
Resources already exist:
Need help with deployment? Check our GitHub repository for the latest updates and open an issue if you encounter problems.