|
1 | | -# AI Core |
| 1 | +# Flare AI Core |
| 2 | + |
| 3 | +A confidential computing solution for AI workloads on Google Cloud Platform, supporting both AMD SEV and Intel TDX architectures. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Google Cloud Platform account with access to the `google-hackathon-project` |
| 8 | +- Gemini API key |
| 9 | +- `gcloud` CLI installed and configured |
| 10 | + |
| 11 | +## Environment Setup |
| 12 | + |
| 13 | +1. Add the following environment variables to your shell configuration file (`~/.bashrc` or `~/.zshrc`): |
| 14 | + |
| 15 | +```bash |
| 16 | +export TEE_IMAGE_REFERENCE=ghcr.io/flare-foundation/flare-ai-core:main |
| 17 | +export GEMINI_API_KEY=<your-gemini-api-key> |
| 18 | +export WEB3_PROVIDER_URL=https://coston2-api.flare.network/ext/C/rpc |
| 19 | +export WEB3_EXPLORER_URL=https://coston2-explorer.flare.network/ |
| 20 | +export TEAM_NAME=<your-team-name> |
| 21 | +``` |
| 22 | + |
| 23 | +2. Reload your shell configuration: |
| 24 | + |
| 25 | +```bash |
| 26 | +source ~/.bashrc # or ~/.zshrc |
| 27 | +``` |
| 28 | + |
| 29 | +3. Verify the configuration: |
| 30 | + |
| 31 | +```bash |
| 32 | +echo $TEE_IMAGE_REFERENCE # Should output: ghcr.io/flare-foundation/flare-ai-core:main |
| 33 | +``` |
| 34 | + |
| 35 | +## Deployment |
| 36 | + |
| 37 | +### AMD SEV Deployment |
| 38 | + |
| 39 | +Deploy an AMD SEV-enabled instance with the following configuration: |
| 40 | + |
| 41 | +```bash |
| 42 | +gcloud compute instances create ai-core-$TEAM_NAME \ |
| 43 | + --project=google-hackathon-project \ |
| 44 | + --zone=us-central1-c \ |
| 45 | + --machine-type=n2d-standard-2 \ |
| 46 | + --network-interface=network-tier=PREMIUM,nic-type=GVNIC,stack-type=IPV4_ONLY,subnet=default \ |
| 47 | + --metadata=tee-image-reference=$TEE_IMAGE_REFERENCE,\ |
| 48 | +tee-container-log-redirect=true,\ |
| 49 | +tee-env-GEMINI_API_KEY=$GEMINI_API_KEY,\ |
| 50 | +tee-env-GEMINI_MODEL=gemini-1.5-flash,\ |
| 51 | +tee-env-WEB3_PROVIDER_URL=$WEB3_PROVIDER_URL,\ |
| 52 | +tee-env-SIMULATE_ATTESTATION=false \ |
| 53 | + --maintenance-policy=MIGRATE \ |
| 54 | + --provisioning-model=STANDARD \ |
| 55 | + --service-account=confidential-sa@flare-network-sandbox.iam.gserviceaccount.com \ |
| 56 | + --scopes=https://www.googleapis.com/auth/cloud-platform \ |
| 57 | + --min-cpu-platform="AMD Milan" \ |
| 58 | + --tags=flare-ai-core,http-server,https-server \ |
| 59 | + --create-disk=auto-delete=yes,\ |
| 60 | +boot=yes,\ |
| 61 | +device-name=ai-core-$TEAM_NAME,\ |
| 62 | +image=projects/confidential-space-images/global/images/confidential-space-debug-250100,\ |
| 63 | +mode=rw,\ |
| 64 | +size=11,\ |
| 65 | +type=pd-standard \ |
| 66 | + --shielded-secure-boot \ |
| 67 | + --shielded-vtpm \ |
| 68 | + --shielded-integrity-monitoring \ |
| 69 | + --labels=goog-ec-src=vm_add-gcloud \ |
| 70 | + --reservation-affinity=any \ |
| 71 | + --confidential-compute-type=SEV |
| 72 | +``` |
| 73 | + |
| 74 | +### Intel TDX Deployment |
| 75 | + |
| 76 | +For Intel TDX machines, use this alternative configuration: |
| 77 | + |
| 78 | +```bash |
| 79 | +gcloud compute instances create ai-core-$TEAM_NAME \ |
| 80 | + --project=google-hackathon-project \ |
| 81 | + --machine-type=c3-standard-4 \ |
| 82 | + --maintenance-policy=TERMINATE \ |
| 83 | + --zone=us-central1-c \ |
| 84 | + --network-interface=network-tier=PREMIUM,nic-type=GVNIC,stack-type=IPV4_ONLY,subnet=default \ |
| 85 | + --metadata=tee-image-reference=$TEE_IMAGE_REFERENCE,\ |
| 86 | +tee-container-log-redirect=true,\ |
| 87 | +tee-env-GEMINI_API_KEY=$GEMINI_API_KEY,\ |
| 88 | +tee-env-GEMINI_MODEL=gemini-1.5-flash,\ |
| 89 | +tee-env-WEB3_PROVIDER_URL=$WEB3_PROVIDER_URL,\ |
| 90 | +tee-env-SIMULATE_ATTESTATION=false \ |
| 91 | + --provisioning-model=STANDARD \ |
| 92 | + --service-account=confidential-sa@flare-network-sandbox.iam.gserviceaccount.com \ |
| 93 | + --scopes=https://www.googleapis.com/auth/cloud-platform \ |
| 94 | + --tags=flare-ai-core,http-server,https-server \ |
| 95 | + --create-disk=auto-delete=yes,\ |
| 96 | +boot=yes,\ |
| 97 | +device-name=ai-core-$TEAM_NAME,\ |
| 98 | +image=projects/confidential-space-images/global/images/confidential-space-debug-0-tdxpreview-c38b622,\ |
| 99 | +mode=rw,\ |
| 100 | +size=11,\ |
| 101 | +type=pd-balanced \ |
| 102 | + --shielded-secure-boot \ |
| 103 | + --shielded-vtpm \ |
| 104 | + --shielded-integrity-monitoring \ |
| 105 | + --confidential-compute-type=TDX |
| 106 | +``` |
0 commit comments