-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsetup_env.sh
executable file
·72 lines (64 loc) · 1.61 KB
/
setup_env.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
69
70
71
72
#!/usr/bin/env bash
set -e
# cd to project root
cd `dirname $0`/..
# Update the submodule code
set -x
git submodule sync
git submodule update --init --recursive
set +x
# Set environment variables required for Openstack and k8s cluster setup
if [[ -f .env ]]
then
echo "source .env"
source .env
else
echo "Create a .env file. Take env_sample as example"
exit 1
fi
if [[ $1 = "node" ]]
then
if [[ ! -d node_modules ]]
then
# Setup node environment
set -x
sudo apt-get remove nodejs npm
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install npm@latest-5
sudo chown -R 1000:1000 "/home/ubuntu/.npm"
#sudo npm install -g npm
npm install
npm run fabric-v1.4-deps
set +x
fi
else
# Setup python environment
if [[ -d venv ]]
then
echo "source venv/bin/activate"
source venv/bin/activate
else
set -x
mkdir venv
sudo apt update
sudo apt-get install --yes python
curl -O https://bootstrap.pypa.io/2.7/get-pip.py
python get-pip.py
python -m pip install --upgrade "pip < 21.0"
pip install virtualenv
virtualenv --python=python3 venv
source ./venv/bin/activate
pip install -r requirements.txt
pip install -r kubespray/requirements.txt
set +x
fi
fi
# Create ansible.log file if not present
if [[ ! -f ansible.log ]]
then
touch ansible.log
fi