forked from whisperrnote/whisperrnote
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·75 lines (59 loc) · 1.98 KB
/
deploy.sh
File metadata and controls
executable file
·75 lines (59 loc) · 1.98 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
68
69
70
71
72
73
74
75
#!/bin/bash
set -e
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
# Check required tools
echo -e "${YELLOW}Checking required tools...${NC}"
command -v dfx >/dev/null 2>&1 || { echo -e "${RED}dfx is required but not installed.${NC}" >&2; exit 1; }
command -v pnpm >/dev/null 2>&1 || { echo -e "${RED}pnpm is required but not installed.${NC}" >&2; exit 1; }
# Run predeploy script first
./predeploy.sh
# Run the node setup first
./setup-nodes.sh &
NODE_SETUP_PID=$!
# Wait for nodes to be fully initialized (check context-info.txt)
while [ ! -f "context-info.txt" ]; do
echo "Waiting for nodes to initialize..."
sleep 5
done
CONTEXT_ID=$(grep "Context ID:" context-info.txt | cut -d' ' -f3)
# Configure dfx environment
dfx start --clean --background
# Deploy canisters
echo -e "${YELLOW}Deploying canisters...${NC}"
# Create canisters
dfx canister create notes_canister
dfx canister create sharing_canister
dfx canister create sync_canister
# Get canister IDs
NOTES_CANISTER_ID=$(dfx canister id notes_canister)
SHARING_CANISTER_ID=$(dfx canister id sharing_canister)
SYNC_CANISTER_ID=$(dfx canister id sync_canister)
# Deploy canisters with appropriate node configuration
dfx deploy notes_canister --argument "(record {
node_url = \"http://localhost:2427\";
context_id = \"$CONTEXT_ID\";
})"
dfx deploy sharing_canister --argument "(record {
node_url = \"http://localhost:2429\";
context_id = \"$CONTEXT_ID\";
})"
dfx deploy sync_canister --argument "(record {
node_url = \"http://localhost:2428\";
context_id = \"$CONTEXT_ID\";
})"
# Save deployment information
cat > deployment-info.txt << EOF
Notes Canister ID: $NOTES_CANISTER_ID
Sharing Canister ID: $SHARING_CANISTER_ID
Sync Canister ID: $SYNC_CANISTER_ID
Context ID: $CONTEXT_ID
EOF
echo -e "${GREEN}Deployment complete!${NC}"
echo "Deployment information saved to deployment-info.txt"
# Start development server
echo -e "${YELLOW}Starting development server...${NC}"
pnpm dev