File: setup_env.sh

package info (click to toggle)
python-azure 20251104%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 770,224 kB
  • sloc: python: 6,357,217; ansic: 804; javascript: 287; makefile: 198; sh: 193; xml: 109
file content (77 lines) | stat: -rwxr-xr-x 2,751 bytes parent folder | download
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
76
77
#!/bin/bash
# cspell:disable
# setup_env.sh - Automates Azure Cosmos SDK scale testing environment setup
# Usage: bash setup_env.sh

set -e

# 1. System update and install dependencies
echo "[Step 1] System update and install dependencies: started."
sudo apt-get update
sudo apt-get install -y python3-pip python3.12-venv wget gnupg
sudo apt install neovim
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
echo "[Step 1] System update and install dependencies: completed."

# 2. Create and activate Python virtual environment
echo "[Step 2] Create and activate Python virtual environment: started."
python3 -m venv azure-cosmosdb-sdk-environment
source azure-cosmosdb-sdk-environment/bin/activate
echo "[Step 2] Create and activate Python virtual environment: completed."

# 3. Install Python requirements
echo "[Step 3] Install Python requirements: started."
pip install --upgrade pip
cd ../../
pip install -r dev_requirements.txt
pip install azure-monitor-opentelemetry
# azure core needs to be reinstalled to avoid cannot find Spanning Error from open telemetry
pip install ../../core/azure-core
echo "[Step 3] Install Python requirements: completed."

# 4. Install the current azure-cosmos package
echo "[Step 4] Install the current azure-cosmos package: started."
pip install .
cd tests/workloads
echo "[Step 4] Install the current azure-cosmos package: completed."

# 5. Install Envoy proxy
echo "[Step 5] Install Envoy proxy: started."

if command -v envoy &> /dev/null; then
    echo "Envoy proxy is already installed. Version: $(envoy --version)"
else
    wget -O- https://apt.envoyproxy.io/signing.key | sudo gpg --dearmor -o /etc/apt/keyrings/envoy-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/envoy-keyring.gpg] https://apt.envoyproxy.io focal main" | sudo tee /etc/apt/sources.list.d/envoy.list
    sudo apt-get update
    sudo apt-get install -y envoy
    envoy --version
fi
# create logs directory for envoy
cd envoy
mkdir logs
cd ..

echo "[Step 5] Install Envoy proxy: completed."

# 6. Manual steps
echo "[Step 6] Manual steps: started."
cat << EOF

Manual steps remaining:
----------------------
1. Fill out relevant configs in tests/workloads/workload_configs.py (key, host, etc).
2. Generate Envoy config:
   cd envoy
   ./generate_envoy_config.sh <template_file_path> <output_envoy_config_file> <account_name> <write_region> <read_region>
3. Start Envoy:
   envoy -c <envoy_config_file>.yaml --log-level debug --log-path logs/debug.txt
4. Run initial setup workload:
   cd ../tests/workloads
   python3 initial-setup.py
5. Run scale workloads:
   ./run_workloads.sh <number of clients per workload>

Refer to dev.md for more details.
EOF
echo "[Step 6] Manual steps: completed."