-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·53 lines (39 loc) · 1.59 KB
/
deploy.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
#!/bin/bash
# Define color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color (reset to default)
RESET='\033[0m' # No Color (reset to default)
echo -e "${GREEN}Deployment proces start...${RESET}"
echo -e "${BLUE}Pull the latest code from GitHub${RESET}"
echo -e "${YELLOW}=======================================${RESET}"
sudo git pull origin master
echo -e "${BLUE}Navigate to the FRONTEND directory${RESET}"
echo -e "${YELLOW}=======================================${RESET}"
cd /var/www/bookshelf.rkshaon.info/frontend
pwd
echo -e "${BLUE}Install Dependencies${RESET}"
echo -e "${YELLOW}=======================================${RESET}"
sudo npm install --legacy-peer-deps
echo -e "${BLUE}Building${RESET}"
echo -e "${YELLOW}=======================================${RESET}"
sudo npm run build
echo -e "${BLUE}Navigate to the BACKEND directory${RESET}"
echo -e "${YELLOW}=======================================${RESET}"
cd /var/www/bookshelf.rkshaon.info/backend
pwd
echo -e "${BLUE}Activating Virtual Environment${RESET}"
echo -e "${YELLOW}=======================================${RESET}"
source env/bin/activate
pip install -r requirements.txt
echo -e "${BLUE}Migrating${RESET}"
echo -e "${YELLOW}=======================================${RESET}"
python manage.py migrate
echo -e "${BLUE}Restart Backend Services${RESET}"
echo -e "${YELLOW}=======================================${RESET}"
systemctl restart gunicorn-bookshelf.service
systemctl restart celery_bookshelf.service
systemctl restart celery_bookshelf_beat.service
echo -e "${RED}Finish${RESET}..."