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
- Create GCP Project
- Install Required Tools
- Go to Google Cloud Console
- Create a new project or select an existing one
- Note your project ID for later use
- Enable billing on your project
Some APIs require billing to be enabled. Make sure billing is active before deployment.
2
Authentication Setup
-
Authenticate with Google Cloud:
-
Set your project:
- Verify you have the correct permissions (Owner or Editor role)
Verify setup with:
gcloud auth list and gcloud config get-value projectOur 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
-
Clone the cloud services repository:
-
Copy and edit the configuration files for your environment:
-
Edit
terraform.tfvarsor the appropriate*.tfvarswith your project details:
2
Initialize and Deploy
Use our automated deployment script:
The
make full-deploy command performs these steps automatically:- Deploy core infrastructure (APIs, IAM, Artifact Registry, Storage, Firebase, networking)
- Build and push Docker images to Artifact Registry
- 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.
3
Our IaC configures Firebase authentication (email/password) for you so the frontend can run out of the box. It does not enable Google OAuth by default. To add Google sign-in, go to Firebase Console → Authentication → Sign-in method and enable Google.
Deploy Frontend Application
1
Clone Frontend Repository
2
Configure Environment Variables
-
Copy the example environment file:
-
Fill in the environment variables from your backend deployment:
3
Running the Frontend
- Run Locally
- Deploy to Vercel
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
Deployment Commands
Deployment Commands
Management Commands
Management Commands
Build Commands
Build 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/infrastructureRunning
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
Deployment Issues
Deployment Issues
Terraform errors:
- Ensure you have Owner/Editor role on the GCP project
- Check that billing is enabled
- Verify all required APIs are enabled
- Run
gcloud auth application-default login - Set quota project:
gcloud auth application-default set-quota-project YOUR_PROJECT_ID
Service Issues
Service Issues
Cloud Run services not starting:
- Check container logs in Cloud Console
- Verify environment variables are set correctly
- Ensure service account has proper permissions
- Enable Google sign-in in Firebase Console
- Verify OAuth client configuration
- Check Firebase config in frontend environment variables
Resource Conflicts
Resource Conflicts
Resources already exist:
Need help with deployment? Check our GitHub repository for the latest updates and open an issue if you encounter problems.