-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.sh
executable file
·71 lines (57 loc) · 1.58 KB
/
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
67
68
69
70
71
#!/bin/bash
fun_backend() {
echo "Running backend setup..."
docker compose -f ./docker/docker-compose-backend.yml up -d
}
fun_frontend() {
echo "Running frontend setup..."
docker compose -f ./docker/docker-compose-frontend.yml up -d
}
fun_db() {
echo "Running dB setup..."
docker compose -f ./docker/docker-compose-dB.yml up -d
}
if [ "$1" == "backend" ]; then
if [ -f .env.frontend ]; then
echo ".env.frontend file found."
else
echo ".env.frontend file not found. Setting up environment..."
echo "PORT=4000
DATABASE_PORT=5432
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=pass
DATABASE_NAME=db
DATABASE_URL="postgresql://postgres:pass@localhost:5432/db?schema=public"
REDDIS_URL="redis://localhost:6379"
JWT_SECRET='super-secret'
JWT_EXPIRES_IN=604800
EMAIL_ADDRESS=
EMAIL_PASSWORD= # pass app-password if 2FA is enabled" > ./docker/.env.frontend
fi
fun_backend
elif [ "$1" == "frontend" ]; then
if [ -f .env.frontend ]; then
echo ".env.frontend file found."
else
echo ".env.frontend file not found. Setting up environment..."
echo "" > ./docker/.env.frontend
fi
fun_frontend
elif [ "$1" == "db" ]; then
fun_db
elif [ "$1" == "all" ]; then
echo "Running all setup..."
fun_backend
fun_frontend
fun_db
else
echo "
ERROR:
Please provide the correct argument.
Example:
1: ./setup.sh backend # setup backend
2: ./setup.sh frontend # setup frontend
3: ./setup.sh db # setup dB
4: ./setup.sh all # setup all
"
fi