2 DIR
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5 if [ "$1" == "2container" ]
8 echo "2container argument is deprecated. Use --two-container"
12 while [ ${#} -gt 0 ]; do
24 --skip-connection-test)
25 SKIP_CONNECTION_TEST
="1"
26 echo "skipping connection test"
34 ## Make sure only root can run our script
37 if [[ $EUID -ne 0 ]]; then
38 echo "This script must be run as root. Please sudo or log in as root first." 1>&2
44 ## Check whether a connection to HOSTNAME ($1) on PORT ($2) is possible
49 VERIFY
=$
(date +%s | sha256sum | base64 |
head -c 20)
50 if ! [ -x "$(command -v nc)" ]; then
51 echo "In order to check the connection to $HOST:$PORT we need to open a socket using netcat."
52 echo However netcat is not installed on your system. You can
continue without this check
53 echo or abort the setup
, install netcat and try again.
55 read -p "Would you like to continue without this check? [yn] " yn
59 *) echo "Please answer y or n." ;;
63 echo -e "HTTP/1.1 200 OK\n\n $VERIFY" | nc
-w 4 -l -p $PORT >/dev
/null
2>&1 &
64 if curl
--proto =http
-s $HOST:$PORT --connect-timeout 3 |
grep $VERIFY >/dev
/null
2>&1; then
67 curl
--proto =http
-s localhost
:$PORT >/dev
/null
2>&1
76 if [ "$SKIP_CONNECTION_TEST" == 1 ]
78 echo "Setting EC to 2"
81 echo Checking your domain name . . .
82 connect_to_port
$HOST 443; ec
=$?
86 echo "Connection to $HOST succeeded."
89 echo "WARNING: Port 443 of computer does not appear to be accessible using hostname: $HOST."
90 if connect_to_port
$HOST 80; then
92 echo SUCCESS
: A connection to port
80 succeeds
!
93 echo This suggests that your DNS settings are correct
,
94 echo but something is keeping traffic to port
443 from getting to your server.
95 echo Check your networking configuration to see that connections to port
443 are allowed.
97 echo "WARNING: Connection to http://$HOST (port 80) also fails."
99 echo "This suggests that $HOST resolves to some IP address that does not reach this "
100 echo machine where you are installing discourse.
103 echo "The first thing to do is confirm that $HOST resolves to the IP address of this server."
104 echo You usually
do this
at the same place you purchased the domain.
106 echo If you are sure that the IP address resolves correctly
, it could be a firewall issue.
107 echo A web search
for \"open ports YOUR CLOUD SERVICE
\" might
help.
109 echo This tool is designed only
for the most standard installations. If you cannot resolve
110 echo the issue above
, you will need to edit containers
/app.yml yourself and
then type
112 echo .
/launcher rebuild app
117 echo "Skipping port check."
123 ## Do we have docker?
125 check_and_install_docker
() {
126 docker_path
=`which docker.io || which docker`
127 if [ -z $docker_path ]; then
128 read -p "Docker not installed. Enter to install from https://get.docker.com/ or Ctrl+C to exit"
129 curl https
://get.docker.com
/ | sh
131 docker_path
=`which docker.io || which docker`
132 if [ -z $docker_path ]; then
133 echo Docker
install failed. Quitting.
139 ## What are we running on
146 ## OS X available memory
149 echo `free -m | awk '/Mem:/ {print $2}'`
153 ## Linux available memory
155 check_linux_memory
() {
156 ## some VMs report just under 1GB of RAM, so
157 ## make an exception and allow those with more
159 mem
=`free -m --si | awk ' /Mem:/ {print $2}'`
160 if [ "$mem" -ge 990 -a "$mem" -lt 1000 ]; then
163 echo `free -g --si | awk ' /Mem:/ {print $2} '`
168 ## Do we have enough memory and disk space for Discourse?
170 check_disk_and_memory
() {
174 if [ "$os_type" == "Darwin" ]; then
175 avail_mem
=$
(check_osx_memory
)
177 avail_mem
=$
(check_linux_memory
)
180 if [ "$avail_mem" -lt 1 ]; then
181 echo "WARNING: Discourse requires 1GB RAM to run. This system does not appear"
182 echo "to have sufficient memory."
184 echo "Your site may not work properly, or future upgrades of Discourse may not"
185 echo "complete successfully."
189 if [ "$avail_mem" -le 2 ]; then
190 total_swap
=`free -g --si | awk ' /Swap:/ {print $2} '`
192 if [ "$total_swap" -lt 2 ]; then
193 echo "WARNING: Discourse requires at least 2GB of swap when running with 2GB of RAM"
194 echo "or less. This system does not appear to have sufficient swap space."
196 echo "Without sufficient swap space, your site may not work properly, and future"
197 echo "upgrades of Discourse may not complete successfully."
199 echo "Ctrl+C to exit or wait 5 seconds to have a 2GB swapfile created."
203 ## derived from https://meta.discourse.org/t/13880
205 install -o root
-g root
-m 0600 /dev
/null
/swapfile
206 fallocate
-l 2G
/swapfile
209 echo "/swapfile swap swap auto 0 0" |
tee -a /etc
/fstab
210 sysctl
-w vm.swappiness
=10
211 echo 'vm.swappiness = 10' > /etc
/sysctl.d
/30-discourse-swap.conf
213 total_swap
=`free -g --si | awk ' /Swap:/ {print $2} '`
214 if [ "$total_swap" -lt 2 ]; then
215 echo "Failed to create swap: are you root? Are you running on real hardware, or a fully virtualized server?"
222 free_disk
="$(df /var | tail -n 1 | awk '{print $4}')"
223 if [ "$free_disk" -lt 5000 ]; then
224 echo "WARNING: Discourse requires at least 5GB free disk space. This system"
225 echo "does not appear to have sufficient disk space."
227 echo "Insufficient disk space may result in problems running your site, and"
228 echo "may not even allow Discourse installation to complete successfully."
230 echo "Please free up some space, or expand your disk, before continuing."
232 echo "Run \`apt-get autoremove && apt-get autoclean\` to clean up unused"
233 echo "packages and \`./launcher cleanup\` to remove stale Docker containers."
241 ## If we have lots of RAM or lots of CPUs, bump up the defaults to scale better
243 scale_ram_and_cpu
() {
245 local changelog
=/tmp
/changelog.
$PPID
246 # grab info about total system ram and physical (NOT LOGICAL!) CPU cores
250 if [ "$os_type" == "Darwin" ]; then
251 avail_gb
=$
(check_osx_memory
)
252 avail_cores
=`sysctl hw.ncpu | awk '/hw.ncpu:/ {print $2}'`
254 avail_gb
=$
(check_linux_memory
)
255 avail_cores
=$
((`awk '/cpu cores/ {print $4;exit}' /proc/cpuinfo`*`sort /proc/cpuinfo | uniq | grep -c "physical id"`))
257 echo "Found ${avail_gb}GB of memory and $avail_cores physical CPU cores"
259 # db_shared_buffers: 128MB for 1GB, 256MB for 2GB, or 256MB * GB, max 4096MB
260 if [ "$avail_gb" -eq "1" ]
262 db_shared_buffers
=128
264 if [ "$avail_gb" -eq "2" ]
266 db_shared_buffers
=256
268 db_shared_buffers
=$
(( 256 * $avail_gb ))
271 db_shared_buffers
=$
(( db_shared_buffers
< 4096 ? db_shared_buffers
: 4096 ))
273 sed -i -e "s/^ #\?db_shared_buffers:.*/ db_shared_buffers: \"${db_shared_buffers}MB\"/w $changelog" $data_file
276 echo "setting db_shared_buffers = ${db_shared_buffers}MB"
280 # UNICORN_WORKERS: 2 * GB for 2GB or less, or 2 * CPU, max 8
281 if [ "$avail_gb" -le "2" ]
283 unicorn_workers
=$
(( 2 * $avail_gb ))
285 unicorn_workers
=$
(( 2 * $avail_cores ))
287 unicorn_workers
=$
(( unicorn_workers
< 8 ? unicorn_workers
: 8 ))
289 sed -i -e "s/^ #\?UNICORN_WORKERS:.*/ UNICORN_WORKERS: ${unicorn_workers}/w $changelog" $web_file
292 echo "setting UNICORN_WORKERS = ${unicorn_workers}"
296 echo $data_file memory parameters updated.
301 ## standard http / https ports must not be occupied
306 echo "Ports 80 and 443 are free for use"
311 ## check a port to see if it is already in use
315 local valid
=$
(lsof
-i:${1} |
grep "LISTEN")
317 if [ -n "$valid" ]; then
318 echo "Port ${1} appears to already be in use."
320 echo "This will show you what command is using port ${1}"
321 lsof
-i tcp
:${1} -s tcp
:listen
323 echo "If you are trying to run Discourse simultaneously with another web"
324 echo "server like Apache or nginx, you will need to bind to a different port"
326 echo "See https://meta.discourse.org/t/17247"
328 echo "If you are reconfiguring an already-configured Discourse, use "
330 echo "./launcher stop app"
332 echo "to stop Discourse before you reconfigure it and try again."
338 ## read a variable from the config file
341 config_line
=`egrep "^ #?$1:" $web_file`
342 read_config_result
=`echo $config_line | awk -F":" '{print $2}'`
343 read_config_result
=`echo $read_config_result | sed "s/^\([\"']\)\(.*\)\1\$/\2/g"`
347 config_line
=`egrep "^ #?$1:" samples/standalone.yml`
348 read_default_result
=`echo $config_line | awk -F":" '{print $2}'`
349 read_default_result
=`echo $read_config_result | sed "s/^\([\"']\)\(.*\)\1\$/\2/g"`
352 assert_maxmind_license_key
() {
353 if ! grep DISCOURSE_MAXMIND_LICENSE_KEY
$web_file >/dev
/null
2>&1
355 echo "Adding MAXMIND placeholder to $web_file"
356 sed -i '/^.*LETSENCRYPT_ACCOUNT_EMAIL.*/a \ \ #DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456' $web_file
358 if ! grep DISCOURSE_MAXMIND_LICENSE_KEY
$web_file >/dev
/null
2>&1
362 Adding DISCOURSE_MAXMIND_LICENSE_KEY to $web_file has failed! This
363 indicates either that your $web_file is very old or otherwise not
364 what the script expects or that there is a bug in this script. The
365 best solution for a novice is to delete $web_file and start over.
366 An expert might prefer to edit $web_file by hand.
369 read -p "Press return to continue or control-c to quit..."
373 assert_smtp_domain
() {
374 if ! grep DISCOURSE_SMTP_DOMAIN
$web_file >/dev
/null
2>&1
376 echo "Adding SMTP_DOMAIN placeholder to $web_file"
377 sed -i '/^.*DISCOURSE_SMTP_PASSWORD.*/a \ \ #DISCOURSE_SMTP_DOMAIN: discourse.example.com # (required by some providers)' $web_file
379 if ! grep DISCOURSE_SMTP_DOMAIN
$web_file >/dev
/null
2>&1
383 Adding DISCOURSE_SMTP_DOMAIN to $web_file has failed! This
384 indicates either that your $web_file is very old or otherwise not
385 what the script expects or that there is a bug in this script. The
386 best solution for a novice is to delete $web_file and start over.
387 An expert might prefer to edit $web_file by hand.
390 read -p "Press return to continue or control-c to quit..."
395 assert_notification_email
() {
396 if ! grep DISCOURSE_NOTIFICATION_EMAIL
$web_file >/dev
/null
2>&1
398 echo "Adding DISCOURSE_NOTIFICATION_EMAIL placeholder to $web_file"
399 sed -i '/^.*DISCOURSE_SMTP_PASSWORD.*/a \ \ #DISCOURSE_NOTIFICATION_EMAIL: nobody@discourse.example.com # (address to send notifications from)' $web_file
401 if ! grep DISCOURSE_NOTIFICATION_EMAIL
$web_file >/dev
/null
2>&1
405 Adding DISCOURSE_NOTIFICATION_EMAIL to $web_file has failed! This
406 indicates either that your $web_file is very old or otherwise not
407 what the script expects or that there is a bug in this script. The
408 best solution for a novice is to delete $web_file and start over.
409 An expert might prefer to edit $web_file by hand.
412 read -p "Press return to continue or control-c to quit..."
418 ## prompt user for typical Discourse config file values
420 ask_user_for_config
() {
422 # NOTE: Defaults now come from standalone.yml
424 read_config
"DISCOURSE_HOSTNAME"
425 hostname
=$read_config_result
426 local changelog
=/tmp
/changelog.
$PPID
427 read_config
"DISCOURSE_SMTP_ADDRESS"
428 local smtp_address
=$read_config_result
429 # NOTE: if there are spaces between emails, this breaks, but a human should be paying attention
430 read_config
"DISCOURSE_DEVELOPER_EMAILS"
431 local developer_emails
=$read_config_result
432 read_config
"DISCOURSE_SMTP_PASSWORD"
433 local smtp_password
=$read_config_result
434 read_config
"DISCOURSE_SMTP_PORT"
435 local smtp_port
=$read_config_result
436 read_config
"DISCOURSE_SMTP_USER_NAME"
437 local smtp_user_name
=$read_config_result
438 if [ "$smtp_password" = "pa$$word" ]
442 read_config
"DISCOURSE_NOTIFICATION_EMAIL"
443 local notification_email
=$read_config_result
444 read_config
"DISCOURSE_SMTP_DOMAIN"
445 local discourse_smtp_DOMAIN
=$read_config_result
447 read_config
"LETSENCRYPT_ACCOUNT_EMAIL"
448 local letsencrypt_account_email
=$read_config_result
449 if [ -z $letsencrypt_account_email ]
451 letsencrypt_account_email
="me@example.com"
453 if [ "$letsencrypt_account_email" = "me@example.com" ]
455 local letsencrypt_status
="ENTER to skip"
457 local letsencrypt_status
="Enter 'OFF' to disable."
460 read_config
"DISCOURSE_MAXMIND_LICENSE_KEY"
461 local maxmind_license_key
=$read_config_result
462 if [ -z $maxmind_license_key ]
464 maxmind_license_key
="1234567890123456"
466 if [ "$maxmind_license_key" == "1234567890123456" ]
468 local maxmind_status
="ENTER to continue without MAXMIND GeoLite2 geolocation database"
477 while [[ "$config_ok" == "n" ]]
479 if [ ! -z "$hostname" ]
481 read -p "Hostname for your Discourse? [$hostname]: " new_value
482 if [ ! -z "$new_value" ]
484 hostname
="$new_value"
486 if [[ $hostname =~ ^
[0-9]{1,3}\.
[0-9]{1,3}\.
[0-9]{1,3}\.
[0-9]{1,3}$
]]
489 echo "Discourse requires a DNS hostname. IP addresses are unsupported and will not work."
491 hostname
="discourse.example.com"
495 check_IP_match
$hostname
497 if [ ! -z "$developer_emails" ]
499 local email_valid
="n"
500 until [ "$email_valid" == "y" ]
502 read -p "Email address for admin account(s)? [$developer_emails]: " new_value
503 if [ ! -z "$new_value" ]
505 if [[ ${#new_value} -ge 7 && $new_value == *@
* ]]
507 developer_emails
="$new_value"
511 echo "[Error] Invalid email address"
520 if [ ! -z "$smtp_address" ]
522 read -p "SMTP server address? [$smtp_address]: " new_value
523 if [ ! -z "$new_value" ]
525 smtp_address
="$new_value"
529 if [ ! -z "$smtp_port" ]
531 read -p "SMTP port? [$smtp_port]: " new_value
532 if [ ! -z "$new_value" ]
534 smtp_port
="$new_value"
539 ## automatically set correct user name based on common mail providers unless it's been set
541 if [ "$smtp_user_name" == "user@example.com" ]
543 if [ "$smtp_address" == "smtp.sparkpostmail.com" ]
545 smtp_user_name
="SMTP_Injection"
547 if [ "$smtp_address" == "smtp.sendgrid.net" ]
549 smtp_user_name
="apikey"
551 if [ "$smtp_address" == "smtp.mailgun.org" ]
553 smtp_user_name
="postmaster@$hostname"
557 if [ ! -z "$smtp_user_name" ]
559 read -p "SMTP user name? [$smtp_user_name]: " new_value
560 if [ ! -z "$new_value" ]
562 smtp_user_name
="$new_value"
566 read -p "SMTP password? [$smtp_password]: " new_value
567 if [ ! -z "$new_value" ]
569 smtp_password
="$new_value"
572 if [[ "$notification_email" == "noreply@discourse.example.com"* ]]
574 notification_email
="noreply@$hostname"
577 read -p "notification email address? [$notification_email]: " new_value
578 if [ ! -z "$new_value" ]
580 notification_email
="$new_value"
583 # set smtp_domain default value here rather than use Rails default of localhost
584 smtp_domain
=$
(echo $notification_email |
sed -e "s/.*@//")
586 if [ ! -z $letsencrypt_account_email ]
588 read -p "Optional email address for Let's Encrypt warnings? ($letsencrypt_status) [$letsencrypt_account_email]: " new_value
589 if [ ! -z "$new_value" ]
591 letsencrypt_account_email
="$new_value"
592 if [ "${new_value,,}" = "off" ]
594 letsencrypt_status
="ENTER to skip"
596 letsencrypt_status
="Enter 'OFF' to disable."
601 read_config
"DISCOURSE_MAXMIND_LICENSE_KEY"
602 local maxmind_license_key
=$read_config_result
603 read -p "Optional Maxmind License key ($maxmind_status) [$maxmind_license_key]: " new_value
604 if [ ! -z "$new_value" ]
606 maxmind_license_key
="$new_value"
609 echo -e "\nDoes this look right?\n"
610 echo "Hostname : $hostname"
611 echo "Email : $developer_emails"
612 echo "SMTP address : $smtp_address"
613 echo "SMTP port : $smtp_port"
614 echo "SMTP username : $smtp_user_name"
615 echo "SMTP password : $smtp_password"
616 echo "Notification email: $notification_email"
618 if [ "$letsencrypt_status" == "Enter 'OFF' to disable." ]
620 echo "Let's Encrypt : $letsencrypt_account_email"
623 if [ "$maxmind_license_key" != "1234567890123456" ]
625 echo "Maxmind license: $maxmind_license_key"
627 echo "Maxmind license: (unset)"
631 read -p "ENTER to continue, 'n' to try again, Ctrl+C to exit: " config_ok
634 sed -i -e "s/^ DISCOURSE_HOSTNAME:.*/ DISCOURSE_HOSTNAME: $hostname/w $changelog" $web_file
639 echo "DISCOURSE_HOSTNAME change failed."
643 sed -i -e "s/^ DISCOURSE_DEVELOPER_EMAILS:.*/ DISCOURSE_DEVELOPER_EMAILS: \'$developer_emails\'/w $changelog" $web_file
648 echo "DISCOURSE_DEVELOPER_EMAILS change failed."
652 sed -i -e "s/^ DISCOURSE_SMTP_ADDRESS:.*/ DISCOURSE_SMTP_ADDRESS: $smtp_address/w $changelog" $web_file
657 echo "DISCOURSE_SMTP_ADDRESS change failed."
661 sed -i -e "s/^ #\?DISCOURSE_SMTP_PORT:.*/ DISCOURSE_SMTP_PORT: $smtp_port/w $changelog" $web_file
666 echo "DISCOURSE_SMTP_PORT change failed."
670 sed -i -e "s/^ #\?DISCOURSE_SMTP_USER_NAME:.*/ DISCOURSE_SMTP_USER_NAME: $smtp_user_name/w $changelog" $web_file
675 echo "DISCOURSE_SMTP_USER_NAME change failed."
679 sed -i -e "s/^ #\?DISCOURSE_NOTIFICATION_EMAIL:.*/ DISCOURSE_NOTIFICATION_EMAIL: $notification_email/w $changelog" $web_file
684 echo "DISCOURSE_NOTIFICATION_EMAIL change failed."
688 sed -i -e "s/^ #\?DISCOURSE_SMTP_DOMAIN:.*/ DISCOURSE_SMTP_DOMAIN: $smtp_domain/w $changelog" $web_file
693 echo "DISCOURSE_SMTP_DOMAIN change failed."
697 if [[ "$smtp_password" == *"\""* ]]
700 echo "========================================"
702 echo "Your password contains a quote (\")"
703 echo "Your SMTP Password will not be set. You will need to edit app.yml to enter it."
704 echo "========================================"
708 if [[ "$smtp_password" == *"$SLASH"* ]]
710 if [[ "$smtp_password" == *"$SLASH"* ]]
713 if [[ "$smtp_password" == *"$SLASH"* ]]
716 echo "========================================"
718 echo "Your password contains all available delimiters (+, |, and Q). "
719 echo "Your SMTP Password will not be set. You will need to edit app.yml to enter it."
720 echo "========================================"
726 if [[ "$SLASH" != "BROKEN" ]]
728 sed -i -e "s${SLASH}^ #\?DISCOURSE_SMTP_PASSWORD:.*${SLASH} DISCOURSE_SMTP_PASSWORD: \"${smtp_password}\"${SLASH}w $changelog" $web_file
734 echo "DISCOURSE_SMTP_PASSWORD change failed."
741 echo "Enabling Let's Encrypt"
743 sed -i -e "s/^ #\?LETSENCRYPT_ACCOUNT_EMAIL:.*/ LETSENCRYPT_ACCOUNT_EMAIL: $letsencrypt_account_email/w $changelog" $web_file
748 echo "LETSENCRYPT_ACCOUNT_EMAIL change failed."
751 local src
='^ #\?- "templates\/web.ssl.template.yml"'
752 local dst
=' \- "templates\/web.ssl.template.yml"'
753 sed -i -e "s/$src/$dst/w $changelog" $web_file
758 echo "web.ssl.template.yml enabled"
762 echo "web.ssl.template.yml NOT ENABLED--was it on already?"
764 local src
='^ #\?- "templates\/web.letsencrypt.ssl.template.yml"'
765 local dst
=' - "templates\/web.letsencrypt.ssl.template.yml"'
767 sed -i -e "s/$src/$dst/w $changelog" $web_file
770 echo "letsencrypt.ssl.template.yml enabled"
773 echo "letsencrypt.ssl.template.yml NOT ENABLED -- was it on already?"
777 if [ $maxmind_license_key != "1234567890123456" ]
779 sed -i -e "s/^.*DISCOURSE_MAXMIND_LICENSE_KEY:.*/ DISCOURSE_MAXMIND_LICENSE_KEY: $maxmind_license_key/w $changelog" $web_file
784 echo "DISCOURSE_MAXMIND_LICENSE_KEY change failed."
789 if [ "$update_ok" == "y" ]
791 echo -e "\nConfiguration file at $web_file updated successfully!\n"
793 echo -e "\nUnfortunately, there was an error changing $web_file\n"
794 echo -e "This may happen if you have made unexpected changes."
800 ## is our config file valid? Does it have the required fields set?
806 for x
in DISCOURSE_SMTP_ADDRESS DISCOURSE_SMTP_USER_NAME DISCOURSE_SMTP_PASSWORD \
807 DISCOURSE_DEVELOPER_EMAILS DISCOURSE_HOSTNAME
810 local result
=$read_config_result
812 local default
=$read_default_result
814 if [ ! -z "$result" ]
816 if [[ "$config_line" = *"$default"* ]]
818 echo "$x left at incorrect default of $default"
821 config_val
=`echo $config_line | awk '{print $2}'`
822 if [ -z $config_val ]
824 echo "$x was not configured"
828 echo "$x not present"
833 if [ "$valid_config" != "y" ]; then
834 echo -e "\nSorry, these $web_file settings aren't valid -- can't continue!"
835 echo "If you have unusual requirements, edit $web_file and then: "
836 echo "./launcher bootstrap $app_name"
843 ## template file names
846 if [ "$TWO_CONTAINER" ] ||
[ -f containers
/web_only.yml
]
850 web_template
=samples
/web_only.yml
851 data_template
=samples
/data.yml
852 web_file
=containers
/$app_name.yml
853 data_file
=containers
/$data_name.yml
857 web_template
=samples
/standalone.yml
859 web_file
=containers
/$app_name.yml
860 data_file
=containers
/$app_name.yml
862 changelog
=/tmp
/changelog
865 ## Check requirements before creating a copy of a config file we won't edit
868 check_and_install_docker
869 check_disk_and_memory
871 if [ -a "$web_file" ]
873 echo "The configuration file $web_file already exists!"
875 echo ". . . reconfiguring . . ."
878 DATE
=`date +"%Y-%m-%d-%H%M%S"`
879 BACKUP
=$app_name.yml.
$DATE.bak
880 echo Saving old
file as
$BACKUP
881 cp $web_file containers
/$BACKUP
882 if [ "$DEBUG" != "1" ]
884 echo "Stopping existing container in 5 seconds or Control-C to cancel."
887 echo "DEBUG MODE ON. Not stopping the container."
889 .
/launcher stop
$app_name
890 assert_maxmind_license_key
891 assert_notification_email
895 if [ "$SKIP_CONNECTION_TEST" != 1 ]
899 cp -v $web_template $web_file
900 if [ "$data_name" == "data" ]
902 echo "--------------------------------------------------"
903 echo "This two container setup is currently unsupported. Use at your own risk!"
904 echo "--------------------------------------------------"
905 DISCOURSE_DB_PASSWORD
=`date +%s | sha256sum | base64 | head -c 20`
907 sed -i -e "s/DISCOURSE_DB_PASSWORD: SOME_SECRET/DISCOURSE_DB_PASSWORD: $DISCOURSE_DB_PASSWORD/w $changelog" $web_file
912 echo "Problem changing DISCOURSE_DB_PASSWORD" in $web_file
915 cp -v $data_template $data_file
917 sed -i -e "s/password ${quote}SOME_SECRET${quote}/password '$DISCOURSE_DB_PASSWORD'/w $changelog" $data_file
922 echo "Problem changing DISCOURSE_DB_PASSWORD" in $data_file
932 ## if we reach this point without exiting, OK to proceed
933 ## rebuild won't fail if there's nothing to rebuild and does the restart
935 if [ "$SKIP_REBUILD" ]
937 echo "Updates successful. --skip-rebuild requested. Exiting."
941 echo "Updates successful. Rebuilding in 5 seconds."
942 sleep 5 # Just a chance to ^C in case they were too fast on the draw
944 if [ "$data_name" == "$app_name" ]
946 echo Building
$app_name
947 .
/launcher rebuild
$app_name
949 echo Building
$data_name now . . .
950 .
/launcher rebuild
$data_name
951 echo Building
$app_name now . . .
952 .
/launcher rebuild
$app_name