-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocal-setup.sh
executable file
·66 lines (52 loc) · 1.57 KB
/
local-setup.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
#!/usr/bin/env bash
# Check if Docker is installed
if [ ! command -v docker &>/dev/null ]; then
# Install Docker
echo "Docker is not installed. Installing..."
# Update package index
sudo apt-get update
# Install Docker
sudo apt install docker.io
# Add User to docker Group
sudo usermod -aG docker $USER
echo "Docker has been installed. Rerun the script to continue!"
newgrp docker
fi
# Prepare Dapr environment
cd ~
if [ ! command dapr &>/dev/null ]; then
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash
dapr init # to initialize dapr
fi
if [ ! -d "update-golang" ]; then
# Prepare Golang environment
git clone https://github.com/udhos/update-golang
cd update-golang
sudo ./update-golang.sh
fi
if [ ! command -v python3 &>/dev/null ]; then
echo "Python 3 is not installed. Installing..."
sudo apt-get update
sudo apt-get install -y python3
fi
if [ ! command -v npm &> /dev/null ]; then
# Prepare Node environment
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt-get install -y nodejs
fi
source /etc/profile.d/golang_path.sh
# Setup dapr config
mkdir -p ~/.dapr
cp -r ~/12-factor-app/local/components ~/.dapr
# Build Golang application
cd ~/12-factor-app/go
go build go_events.go
# Install Python Requirements
cd ~/12-factor-app/python
if [ ! -d "venv" ]; then
virtualenv venv --python /usr/bin/python3
fi
source venv/bin/activate
pip3 install -r ./requirements.txt
# Install Node Requirements
cd ~/12-factor-app/node
npm install