-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
134 lines (99 loc) · 4.22 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
echo "Example) /opt/.django_env"
read -p "Enter .django_env file path: " DJANGO_ENV_FILE_PATH
if [ ! -f $DJANGO_ENV_FILE_PATH ]; then
echo ".django_env File not found"
exit 1
fi
echo "Example) If it is project root directory, enter empty string or if it is inside the directory, config/settings/ (need to enter last at folder '/'!!!)"
read -p "Enter where directory .django_env file paste: " PASTE_DJANGO_ENV_FOLDER_PATH
echo "Example) https://github.com/cwadven/NullyDRFTemplate.git"
read -p "Enter Git Project Url: " GIT_URL
echo "Example) config.settings.production"
read -p "Enter project settings file of django without extension: " CONFIG_SETTINGS
echo "Example) ubuntu"
read -p "Enter Ubuntu Server User Name: " SERVER_USER_NAME
echo "Example) blog"
read -p "Enter New Database Name: " DATABASE_NAME
echo "Example) test_blog"
read -p "Enter New Test Database Name: " TEST_DATABASE_NAME
echo "Example) blog_user"
read -p "Enter New Database User Name: " DATABASE_USER_NAME
echo "Example) passwordsomething"
read -p "Enter New Database User Password: " DATABASE_USER_PASSWORD
echo "Example) blog"
read -p "Enter Flower Username: " FLOWER_USERNAME
echo "Example) password"
read -p "Enter Flower password: " FLOWER_PASSWORD
with_git=(${GIT_URL##*/})
split_with_git=(${with_git//./ })
PROJECT_NAME=(${split_with_git[0]})
DJANGO_ENV_FILE_NAME=$(basename "$DJANGO_ENV_FILE_PATH")
MY_PROJECT_DIRECTORY=/var/www/${PROJECT_NAME}
CURRENT_FOLDER=$PWD
export GIT_URL
export PROJECT_NAME
export MY_PROJECT_DIRECTORY
export CONFIG_SETTINGS
export DJANGO_SETTINGS_MODULE=$CONFIG_SETTINGS
export DATABASE_NAME
export TEST_DATABASE_NAME
export DATABASE_USER_NAME
export DATABASE_USER_PASSWORD
export SERVER_USER_NAME
export DJANGO_ENV_FILE_PATH
export DJANGO_ENV_FILE_NAME
export PASTE_DJANGO_ENV_FOLDER_PATH
export FLOWER_USERNAME
export FLOWER_PASSWORD
export CURRENT_FOLDER
# script 를 단계별로 실행
echo "================start update_linux.sh=================="
. "$CURRENT_FOLDER/jobs/update_linux.sh"
echo "================start open_filewall.sh=================="
. "$CURRENT_FOLDER/jobs/open_filewall.sh"
echo "================start intall_and_set_nginx.sh=================="
. "$CURRENT_FOLDER/jobs/intall_and_set_nginx.sh"
echo "================start set_project_directory_and_create_user_group.sh=================="
. "$CURRENT_FOLDER/jobs/set_project_directory_and_create_user_group.sh"
echo "================start install_python3_11_and_postgresql_lib.sh=================="
. "$CURRENT_FOLDER/jobs/install_python3_11_and_postgresql_lib.sh"
echo "================start install_postgresql14.sh=================="
. "$CURRENT_FOLDER/jobs/install_postgresql14.sh"
echo "================start install_redis.sh=================="
. "$CURRENT_FOLDER/jobs/install_redis.sh"
echo "================start install_pip_modules.sh=================="
. "$CURRENT_FOLDER/jobs/install_pip_modules.sh"
echo "================start set_database.sh=================="
. "$CURRENT_FOLDER/jobs/set_database.sh"
echo "================start set_gunicorn.sh=================="
. "$CURRENT_FOLDER/jobs/set_gunicorn.sh"
echo "================start setting_django_projects.sh=================="
. "$CURRENT_FOLDER/jobs/setting_django_projects.sh"
echo "================start django_migrate.sh=================="
. "$CURRENT_FOLDER/jobs/django_migrate.sh"
echo "================start set_postgresql_id_sequence.sh=================="
. "$CURRENT_FOLDER/jobs/set_postgresql_id_sequence.sh"
echo "================start restart_services.sh=================="
. "$CURRENT_FOLDER/jobs/restart_services.sh"
echo "================start set_celery.sh=================="
. "$CURRENT_FOLDER/jobs/set_celery.sh"
echo "================start set_flower_dashboard.sh=================="
. "$CURRENT_FOLDER/jobs/set_flower_dashboard.sh"
echo "================start add_cron.sh=================="
. "$CURRENT_FOLDER/jobs/add_cron.sh"
unset GIT_URL
unset PROJECT_NAME
unset MY_PROJECT_DIRECTORY
unset CONFIG_SETTINGS
unset DJANGO_SETTINGS_MODULE
unset CURRENT_FOLDER
unset DATABASE_NAME
unset TEST_DATABASE_NAME
unset DATABASE_USER_NAME
unset DATABASE_USER_PASSWORD
unset SERVER_USER_NAME
unset DJANGO_ENV_FILE_PATH
unset DJANGO_ENV_FILE_NAME
unset PASTE_DJANGO_ENV_FOLDER_PATH
unset FLOWER_USERNAME
unset FLOWER_PASSWORD