Revert "Remove nginx-common package"
[discourse_docker.git] / discourse-setup
1 #!/usr/bin/env bash
2 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3 cd $DIR
4
5 ##
6 ## Make sure only root can run our script
7 ##
8 check_root() {
9 if [[ $EUID -ne 0 ]]; then
10 echo "This script must be run as root. Please sudo or log in as root first." 1>&2
11 exit 1
12 fi
13 }
14
15 ##
16 ## Check whether a connection to HOSTNAME ($1) on PORT ($2) is possible
17 ##
18 connect_to_port () {
19 HOST="$1"
20 PORT="$2"
21 VERIFY=$(date +%s | sha256sum | base64 | head -c 20)
22 if ! [ -x "$(command -v nc)" ]; then
23 echo "In order to check the connection to $HOST:$PORT we need to open a socket using netcat."
24 echo However netcat is not installed on your system. You can continue without this check
25 echo or abort the setup, install netcat and try again.
26 while true; do
27 read -p "Would you like to continue without this check? [yn] " yn
28 case $yn in
29 [Yy]*) return 2 ;;
30 [Nn]*) exit ;;
31 *) echo "Please answer y or n." ;;
32 esac
33 done
34 else
35 echo -e "HTTP/1.1 200 OK\n\n $VERIFY" | nc -w 4 -l -p $PORT >/dev/null 2>&1 &
36 if curl --proto =http -s $HOST:$PORT --connect-timeout 3 | grep $VERIFY >/dev/null 2>&1; then
37 return 0
38 else
39 curl --proto =http -s localhost:$PORT >/dev/null 2>&1
40 return 1
41 fi
42 fi
43 }
44
45 check_IP_match() {
46 HOST="$1"
47 echo
48 echo Checking your domain name . . .
49 connect_to_port $HOST 443; ec=$?
50 case $ec in
51 0)
52 echo "Connection to $HOST succeeded."
53 ;;
54 1)
55 echo "WARNING:: This server does not appear to be accessible at $HOST:443."
56 echo
57 if connect_to_port $HOST 80; then
58 echo A connection to port 80 succeeds, however.
59 echo This suggests that your DNS settings are correct,
60 echo but something is keeping traffic to port 443 from getting to your server.
61 echo Check your networking configuration to see that connections to port 443 are allowed.
62 else
63 echo "A connection to http://$HOST (port 80) also fails."
64 echo
65 echo "This suggests that $HOST resolves to the wrong IP address"
66 echo or that traffic is not being routed to your server.
67 fi
68 echo
69 echo Google: \"open ports YOUR CLOUD SERVICE\" for information for resolving this problem.
70 echo
71 echo If you want to proceed anyway, you will need to
72 echo edit the containers/app.yml file manually.
73 exit 1
74 ;;
75 2)
76 echo "Continuing without port check."
77 ;;
78 esac
79 }
80
81 ##
82 ## Do we have docker?
83 ##
84 check_and_install_docker () {
85 docker_path=`which docker.io || which docker`
86 if [ -z $docker_path ]; then
87 read -p "Docker not installed. Enter to install from https://get.docker.com/ or Ctrl+C to exit"
88 curl https://get.docker.com/ | sh
89 fi
90 docker_path=`which docker.io || which docker`
91 if [ -z $docker_path ]; then
92 echo Docker install failed. Quitting.
93 exit
94 fi
95 }
96
97 ##
98 ## What are we running on
99 ##
100 check_OS() {
101 echo `uname -s`
102 }
103
104 ##
105 ## OS X available memory
106 ##
107 check_osx_memory() {
108 echo `free -m | awk '/Mem:/ {print $2}'`
109 }
110
111 ##
112 ## Linux available memory
113 ##
114 check_linux_memory() {
115 ## some VMs report just under 1GB of RAM, so
116 ## make an exception and allow those with more
117 ## than 989MB
118 mem=`free -m --si | awk ' /Mem:/ {print $2}'`
119 if [ "$mem" -ge 990 -a "$mem" -lt 1000 ]; then
120 echo 1
121 else
122 echo `free -g --si | awk ' /Mem:/ {print $2} '`
123 fi
124 }
125
126 ##
127 ## Do we have enough memory and disk space for Discourse?
128 ##
129 check_disk_and_memory() {
130
131 os_type=$(check_OS)
132 avail_mem=0
133 if [ "$os_type" == "Darwin" ]; then
134 avail_mem=$(check_osx_memory)
135 else
136 avail_mem=$(check_linux_memory)
137 fi
138
139 if [ "$avail_mem" -lt 1 ]; then
140 echo "WARNING: Discourse requires 1GB RAM to run. This system does not appear"
141 echo "to have sufficient memory."
142 echo
143 echo "Your site may not work properly, or future upgrades of Discourse may not"
144 echo "complete successfully."
145 exit 1
146 fi
147
148 if [ "$avail_mem" -le 2 ]; then
149 total_swap=`free -g --si | awk ' /Swap:/ {print $2} '`
150
151 if [ "$total_swap" -lt 2 ]; then
152 echo "WARNING: Discourse requires at least 2GB of swap when running with 2GB of RAM"
153 echo "or less. This system does not appear to have sufficient swap space."
154 echo
155 echo "Without sufficient swap space, your site may not work properly, and future"
156 echo "upgrades of Discourse may not complete successfully."
157 echo
158 echo "Ctrl+C to exit or wait 5 seconds to have a 2GB swapfile created."
159 sleep 5
160
161 ##
162 ## derived from https://meta.discourse.org/t/13880
163 ##
164 install -o root -g root -m 0600 /dev/null /swapfile
165 fallocate -l 2G /swapfile
166 mkswap /swapfile
167 swapon /swapfile
168 echo "/swapfile swap swap auto 0 0" | tee -a /etc/fstab
169 sysctl -w vm.swappiness=10
170 echo 'vm.swappiness = 10' > /etc/sysctl.d/30-discourse-swap.conf
171
172 total_swap=`free -g --si | awk ' /Swap:/ {print $2} '`
173 if [ "$total_swap" -lt 2 ]; then
174 echo "Failed to create swap: are you root? Are you running on real hardware, or a fully virtualized server?"
175 exit 1
176 fi
177
178 fi
179 fi
180
181
182 free_disk="$(df /var | tail -n 1 | awk '{print $4}')"
183 if [ "$free_disk" -lt 5000 ]; then
184 echo "WARNING: Discourse requires at least 5GB free disk space. This system"
185 echo "does not appear to have sufficient disk space."
186 echo
187 echo "Insufficient disk space may result in problems running your site, and"
188 echo "may not even allow Discourse installation to complete successfully."
189 echo
190 echo "Please free up some space, or expand your disk, before continuing."
191 echo
192 echo "Run \`apt-get autoremove && apt-get autoclean\` to clean up unused"
193 echo "packages and \`./launcher cleanup\` to remove stale Docker containers."
194 exit 1
195 fi
196
197 }
198
199
200 ##
201 ## If we have lots of RAM or lots of CPUs, bump up the defaults to scale better
202 ##
203 scale_ram_and_cpu() {
204
205 local changelog=/tmp/changelog.$PPID
206 # grab info about total system ram and physical (NOT LOGICAL!) CPU cores
207 avail_gb=0
208 avail_cores=0
209 os_type=$(check_OS)
210 if [ "$os_type" == "Darwin" ]; then
211 avail_gb=$(check_osx_memory)
212 avail_cores=`sysctl hw.ncpu | awk '/hw.ncpu:/ {print $2}'`
213 else
214 avail_gb=$(check_linux_memory)
215 avail_cores=$((`awk '/cpu cores/ {print $4;exit}' /proc/cpuinfo`*`sort /proc/cpuinfo | uniq | grep -c "physical id"`))
216 fi
217 echo "Found ${avail_gb}GB of memory and $avail_cores physical CPU cores"
218
219 # db_shared_buffers: 128MB for 1GB, 256MB for 2GB, or 256MB * GB, max 4096MB
220 if [ "$avail_gb" -eq "1" ]
221 then
222 db_shared_buffers=128
223 else
224 if [ "$avail_gb" -eq "2" ]
225 then
226 db_shared_buffers=256
227 else
228 db_shared_buffers=$(( 256 * $avail_gb ))
229 fi
230 fi
231 db_shared_buffers=$(( db_shared_buffers < 4096 ? db_shared_buffers : 4096 ))
232
233 sed -i -e "s/^ #\?db_shared_buffers:.*/ db_shared_buffers: \"${db_shared_buffers}MB\"/w $changelog" $data_file
234 if [ -s $changelog ]
235 then
236 echo "setting db_shared_buffers = ${db_shared_buffers}MB"
237 rm $changelog
238 fi
239
240 # UNICORN_WORKERS: 2 * GB for 2GB or less, or 2 * CPU, max 8
241 if [ "$avail_gb" -le "2" ]
242 then
243 unicorn_workers=$(( 2 * $avail_gb ))
244 else
245 unicorn_workers=$(( 2 * $avail_cores ))
246 fi
247 unicorn_workers=$(( unicorn_workers < 8 ? unicorn_workers : 8 ))
248
249 sed -i -e "s/^ #\?UNICORN_WORKERS:.*/ UNICORN_WORKERS: ${unicorn_workers}/w $changelog" $web_file
250 if [ -s $changelog ]
251 then
252 echo "setting UNICORN_WORKERS = ${unicorn_workers}"
253 rm $changelog
254 fi
255
256 echo $data_file memory parameters updated.
257 }
258
259
260 ##
261 ## standard http / https ports must not be occupied
262 ##
263 check_ports() {
264 check_port "80"
265 check_port "443"
266 echo "Ports 80 and 443 are free for use"
267 }
268
269
270 ##
271 ## check a port to see if it is already in use
272 ##
273 check_port() {
274
275 local valid=$(netstat -tln | awk '{print $4}' | grep ":${1}\$")
276
277 if [ -n "$valid" ]; then
278 echo "Port ${1} appears to already be in use."
279 echo
280 echo "This will show you what command is using port ${1}"
281 lsof -i tcp:${1} -s tcp:listen
282 echo
283 echo "If you are trying to run Discourse simultaneously with another web"
284 echo "server like Apache or nginx, you will need to bind to a different port"
285 echo
286 echo "See https://meta.discourse.org/t/17247"
287 echo
288 echo "If you are reconfiguring an already-configured Discourse, use "
289 echo
290 echo "./launcher stop app"
291 echo
292 echo "to stop Discourse before you reconfigure it and try again."
293 exit 1
294 fi
295 }
296
297 ##
298 ## read a variable from the config file
299 ##
300 read_config() {
301 config_line=`egrep "^ #?$1:" $web_file`
302 read_config_result=`echo $config_line | awk -F":" '{print $2}'`
303 read_config_result=`echo $read_config_result | sed "s/^\([\"']\)\(.*\)\1\$/\2/g"`
304 }
305
306 read_default() {
307 config_line=`egrep "^ #?$1:" samples/standalone.yml`
308 read_default_result=`echo $config_line | awk -F":" '{print $2}'`
309 read_default_result=`echo $read_config_result | sed "s/^\([\"']\)\(.*\)\1\$/\2/g"`
310 }
311
312 ##
313 ## prompt user for typical Discourse config file values
314 ##
315 ask_user_for_config() {
316
317 # NOTE: Defaults now come from standalone.yml
318
319 local changelog=/tmp/changelog.$PPID
320 read_config "DISCOURSE_SMTP_ADDRESS"
321 local smtp_address=$read_config_result
322 # NOTE: if there are spaces between emails, this breaks, but a human should be paying attention
323 read_config "DISCOURSE_DEVELOPER_EMAILS"
324 local developer_emails=$read_config_result
325 read_config "DISCOURSE_SMTP_PASSWORD"
326 local smtp_password=$read_config_result
327 read_config "DISCOURSE_SMTP_PORT"
328 local smtp_port=$read_config_result
329 read_config "DISCOURSE_SMTP_USER_NAME"
330 local smtp_user_name=$read_config_result
331 if [ "$smtp_password" = "pa$$word" ]
332 then
333 smtp_password = ""
334 fi
335 read_config "LETSENCRYPT_ACCOUNT_EMAIL"
336 local letsencrypt_account_email=$read_config_result
337 if [ -z $letsencrypt_account_email ]
338 then
339 letsencrypt_account_email="me@example.com"
340 fi
341 if [ "$letsencrypt_account_email" = "me@example.com" ]
342 then
343 local letsencrypt_status="ENTER to skip"
344 else
345 local letsencrypt_status="Enter 'OFF' to disable."
346 fi
347
348 read_config "DISCOURSE_HOSTNAME"
349 hostname=$read_config_result
350
351 local new_value=""
352 local config_ok="n"
353 local update_ok="y"
354
355 echo ""
356
357 while [[ "$config_ok" == "n" ]]
358 do
359 if [ ! -z "$hostname" ]
360 then
361 read -p "Hostname for your Discourse? [$hostname]: " new_value
362 if [ ! -z "$new_value" ]
363 then
364 hostname="$new_value"
365 fi
366 if [[ $hostname =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]
367 then
368 echo
369 echo "Discourse requires a DNS hostname. IP addresses are unsupported and will not work."
370 echo
371 hostname="discourse.example.com"
372 fi
373 fi
374
375 check_IP_match $hostname
376
377 if [ ! -z "$developer_emails" ]
378 then
379 read -p "Email address for admin account(s)? [$developer_emails]: " new_value
380 if [ ! -z "$new_value" ]
381 then
382 developer_emails="$new_value"
383 fi
384 fi
385
386 if [ ! -z "$smtp_address" ]
387 then
388 read -p "SMTP server address? [$smtp_address]: " new_value
389 if [ ! -z "$new_value" ]
390 then
391 smtp_address="$new_value"
392 fi
393 fi
394
395 if [ ! -z "$smtp_port" ]
396 then
397 read -p "SMTP port? [$smtp_port]: " new_value
398 if [ ! -z "$new_value" ]
399 then
400 smtp_port="$new_value"
401 fi
402 fi
403
404 ##
405 ## automatically set correct user name based on common mail providers unless it's been set
406 ##
407 if [ "$smtp_user_name" == "user@example.com" ]
408 then
409 if [ "$smtp_address" == "smtp.sparkpostmail.com" ]
410 then
411 smtp_user_name="SMTP_Injection"
412 fi
413 if [ "$smtp_address" == "smtp.sendgrid.net" ]
414 then
415 smtp_user_name="apikey"
416 fi
417 if [ "$smtp_address" == "smtp.mailgun.org" ]
418 then
419 smtp_user_name="postmaster@$hostname"
420 fi
421 fi
422
423 if [ ! -z "$smtp_user_name" ]
424 then
425 read -p "SMTP user name? [$smtp_user_name]: " new_value
426 if [ ! -z "$new_value" ]
427 then
428 smtp_user_name="$new_value"
429 fi
430 fi
431
432 read -p "SMTP password? [$smtp_password]: " new_value
433 if [ ! -z "$new_value" ]
434 then
435 smtp_password="$new_value"
436 fi
437
438 if [ ! -z $letsencrypt_account_email ]
439 then
440 read -p "Optional email address for Let's Encrypt warnings? ($letsencrypt_status) [$letsencrypt_account_email]: " new_value
441 if [ ! -z "$new_value" ]
442 then
443 letsencrypt_account_email="$new_value"
444 if [ "${new_value,,}" = "off" ]
445 then
446 letsencrypt_status="ENTER to skip"
447 else
448 letsencrypt_status="Enter 'OFF' to disable."
449 fi
450 fi
451 fi
452
453 echo -e "\nDoes this look right?\n"
454 echo "Hostname : $hostname"
455 echo "Email : $developer_emails"
456 echo "SMTP address : $smtp_address"
457 echo "SMTP port : $smtp_port"
458 echo "SMTP username : $smtp_user_name"
459 echo "SMTP password : $smtp_password"
460
461 if [ "$letsencrypt_status" == "Enter 'OFF' to disable." ]
462 then
463 echo "Let's Encrypt : $letsencrypt_account_email"
464 fi
465
466
467 echo ""
468 read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_ok
469 done
470
471 sed -i -e "s/^ DISCOURSE_HOSTNAME:.*/ DISCOURSE_HOSTNAME: $hostname/w $changelog" $web_file
472 if [ -s $changelog ]
473 then
474 rm $changelog
475 else
476 echo "DISCOURSE_HOSTNAME change failed."
477 update_ok="n"
478 fi
479
480 sed -i -e "s/^ DISCOURSE_DEVELOPER_EMAILS:.*/ DISCOURSE_DEVELOPER_EMAILS: \'$developer_emails\'/w $changelog" $web_file
481 if [ -s $changelog ]
482 then
483 rm $changelog
484 else
485 echo "DISCOURSE_DEVELOPER_EMAILS change failed."
486 update_ok="n"
487 fi
488
489 sed -i -e "s/^ DISCOURSE_SMTP_ADDRESS:.*/ DISCOURSE_SMTP_ADDRESS: $smtp_address/w $changelog" $web_file
490 if [ -s $changelog ]
491 then
492 rm $changelog
493 else
494 echo "DISCOURSE_SMTP_ADDRESS change failed."
495 update_ok="n"
496 fi
497
498 sed -i -e "s/^ #\?DISCOURSE_SMTP_PORT:.*/ DISCOURSE_SMTP_PORT: $smtp_port/w $changelog" $web_file
499 if [ -s $changelog ]
500 then
501 rm $changelog
502 else
503 echo "DISCOURSE_SMTP_PORT change failed."
504 update_ok="n"
505 fi
506
507 sed -i -e "s/^ #\?DISCOURSE_SMTP_USER_NAME:.*/ DISCOURSE_SMTP_USER_NAME: $smtp_user_name/w $changelog" $web_file
508 if [ -s $changelog ]
509 then
510 rm $changelog
511 else
512 echo "DISCOURSE_SMTP_USER_NAME change failed."
513 update_ok="n"
514 fi
515
516 if [[ "$smtp_password" == *"\""* ]]
517 then
518 SLASH="BROKEN"
519 echo "========================================"
520 echo "WARNING!!!"
521 echo "Your password contains a quote (\")"
522 echo "Your SMTP Password will not be set. You will need to edit app.yml to enter it."
523 echo "========================================"
524 update_ok="n"
525 else
526 SLASH="|"
527 if [[ "$smtp_password" == *"$SLASH"* ]]
528 then SLASH="+"
529 if [[ "$smtp_password" == *"$SLASH"* ]]
530 then
531 SLASH="Q"
532 if [[ "$smtp_password" == *"$SLASH"* ]]
533 then
534 SLASH="BROKEN"
535 echo "========================================"
536 echo "WARNING!!!"
537 echo "Your password contains all available delimiters (+, |, and Q). "
538 echo "Your SMTP Password will not be set. You will need to edit app.yml to enter it."
539 echo "========================================"
540 update_ok="n"
541 fi
542 fi
543 fi
544 fi
545 if [[ "$SLASH" != "BROKEN" ]]
546 then
547 sed -i -e "s${SLASH}^ #\?DISCOURSE_SMTP_PASSWORD:.*${SLASH} DISCOURSE_SMTP_PASSWORD: \"${smtp_password}\"${SLASH}w $changelog" $web_file
548
549 if [ -s $changelog ]
550 then
551 rm $changelog
552 else
553 echo "DISCOURSE_SMTP_PASSWORD change failed."
554 update_ok="n"
555 fi
556 fi
557
558 echo "Enabling Let's Encrypt"
559 sed -i -e "s/^ #\?LETSENCRYPT_ACCOUNT_EMAIL:.*/ LETSENCRYPT_ACCOUNT_EMAIL: $letsencrypt_account_email/w $changelog" $web_file
560 if [ -s $changelog ]
561 then
562 rm $changelog
563 else
564 echo "LETSENCRYPT_ACCOUNT_EMAIL change failed."
565 update_ok="n"
566 fi
567 local src='^ #\?- "templates\/web.ssl.template.yml"'
568 local dst=' \- "templates\/web.ssl.template.yml"'
569 sed -i -e "s/$src/$dst/w $changelog" $web_file
570 if [ -s $changelog ]
571 then
572 echo "web.ssl.template.yml enabled"
573 else
574 update_ok="n"
575 echo "web.ssl.template.yml NOT ENABLED--was it on already?"
576 fi
577 local src='^ #\?- "templates\/web.letsencrypt.ssl.template.yml"'
578 local dst=' - "templates\/web.letsencrypt.ssl.template.yml"'
579
580 sed -i -e "s/$src/$dst/w $changelog" $web_file
581 if [ -s $changelog ]
582 then
583 echo "letsencrypt.ssl.template.yml enabled"
584 else
585 update_ok="n"
586 echo "letsencrypt.ssl.template.yml NOT ENABLED -- was it on already?"
587 fi
588
589 if [ "$update_ok" == "y" ]
590 then
591 echo -e "\nConfiguration file at $config_file updated successfully!\n"
592 else
593 echo -e "\nUnfortunately, there was an error changing $config_file\n"
594 echo -d "This may happen if you have made unexpected changes."
595 exit 1
596 fi
597 }
598
599 ##
600 ## is our config file valid? Does it have the required fields set?
601 ##
602 validate_config() {
603
604 valid_config="y"
605
606 for x in DISCOURSE_SMTP_ADDRESS DISCOURSE_SMTP_USER_NAME DISCOURSE_SMTP_PASSWORD \
607 DISCOURSE_DEVELOPER_EMAILS DISCOURSE_HOSTNAME
608 do
609 read_config $x
610 local result=$read_config_result
611 read_default $x
612 local default=$read_default_result
613
614 if [ ! -z "$result" ]
615 then
616 if [[ "$config_line" = *"$default"* ]]
617 then
618 echo "$x left at incorrect default of $default"
619 valid_config="n"
620 fi
621 config_val=`echo $config_line | awk '{print $2}'`
622 if [ -z $config_val ]
623 then
624 echo "$x was not configured"
625 valid_config="n"
626 fi
627 else
628 echo "$x not present"
629 valid_config="n"
630 fi
631 done
632
633 if [ "$valid_config" != "y" ]; then
634 echo -e "\nSorry, these $web_file settings aren't valid -- can't continue!"
635 echo "If you have unusual requirements, edit $web_file and then: "
636 echo "./launcher bootstrap $app_name"
637 exit 1
638 fi
639 }
640
641
642 ##
643 ## template file names
644 ##
645
646 if [ "$1" == "2container" ]
647 then
648 app_name=web_only
649 data_name=data
650 web_template=samples/web_only.yml
651 data_template=samples/data.yml
652 web_file=containers/$app_name.yml
653 data_file=containers/$data_name.yml
654 else
655 app_name=app
656 data_name=app
657 web_template=samples/standalone.yml
658 data_template=""
659 web_file=containers/$app_name.yml
660 data_file=containers/$app_name.yml
661 fi
662 changelog=/tmp/changelog
663
664 ##
665 ## Check requirements before creating a copy of a config file we won't edit
666 ##
667 check_root
668 check_and_install_docker
669 check_disk_and_memory
670
671 if [ -a "$web_file" ]
672 then
673 echo "The configuration file $web_file already exists!"
674 echo
675 echo ". . . reconfiguring . . ."
676 echo
677 echo
678 DATE=`date +"%Y-%m-%d-%H%M%S"`
679 BACKUP=$app_name.yml.$DATE.bak
680 echo Saving old file as $BACKUP
681 cp $web_file containers/$BACKUP
682 echo "Stopping existing container in 5 seconds or Control-C to cancel."
683 sleep 5
684 ./launcher stop app
685 echo
686 else
687 check_ports
688 cp -v $web_template $web_file
689 if [ "$data_name" == "data" ]
690 then
691 echo "--------------------------------------------------"
692 echo "This two container setup is currently unsupported. Use at your own risk!"
693 echo "--------------------------------------------------"
694 DISCOURSE_DB_PASSWORD=`date +%s | sha256sum | base64 | head -c 20`
695
696 sed -i -e "s/DISCOURSE_DB_PASSWORD: SOME_SECRET/DISCOURSE_DB_PASSWORD: $DISCOURSE_DB_PASSWORD/w $changelog" $web_file
697 if [ -s $changelog ]
698 then
699 rm $changelog
700 else
701 echo "Problem changing DISCOURSE_DB_PASSWORD" in $web_file
702 fi
703
704 cp -v $data_template $data_file
705 quote=\'
706 sed -i -e "s/password ${quote}SOME_SECRET${quote}/password '$DISCOURSE_DB_PASSWORD'/w $changelog" $data_file
707 if [ -s $changelog ]
708 then
709 rm $changelog
710 else
711 echo "Problem changing DISCOURSE_DB_PASSWORD" in $data_file
712 fi
713 fi
714 fi
715
716 scale_ram_and_cpu
717 ask_user_for_config
718 validate_config
719
720 ##
721 ## if we reach this point without exiting, OK to proceed
722 ## rebuild won't fail if there's nothing to rebuild and does the restart
723 ##
724 echo "Updates successful. Rebuilding in 5 seconds."
725 sleep 5 # Just a chance to ^C in case they were too fast on the draw
726 if [ "$data_name" == "$app_name" ]
727 then
728 echo Building $app_name
729 ./launcher rebuild $app_name
730 else
731 echo Building $data_name now . . .
732 ./launcher rebuild $data_name
733 echo Building $app_name now . . .
734 ./launcher rebuild $app_name
735 fi