forked from ballerine-io/ballerine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ballerine_install.sh
executable file
·55 lines (43 loc) · 1.54 KB
/
ballerine_install.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
#!/usr/bin/env bash
set -e
# Example Usage:
# ./ballerine_install.sh <VITE_API_URL_DOMAIN_NAME>
echo "Running as: $(id)"
WORKFLOW_SERVICE_DOMAIN_NAME=$1
function update_frontend_build_variables() {
## Get frontend application env files
echo "Updating frontend Build Variables"
env_files=$(find ./apps -name "*.env.example")
echo $env_files
for i in $env_files;
do
echo "Updating env variables of $i"
sed -i "s/localhost/${WORKFLOW_SERVICE_DOMAIN_NAME}/g" $i
done
}
function update_env_docker_compose(){
## update env variables for docker-compose yaml
echo "Updating docker-compose env variables"
env_files=$(find ./deploy -name "*.env")
for i in $env_files;
do
echo "Updating env variables of $i"
sed -i "s/DOMAIN_NAME=\"\"/DOMAIN_NAME=\"${WORKFLOW_SERVICE_DOMAIN_NAME}\"/g" $i;
done
}
function install_docker(){
sudo apt update;
sudo apt install -y docker.io
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
sudo mv ~/.docker/cli-plugins/docker-compose /usr/bin/docker-compose
}
install_docker
if [[ ! -z "${WORKFLOW_SERVICE_DOMAIN_NAME}" ]]; then
### Update frontend build variables only if domain_name is given
update_frontend_build_variables
update_env_docker_compose
fi
## Bring docker-container up
cd deploy; sudo docker-compose -f docker-compose-build.yml up -d