-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-mainnet.sh
More file actions
67 lines (54 loc) · 2.23 KB
/
Copy pathdeploy-mainnet.sh
File metadata and controls
67 lines (54 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
# Aangan Deployment Script
# This script helps deploy Aangan to the Internet Computer mainnet with proper Internet Identity integration
echo "🚀 Aangan Deployment Script"
echo "================================"
# Check if dfx is installed
if ! command -v dfx &> /dev/null; then
echo "❌ dfx is not installed. Please install dfx first: https://internetcomputer.org/docs/current/developer-docs/setup/install/"
exit 1
fi
# Check if user is logged in to dfx
if ! dfx identity get-principal &> /dev/null; then
echo "❌ Not logged in to dfx. Please run 'dfx identity new <name>' and 'dfx identity use <name>' first"
exit 1
fi
echo "✅ dfx is installed and you are logged in"
# Switch to ic network
echo "🌐 Switching to IC network..."
dfx --network ic identity get-principal
# Deploy to mainnet
echo "📦 Deploying backend canister to IC mainnet..."
dfx deploy --network ic Aangan_backend
# Get the backend canister ID
BACKEND_CANISTER_ID=$(dfx canister --network ic id Aangan_backend)
echo "✅ Backend deployed with ID: $BACKEND_CANISTER_ID"
# Update environment variables
echo "🔧 Updating environment variables..."
echo "CANISTER_ID_AANGAN_BACKEND=$BACKEND_CANISTER_ID" > src/Aangan_frontend/.env.local
echo "DFX_NETWORK=ic" >> src/Aangan_frontend/.env.local
echo "CANISTER_ID_INTERNET_IDENTITY=rdmx6-jaaaa-aaaaa-aaadq-cai" >> src/Aangan_frontend/.env.local
# Build frontend
echo "🏗️ Building frontend..."
cd src/Aangan_frontend
npm run build
cd ../..
# Deploy frontend
echo "🌐 Deploying frontend to IC mainnet..."
dfx deploy --network ic Aangan_frontend
# Get the frontend canister ID
FRONTEND_CANISTER_ID=$(dfx canister --network ic id Aangan_frontend)
echo "✅ Frontend deployed with ID: $FRONTEND_CANISTER_ID"
echo ""
echo "🎉 Deployment completed successfully!"
echo "================================"
echo "Backend Canister ID: $BACKEND_CANISTER_ID"
echo "Frontend Canister ID: $FRONTEND_CANISTER_ID"
echo ""
echo "🌍 Your app is live at:"
echo "https://$FRONTEND_CANISTER_ID.ic0.app"
echo ""
echo "🔐 Internet Identity: https://identity.ic0.app"
echo ""
echo "⚠️ Note: Make sure to update your frontend environment variables with the backend canister ID"
echo " and redeploy if you haven't already done so."