forked from benjholla/CompletelyDigitalClips
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeploy_application_server.sh
executable file
·67 lines (43 loc) · 2.45 KB
/
deploy_application_server.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
#!/bin/bash
# clear the screen
clear
# reset any changes in the git repo to head of master and remove untracked files and pull updates from master repo
echo "Resetting source repository..."
git pull https://github.com/benjholla/CompletelyDigitalClips.git master &> /dev/null
git pull origin master
git reset --hard
git clean -x -f
# set the application server host name in the configuration template file
printf "\nType the domain name of this website server (ex: team1.cdc.com) followed by [ENTER]:\n"
read WEBSITE_DOMAIN_NAME
sed -i "s/WEBSITE_DOMAIN_NAME/\$WEBSITE_DOMAIN_NAME = \"$WEBSITE_DOMAIN_NAME\";/g" config_template
# set the application server host name in the configuration template file
printf "\nType the host name of this application server (ex: video1, video2, etc.) followed by [ENTER]:\n"
read APPLICATION_HOSTNAME
sed -i "s/APPLICATION_HOSTNAME/\$APPLICATION_HOSTNAME = \"$APPLICATION_HOSTNAME\";/g" config_template
# set the database host name in the configuration template file
printf "\nType the IP address of the database server (ex: 127.0.0.1 or 192.168.1.105) followed by [ENTER]:\n"
read DATABASE_IP
sed -i "s/DATABASE_IP/\$DATABASE_IP = \"$DATABASE_IP\";/g" config_template
# set the database name in the configuration template file
printf "\nType the name of the application database to connect to on the server (ex: application) followed by [ENTER]:\n"
read DATABASE_NAME
sed -i "s/DATABASE_NAME/\$DATABASE_NAME = \"$DATABASE_NAME\";/g" config_template
# set the database username in the configuration template file
printf "\nType the username of the database SQL account to connect the application server to (ex: root) followed by [ENTER]:\n"
read DATABASE_USERNAME
sed -i "s/DATABASE_USERNAME/\$DATABASE_USERNAME = \"$DATABASE_USERNAME\";/g" config_template
# set the database password in the configuration template file
printf "\nType the password of the database account to connect the application server to (ex: cdc) followed by [ENTER]:\n"
read DATABASE_PASSWORD
sed -i "s/DATABASE_PASSWORD/\$DATABASE_PASSWORD = \"$DATABASE_PASSWORD\";/g" config_template
# replace the config.php with the generated config.php file
rm Application/config.php
mv config_template Application/config.php
# copy and replace the file contents of the application source to the webserver directory
sudo rm -rf /var/www/*
sudo cp -a Application/. /var/www/
sudo chmod -R 0755 /var/www/media
sudo chown www-data:www-data /var/www/media
# all done
printf "\nFinished.\n"