-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-main-prod.sh
executable file
·70 lines (49 loc) · 1.88 KB
/
deploy-main-prod.sh
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
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Remove the target directory
# rm -rf target
#Set localhost
#solana config set --url localhost
# Update deps if not updated
# https://solana.stackexchange.com/questions/8800/error-use-of-unstable-library-feature-build-hasher-simple-hash-one
# cargo update -p [email protected] --precise 0.8.6
# Update for drift
# cargo update -p [email protected] --precise 3.14.0
# cargo update -p [email protected] --precise 0.29.0
# solana config set --url mainnet-beta
# solana config set --url devnet
# solana config set --url localhost
# solana config set --url testnet
# Load environment variables from .env file
if [ -f .env ]; then
export $(cat .env | xargs)
fi
if [ -f '/Users/mac/Desktop/BULK/angmar/target/deploy/vault_program-keypair.json' ]; then
rm '/Users/mac/Desktop/BULK/angmar/target/deploy/vault_program-keypair.json'
fi
solana config set --url $RPC_URL
solana program close --buffers
# Build the Solana program
cargo build-sbf --tools-version v1.41
# Check if the build was successful
if [ $? -eq 0 ]; then
# Deploy the Solana program and capture the output
deploy_output=$(solana program deploy ./target/deploy/vault_program.so --with-compute-unit-price 10000 --max-sign-attempts 1000 --use-rpc )
# Extract the Program ID from the output using awk
program_id=$(echo "$deploy_output" | awk '/Program Id:/ {print $3}')
# Generate IDL with shank cli
# shank idl -p $program_id
# Print the Program ID
echo "Program ID: $program_id"
# Navigate to the api directory
cd api
# Print instructions to run the test script
echo "Starting Server. Run './test.sh' in a separate terminal to execute the API requests."
# Export the Program ID as an environment variable and run npm run local
echo "PROGRAM_ID=$program_id npm run dev"
PROGRAM_ID=$program_id npm run dev
else
echo "Build failed. Deployment aborted."
exit 1
fi