-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·51 lines (40 loc) · 1.76 KB
/
start.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
#!/bin/bash
SHORTURL_DIR='shorturl'
# Check if the shorturl directory exists
if [ -d "$SHORTURL_DIR" ]; then
echo "[SHORTURL START.SH] $SHORTURL_DIR Already exists" ;
echo "[SHORTURL START.SH] Delete the shorturl repository and all its subfolder"
rm -rf $SHORTURL_DIR
fi
# Create the shorturl directory
mkdir -p $SHORTURL_DIR;
echo "[SHORTURL START.SH] $SHORTURL_DIR directory is created"
# Change the current directory
cd $SHORTURL_DIR
echo "[SHORTURL START.SH] Working directory changed. Now, we are in $SHORTURL_DIR"
# Download repositories
echo "[SHORTURL START.SH] Check if GIT command exists"
if ! command -v git &> /dev/null
then
echo "[SHORTURL START.SH] GIT could not be found"
exit
fi
echo "[SHORTURL START.SH] GIT command exists"
echo "[SHORTURL START.SH] Start downloading API github repository"
git clone https://github.com/maelfosso/shorturl-api api && (cd api && npm install)
echo "[SHORTURL START.SH] API github repository downloaded"
echo "[SHORTURL START.SH] Start downloading WebApp github repository"
git clone https://github.com/maelfosso/shorturl-webapp webapp && (cd webapp && npm install)
echo "[SHORTURL START.SH] WebApp github repository downloaded"
echo "[SHORTURL START.SH] Start downloading Startup-Files github repository"
git clone https://github.com/maelfosso/shorturl-startup-files startup-files
echo "[SHORTURL START.SH] Startup-Files github repository downloaded"
ln -s $(pwd)/startup-files/docker-compose.development.yaml docker-compose.development.yaml
echo "[SHORTURL START.SH] Check if DOCKER-COMPOSE command exists"
if ! command -v git &> /dev/null
then
echo "[SHORTURL START.SH] DOCKER-COMPOSE could not be found"
exit
fi
echo "[SHORTURL START.SH] DOCKER-COMPOSE command exists"
docker-compose -f docker-compose.development.yaml up