-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_django_app.sh
More file actions
executable file
·59 lines (45 loc) · 1.06 KB
/
deploy_django_app.sh
File metadata and controls
executable file
·59 lines (45 loc) · 1.06 KB
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
#!/bin/bash
<< task
Deploy a Django app
and handle the code for errors
task
code_clone(){
echo "Cloning the Django app..."
git clone https://github.com/LondheShubham153/django-notes-app.git
}
install_requirements(){
echo "Installing dependencies"
sudo apt-get install docker.io nginx docker-compose -y
}
required_restart(){
echo "Restarting system..."
sudo chown $USER /var/run/docker.sock
#sudo systemctl enable docker
#sudo systemctl enable nginx
#sudo systemctl restart docker
}
deploy(){
echo "Deploying the project"
docker build -t notes-app .
#docker run -d -p 8000:8000 notes-app:latest
docker-compase up -d
}
echo "*************** Deployment Started ***************"
if !code_clone; then
echo "the code directory already exists"
cd djando-notes-app
fi
if !install_requirements; then
echo "Installation failed"
exit 1
fi
if !required_restart; then
echo "System fault identified"
exit 1
fi
if !deploy; then
echo "Deployment failed and mail to admin"
# sendmail
exit 1
fi
echo "************** Deployment Done ***************"