-
Notifications
You must be signed in to change notification settings - Fork 1
/
frappe-installation.sh
326 lines (286 loc) · 19.2 KB
/
frappe-installation.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
############################---Description---###################################
# #
# Summary : Frappe-Framework #
# Support : ranjithks@am.amrita.edu #
# Created date : Jul 21,2022 #
# Latest Modified date : Jan 10,2023 #
# #
################################################################################
set -e
# Color variables
#A script can use escape sequences to produce colored text on the terminal. Colors for text are represented by color codes,
#including, reset = 0, black = 30, red = 31, green = 32, yellow = 33, blue = 34, magenta = 35, cyan = 36, and white = 37.
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
blue='\033[0;34m'
magenta='\033[0;35m'
cyan='\033[0;36m'
white='\033[0;37m'
# Clear the color after that
clear='\033[0m'
printf "${white}
############################---Description---####################################
# #
# Summary : Frappe-Framework #
# Support : ${yellow}ranjithks@am.amrita.edu${clear} #
# Created date : Jul 21,2022 #
# Latest Modified date : Jan 10,2023 #
# Created by : ${blue}RANJITHKUMAR SEKAR${clear} #
# #
#################################################################################
${clear}
"
############################---Usage---##########################################
# #
# Accounting #
# Warehouse Management #
# CRM #
# Sales #
# Purchase #
# HRMS #
# Project Management #
# Support #
# Asset Management #
# Quality Management #
# Manufacturing #
# Website Management #
# Customize ERPNext #
# And More #
# #
#################################################################################
#bold colors
bld_red='\033[1;31m'
bld_green='\033[1;32m'
bld_yellow='\033[2;33m'
bld_blue='\033[1;34m'
bld_magenta='\033[1;35m'
bld_cyan='\033[1;36m'
bld_white='\033[1;37m'
#background colors
bg_red='\033[0;41m'
bg_green='\033[0;42m'
bg_yellow='\033[0;43m'
bg_blue='\033[0;44m'
bg_magenta='\033[0;45m'
bg_cyan='\033[0;46m'
#text bold
bold=`tput bold`
offbold=`tput rmso`
#Frappe, pronounced fra-pay, is a full stack, batteries-included, web framework written in Python and Javascript with MariaDB as the database.
#It is the framework which powers ERPNext. It is pretty generic and can be used to build database driven apps.
#The key difference in Frappe compared to other frameworks is that meta-data is also treated as data and is used to build front-ends very easily.
#We believe in a monolithic architecture, so Frappe comes with almost everything you need to build a modern web application.
#It has a full featured Admin UI called the Desk that handles forms, navigation, lists, menus, permissions, file attachment and much more out of the box.
function entering()
{
PARAM_PROGRESS=$1;
PARAM_PHASE=$2;
if [ $CURRENT_PROGRESS -le 0 -a $PARAM_PROGRESS -ge 0 ] ; then echo -ne "[..........................] (0%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 5 -a $PARAM_PROGRESS -ge 5 ] ; then echo -ne "[#.........................] (5%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 10 -a $PARAM_PROGRESS -ge 10 ]; then echo -ne "[##........................] (10%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 15 -a $PARAM_PROGRESS -ge 15 ]; then echo -ne "[###.......................] (15%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 20 -a $PARAM_PROGRESS -ge 20 ]; then echo -ne "[####......................] (20%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 25 -a $PARAM_PROGRESS -ge 25 ]; then echo -ne "[#####.....................] (25%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 30 -a $PARAM_PROGRESS -ge 30 ]; then echo -ne "[######....................] (30%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 35 -a $PARAM_PROGRESS -ge 35 ]; then echo -ne "[#######...................] (35%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 40 -a $PARAM_PROGRESS -ge 40 ]; then echo -ne "[########..................] (40%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 45 -a $PARAM_PROGRESS -ge 45 ]; then echo -ne "[#########.................] (45%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 50 -a $PARAM_PROGRESS -ge 50 ]; then echo -ne "[##########................] (50%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 55 -a $PARAM_PROGRESS -ge 55 ]; then echo -ne "[###########...............] (55%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 60 -a $PARAM_PROGRESS -ge 60 ]; then echo -ne "[############..............] (60%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 65 -a $PARAM_PROGRESS -ge 65 ]; then echo -ne "[#############.............] (65%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 70 -a $PARAM_PROGRESS -ge 70 ]; then echo -ne "[###############...........] (70%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 75 -a $PARAM_PROGRESS -ge 75 ]; then echo -ne "[#################.........] (75%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 80 -a $PARAM_PROGRESS -ge 80 ]; then echo -ne "[####################......] (80%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 85 -a $PARAM_PROGRESS -ge 85 ]; then echo -ne "[#######################...] (85%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 90 -a $PARAM_PROGRESS -ge 90 ]; then echo -ne "[##########################] (100%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 100 -a $PARAM_PROGRESS -ge 100 ];then echo -ne ${cyan}'Script Loading! \n'${clear} ; delay; fi;
CURRENT_PROGRESS=$PARAM_PROGRESS;
}
function delay()
{
sleep 0.2;
}
printf "${green}
________________________________________________________________________
| |
| ENTERING SCRIPT |
|________________________________________________________________________|
${clear}\n"
CURRENT_PROGRESS=0
entering 10 " Initialize "
entering 20
entering 40
entering 60
entering 80
entering 90
entering 100 "Entered "
echo
# Step 1: Server Setup
timedatectl set-timezone "Asia/Kolkata"
sudo apt-get update -y
# Git is a distributed version control system: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development.
#Its goals include speed, data integrity, and support for distributed, non-linear workflows.
sudo apt-get install git -y
printf "${bld_yellow}
Installing Resources
${clear}"
#This guide is a comprehensive resource for contributing to Python – for both new and experienced contributors.
#It is maintained by the same community that maintains Python. We welcome your contributions to Python!
sudo apt-get install -y python3-dev python3.10-venv
#Python Package Manager is a Python utility intended to simplify the tasks of locating, installing, upgrading and removing Python packages.
#It can determine if the most recent version of a software package is installed on a system, and can install or upgrade that package from a local or remote host.
sudo apt-get -y install python3-setuptools python3-pip virtualenv
#MariaDB is a database. MariaDB is very similar to MySQL (a database management system) and, in fact, a fork to MySQL.
#The MariaDB database is used for various purposes such as data warehousing, e-commerce, enterprise-level features, and logging applications.
sudo apt-get install -y software-properties-common
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://ftp.icm.edu.pl/pub/unix/database/mariadb/repo/10.3/ubuntu focal main'
sudo apt update
sudo apt install -y mariadb-server
sudo chmod 777 /etc/mysql/my.cnf
printf "${bold}${green}
Resources Installed...!
${offblod}${clear}\n"
#mysql_secure_installation is a shell script available on Unix systems, and enables you to improve the security of your MariaDB installation in the following ways: You can set a password for root accounts.
#You can remove root accounts that are accessible from outside the local host.
sudo echo "[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4" >> /etc/mysql/my.cnf
printf "${red}
################## ######### ############
If You already using # Mysql/Maria DB # Please # Enter # Existing # Password #
################## ######### ############
${clear}"
printf "${green}
OR
_____________________________
| |
| --------- |
| Press | ENTER | to continue |
| --------- |
|_____________________________|
${clear}"
sudo mysql -uroot -p << EOF
flush privileges;
alter user root@localhost identified by 'Frappe@123';
flush privileges;
EOF
sudo service mysql restart
printf "${yellow}
__________________________
$ $
$ Mysql root user $
$ Password is ${clear}${green}| Frappe@123 | ${clear}${yellow} $
$ _________________________$ ${clear}
"
# Redis is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability.
#Redis supports different kinds of a bstract data structures, such as strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indices.
#url is a tool to transfer data from or to a server, using one of the supported protocols
#(DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP).
#The command is designed to work without user interaction.
sudo apt-get install -y redis-server curl
sudo chmod 644 /etc/mysql/my.cnf
# Node.js is a cross-platform, open-source server environment that can run on Windows, Linux, Unix, macOS, and more.
#Node.js is a back-end JavaScript runtime environment, runs on the V8 JavaScript Engine, and executes JavaScript code outside a web browser.
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
# Yarn is a software packaging system developed in 2016 by Facebook for the Node.js JavaScript runtime environment.
#An alternative to the npm package manager, Yarn was created as a collaboration of Facebook, Exponent, Google, and Tilde to solve consistency, security, and performance problems with large codebases
sudo npm install -g yarn
#wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine.
#These run entirely "headless" and do not require a display or display service.
sudo apt-get install -y xvfb libfontconfig wkhtmltopdf
# Bench is a CLI tool to manage Frappe Deployments. It provides an easy interface to help you setup and manage multiple sites and apps based on Frappe Framework.
sudo -H pip3 install frappe-bench
cd ~
#The iced drink is generally made up of water, espresso, sugar, milk, ice and is shaken, blended or beaten to combine the ingredients.
#It tends to be served with whipped cream and toppings such as sweet sauces and presented in a tall glass. Traditionally a Frappé is made with coffee, but it doesn't have to be!
sudo service mysql restart
bench init frappe-framework --frappe-branch version-14
cd frappe-framework/
#Frappe Framework Tutorial. Install and Setup Bench. Create an App. Create a Site. Create a DocType. DocType Features
#Frappe Apps. Contribute Translations. Frappe Ajax Call. How to Enable Backup Encryption. App Development. Custom Action in Link Field.
bench new-site frappe.com
# set current site
bench use erp_next.com
printf "
${bld_green}
(Project Strating-:)...)
${clear}
"
printf "${yellow}
####################---Project Details---###################
${clear}
_____________________________________________________________________________
| |
| ${green}# Project Path:${clear}${red} /home/username/frappe-framework${clear} |
| |
| ${green}# Site Path: ${clear}${red} /home/username/frappe-framework/sites/ ${clear} |
| |
| ${green}# MySQL root user Password: ${clear}${red} Frappe@123 ${clear} |
| |
| ${green}# Application URL: ${clear}${red}http://localhost:8000${clear} |
| |
| ${green}# Application Username: ${clear}${red} Administrator${clear} |
|_____________________________________________________________________________|
${red}Notes:${clear} ${blue}[Please check the ${clear} ${magenta}'/home/username/frappe-framework/Project_Details.txt'${clear}${blue} file for above Project Details]${clear}\n
"
printf "
####################---Project Details---###################
_____________________________________________________________________________
| |
| # Project Path: /home/username/frappe-framework |
| |
| # Site Path: /home/username/frappe-framework/sites/ |
| |
| # MySQL root user Password: Frappe@123 |
| |
| # Application URL: http://localhost:8000 |
| |
| # Application Username: Administrator |
| |
| # Any Query mailto: ranjithks@am.amrita.edu |
|_____________________________________________________________________________|\n
" > Project_Details.txt
function progress()
{
PARAM_PROGRESS=$1;
PARAM_PHASE=$2;
if [ $CURRENT_PROGRESS -le 0 -a $PARAM_PROGRESS -ge 0 ] ; then echo -ne "[..........................] (0%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 5 -a $PARAM_PROGRESS -ge 5 ] ; then echo -ne "[#.........................] (5%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 10 -a $PARAM_PROGRESS -ge 10 ]; then echo -ne "[##........................] (10%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 15 -a $PARAM_PROGRESS -ge 15 ]; then echo -ne "[###.......................] (15%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 20 -a $PARAM_PROGRESS -ge 20 ]; then echo -ne "[####......................] (20%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 25 -a $PARAM_PROGRESS -ge 25 ]; then echo -ne "[#####.....................] (25%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 30 -a $PARAM_PROGRESS -ge 30 ]; then echo -ne "[######....................] (30%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 35 -a $PARAM_PROGRESS -ge 35 ]; then echo -ne "[#######...................] (35%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 40 -a $PARAM_PROGRESS -ge 40 ]; then echo -ne "[########..................] (40%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 45 -a $PARAM_PROGRESS -ge 45 ]; then echo -ne "[#########.................] (45%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 50 -a $PARAM_PROGRESS -ge 50 ]; then echo -ne "[##########................] (50%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 55 -a $PARAM_PROGRESS -ge 55 ]; then echo -ne "[###########...............] (55%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 60 -a $PARAM_PROGRESS -ge 60 ]; then echo -ne "[############..............] (60%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 65 -a $PARAM_PROGRESS -ge 65 ]; then echo -ne "[#############.............] (65%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 70 -a $PARAM_PROGRESS -ge 70 ]; then echo -ne "[###############...........] (70%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 75 -a $PARAM_PROGRESS -ge 75 ]; then echo -ne "[#################.........] (75%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 80 -a $PARAM_PROGRESS -ge 80 ]; then echo -ne "[####################......] (80%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 85 -a $PARAM_PROGRESS -ge 85 ]; then echo -ne "[#######################...] (85%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 90 -a $PARAM_PROGRESS -ge 90 ]; then echo -ne "[##########################] (100%) $PARAM_PHASE \r" ; delay; fi;
if [ $CURRENT_PROGRESS -le 100 -a $PARAM_PROGRESS -ge 100 ];then echo -ne ${cyan}'Script Loading! \n'${clear} ; delay; fi;
CURRENT_PROGRESS=$PARAM_PROGRESS;
}
CURRENT_PROGRESS=0
progress 10 Initialize
progress 20 "Resources Setup... "
progress 40 "Database Setup... "
progress 60 "Bench Setup "
progress 80 "Processing... "
progress 90 "Finalizing... "
progress 100 "Done "
echo
# project start
bench start