echo "See: https://meta.discourse.org/t/docker-error-on-bootstrap/13657/18?u=sam"
exit 1
fi
+
+ # 6. sufficient available resources
+ # 6a. Memory
+ #
+ resources="ok"
+ avail_mem="$(LANG=C free -m | grep '^Mem:' | awk '{print $2}')"
+ if [ "$avail_mem" -lt 900 ]; then
+ resources="insufficient"
+ echo "WARNING: You do not appear to have sufficient memory to run Discourse."
+ echo
+ echo "Your system may not work properly, or future upgrades of Discourse may"
+ echo "not complete successfully."
+ echo
+ echo "See https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#create-new-cloud-server"
+ elif [ "$avail_mem" -lt 1800 ]; then
+ total_swap="$(LANG=C free -m | grep ^Swap: | awk '{print $2}')"
+ if [ "$total_swap" -lt 1000 ]; then
+ resources="insufficient"
+ echo "WARNING: You must have at least 1GB of swap when running with less"
+ echo "than 2GB of RAM."
+ echo
+ echo "Your system may not work properly, or future upgrades of Discourse may"
+ echo "not complete successfully."
+ echo
+ echo "See https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#set-up-swap-if-needed"
+ fi
+ fi
+
+ # 6b. Disk space
+ free_disk="$(df /var | tail -n 1 | awk '{print $4}')"
+ if [ "$free_disk" -lt 5000 ]; then
+ resources="insufficient"
+ echo "WARNING: You must have at least 5GB of *free* disk space to run Discourse."
+ echo
+ echo "Insufficient disk space may result in problems running your site, and may"
+ echo "not even allow Discourse installation to complete successfully."
+ echo
+ echo "Please free up some space, or expand your disk, before continuing."
+ exit 1
+ fi
+
+ if [ -t 0 ] && [ "$resources" != "ok" ]; then
+ echo
+ read -p "Press ENTER to continue, or Ctrl-C to exit and give your system more resources"
+ fi
}
if [ "$opt" != "--skip-prereqs" ] ; then
install_docker() {
- echo "Docker is not installed, make sure you are running on the 3.8 kernel"
- echo "The best supported Docker release is Ubuntu 12.04.03 for it run the following"
+ echo "Docker is not installed, you will need to install Docker in order to run Discourse"
+ echo "Please visit https://docs.docker.com/installation/ for instructions on how to do this for your system"
echo
- echo "sudo apt-get update"
- echo "sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring"
- echo "sudo reboot"
+ echo "If you are running Ubuntu Trusty or later, you can try the following:"
echo
- echo "sudo sh -c \"wget -qO- https://get.docker.io/gpg | apt-key add -\""
- echo "sudo sh -c \"echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list\""
+ echo "sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D"
+ echo "sudo sh -c \"echo deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -sc) main > /etc/apt/sources.list.d/docker.list\""
echo "sudo apt-get update"
- echo "sudo apt-get install lxc-docker"
+ echo "sudo apt-get install docker-engine"
exit 1
}
ports=`cat $config_file | $docker_path run $user_args --rm -i -a stdout -a stdin $image ruby -e \
"require 'yaml'; puts YAML.load(STDIN.readlines.join)['expose'].map{|p| '-p ' << p.to_s << ' '}.join"`
+ docker_args=`cat $config_file | $docker_path run $user_args --rm -i -a stdout -a stdin $image ruby -e \
+ "require 'yaml'; puts YAML.load(STDIN.readlines.join)['docker_args']"`
+
set_template_info
set_volumes
set_links
hostname=`hostname`
set -x
$docker_path run $user_args $links $attach_on_run $restart_policy "${env[@]}" -h "$hostname-$config" \
- -e DOCKER_HOST_IP=$docker_ip --name $config -t $ports $volumes $local_discourse/$config /sbin/boot
+ -e DOCKER_HOST_IP=$docker_ip --name $config -t $ports $volumes $docker_args $local_discourse/$config \
+ /sbin/boot
)
exit 0