Merge pull request #2419 from ebeigarts/centos

Support for CentOS 7
This commit is contained in:
Jose Diaz-Gonzalez
2016-10-29 21:14:14 -06:00
committed by GitHub
15 changed files with 369 additions and 33 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
*.deb
*.rpm
.DS_Store
.ruby-version
.vagrant

View File

@@ -55,7 +55,7 @@ doesn't already include that problem or suggestion before submitting an issue.
If you find a match, add a quick "+1" or "I have this problem too." Doing this
helps prioritize the most common problems and requests.
When reporting issues, please include your host OS (Ubuntu 14.04, Fedora 19,
When reporting issues, please include your host OS (Ubuntu 14.04, CentOS 7,
etc). Please include:
* The output of `uname -a`.

View File

@@ -27,6 +27,7 @@ endif
include tests.mk
include deb.mk
include rpm.mk
include arch.mk
all:
@@ -34,13 +35,17 @@ all:
install: dependencies version copyfiles plugin-dependencies plugins
release: deb-all package_cloud packer
release: deb-all rpm-all package_cloud packer
package_cloud:
package_cloud push dokku/dokku/ubuntu/trusty herokuish*.deb
package_cloud push dokku/dokku/ubuntu/trusty sshcommand*.deb
package_cloud push dokku/dokku/ubuntu/trusty plugn*.deb
package_cloud push dokku/dokku/ubuntu/trusty dokku*.deb
package_cloud push dokku/dokku/el/7 herokuish*.rpm
package_cloud push dokku/dokku/el/7 sshcommand*.rpm
package_cloud push dokku/dokku/el/7 plugn*.rpm
package_cloud push dokku/dokku/el/7 dokku*.rpm
packer:
packer build contrib/packer.json

11
Vagrantfile vendored
View File

@@ -76,13 +76,22 @@ Vagrant::configure("2") do |config|
vm.vm.provision :shell, :inline => "cd /root/dokku && make install-from-deb"
end
config.vm.define "dokku-rpm", autostart: false do |vm|
vm.vm.box = "centos/7"
vm.vm.synced_folder File.dirname(__FILE__), "/root/dokku"
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "cd /root/dokku && bash bootstrap.sh"
end
config.vm.define "build", autostart: false do |vm|
vm.vm.synced_folder File.dirname(__FILE__), "/root/dokku"
vm.vm.network :forwarded_port, guest: 80, host: FORWARDED_PORT
vm.vm.hostname = "#{DOKKU_DOMAIN}"
vm.vm.network :private_network, ip: DOKKU_IP
vm.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive && apt-get update > /dev/null && apt-get -qq -y install git > /dev/null && cd /root/dokku && #{make_cmd}"
vm.vm.provision :shell, :inline => "export IS_RELEASE=true && cd /root/dokku && make deb-all"
vm.vm.provision :shell, :inline => "export IS_RELEASE=true && cd /root/dokku && make deb-all rpm-all"
end
config.vm.define "build-arch", autostart: false do |vm|

View File

@@ -14,10 +14,6 @@ set -eo pipefail; [[ $TRACE ]] && set -x
ensure-environment() {
local FREE_MEMORY
echo "Preparing to install $DOKKU_TAG from $DOKKU_REPO..."
if ! command -v apt-get &>/dev/null; then
echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
exit 1
fi
hostname -f > /dev/null 2>&1 || {
echo "This installation script requires that you have a hostname set for the instance. Please set a hostname for 127.0.0.1 in your /etc/hosts"
@@ -33,10 +29,15 @@ ensure-environment() {
install-requirements() {
echo "--> Ensuring we have the proper dependencies"
apt-get update -qq > /dev/null
if [[ $(lsb_release -sr) == "12.04" ]]; then
apt-get -qq -y install python-software-properties
fi
case "$DOKKU_DISTRO" in
debian|ubuntu)
apt-get update -qq > /dev/null
if [[ "$DOKKU_DISTRO_VERSION" == "12.04" ]]; then
apt-get -qq -y install python-software-properties
fi
;;
esac
}
install-dokku() {
@@ -68,9 +69,14 @@ install-dokku() {
fi
}
install-dokku-from-source() {
local DOKKU_CHECKOUT="$1"
if ! command -v apt-get &>/dev/null; then
echo "This installation script requires apt-get. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
exit 1
fi
apt-get -qq -y install git make software-properties-common
cd /root
if [[ ! -d /root/dokku ]]; then
@@ -84,6 +90,21 @@ install-dokku-from-source() {
}
install-dokku-from-package() {
case "$DOKKU_DISTRO" in
debian|ubuntu)
install-dokku-from-deb-package "$@"
;;
centos)
install-dokku-from-rpm-package "$@"
;;
*)
echo "Unsupported Linux distribution. For manual installation instructions, consult http://dokku.viewdocs.io/dokku/advanced-installation/"
exit 1
;;
esac
}
install-dokku-from-deb-package() {
local DOKKU_CHECKOUT="$1"
local NO_INSTALL_RECOMMENDS=${DOKKU_NO_INSTALL_RECOMMENDS:=""}
@@ -124,7 +145,39 @@ install-dokku-from-package() {
fi
}
install-dokku-from-rpm-package() {
local DOKKU_CHECKOUT="$1"
if [[ "$DOKKU_DISTRO_VERSION" != "7" ]]; then
echo "Only CentOS version 7 is supported."
exit 1
fi
echo "--> Installing docker"
curl -fsSL https://get.docker.com/ | sh
echo "--> Installing epel for nginx packages to be available"
yum install -y epel-release
echo "--> Installing herokuish and dokku"
curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | bash
if [[ -n $DOKKU_CHECKOUT ]]; then
yum -y install herokuish "dokku-$DOKKU_CHECKOUT"
else
yum -y install herokuish dokku
fi
echo "--> Starting nginx"
systemctl start nginx
}
main() {
export DOKKU_DISTRO DOKKU_DISTRO_VERSION
# shellcheck disable=SC1091
DOKKU_DISTRO=$(. /etc/os-release && echo "$ID")
# shellcheck disable=SC1091
DOKKU_DISTRO_VERSION=$(. /etc/os-release && echo "$VERSION_ID")
export DEBIAN_FRONTEND=noninteractive
export DOKKU_REPO=${DOKKU_REPO:-"https://github.com/dokku/dokku.git"}

View File

@@ -20,7 +20,7 @@ To propose a release, the following tasks need to be performed:
- The versioned links should be updated or added to the `docs/assets/versions.json` file.
- A list of changes must be made in the `HISTORY.md`.
- A tag must be created locally with your release version
- Debian packages *must* be created via `vagrant up build`
- Debian and RPM packages *must* be created via `vagrant up build`
- The packages should be uploaded to packagecloud.io
- All changes are pushed to master and the tag should be turned into a release which will contain the changelog.
- ArchLinux package description *must* be updated via `vagrant up build-arch` (needs to be done after the tag is pushed to GitHub, because it is based on that)
@@ -37,9 +37,9 @@ git tag v0.9.9
At the moment, tags need not be signed, though that may change in the future.
## Debian Packages
## Debian and RPM packages
The `build` target in the Dokku `Vagrantfile` creates debian packages for Dokku at a point in time. The version will be based upon the latest local tag - you may create your own, internal tags/releases if that is so desired.
The `build` target in the Dokku `Vagrantfile` creates debian and rpm packages for Dokku at a point in time. The version will be based upon the latest local tag - you may create your own, internal tags/releases if that is so desired.
Debian package information is held in the `debian` directory of the Dokku project.
@@ -51,6 +51,7 @@ git tag v0.9.9
vagrant up build
export PACKAGECLOUD_TOKEN=SOME_TOKEN
package_cloud push dokku/dokku/ubuntu/trusty dokku_0.9.9_amd64.deb
package_cloud push dokku/dokku/el/7 dokku-0.9.9-1.x86_64.rpm
```
If new versions of other packages were created, these should also be pushed at this time.

View File

@@ -0,0 +1,18 @@
# RPM Package Installation Notes
> New as of 0.8.0
Dokku defaults to being installed via RPM package on CentOS 7. While certain hosts may require extra work to get running, you may optionally wish to automate the installation of Dokku without the use of our `bootstrap.sh` bash script. The following are the steps run by said script:
```shell
# install docker
curl -fsSL https://get.docker.com/ | sh
# install epel for nginx packages to be available
sudo yum install -y epel-release
# install dokku
curl -s https://packagecloud.io/install/repositories/dokku/dokku/script.rpm.sh | sudo bash
sudo yum install -y herokuish dokku
sudo dokku plugin:install-dependencies --core
```

View File

@@ -48,6 +48,7 @@ For various reasons, certain hosting providers may have other steps that should
As well, you may wish to customize your installation in some other fashion. or experiment with vagrant. The guides below should get you started:
- [Debian Package Installation Notes](/dokku/getting-started/install/debian/)
- [RPM Package Installation Notes](/dokku/getting-started/install/rpm/)
- [Vagrant Installation Notes](/dokku/getting-started/install/vagrant/)
- [Advanced Install Customization](/dokku/getting-started/advanced-installation/)

14
dokku
View File

@@ -7,17 +7,9 @@ export DOKKU_ROOT=${DOKKU_ROOT:=~dokku}
[[ -d $DOKKU_ROOT/.dokkurc ]] && for f in $DOKKU_ROOT/.dokkurc/*; do source "$f"; done
[[ $DOKKU_TRACE ]] && set -x
case "$(lsb_release -si)" in
Arch)
export DOKKU_DISTRO=${DOKKU_DISTRO:="arch"}
;;
Debian)
export DOKKU_DISTRO=${DOKKU_DISTRO:="debian"}
;;
*)
export DOKKU_DISTRO=${DOKKU_DISTRO:="ubuntu"}
;;
esac
export DOKKU_DISTRO
# shellcheck disable=SC1091
DOKKU_DISTRO=$(. /etc/os-release && echo "$ID")
export DOKKU_IMAGE=${DOKKU_IMAGE:="gliderlabs/herokuish"}
export DOKKU_LIB_ROOT=${DOKKU_LIB_PATH:="/var/lib/dokku"}

View File

@@ -12,7 +12,7 @@ flag_rsyslog_needs_restart=n
# exits gracefully if the path already exists
mkdir -m 775 -p "$DOKKU_LOGS_DIR"
case "$DOKKU_DISTRO" in
arch|debian)
arch|debian|centos)
chgrp dokku "$DOKKU_LOGS_DIR"
;;
*)
@@ -23,7 +23,7 @@ esac
if [[ ! -f "$DOKKU_EVENTS_LOGFILE" ]]; then
touch "$DOKKU_EVENTS_LOGFILE"
case "$DOKKU_DISTRO" in
arch|debian)
arch|debian|centos)
chgrp dokku "$DOKKU_EVENTS_LOGFILE"
;;
*)

View File

@@ -39,9 +39,9 @@ restart_nginx() {
sudo /sbin/service nginx reload > /dev/null
;;
arch)
arch|centos)
sudo /usr/bin/systemctl reload nginx
;;
;;
esac
}

View File

@@ -17,6 +17,11 @@ case "$DOKKU_DISTRO" in
arch)
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload nginx, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
;;
centos)
echo "%dokku ALL=(ALL) NOPASSWD:/usr/bin/systemctl reload nginx, /usr/sbin/nginx -t" > /etc/sudoers.d/dokku-nginx
echo "Defaults:dokku !requiretty" >> /etc/sudoers.d/dokku-nginx
;;
esac
chmod 0440 /etc/sudoers.d/dokku-nginx
@@ -66,10 +71,8 @@ case "$DOKKU_DISTRO" in
"$NGINX_INIT" nginx start || "$NGINX_INIT" nginx reload
;;
arch)
arch|centos)
NGINX_INIT="/usr/bin/systemctl"
"$NGINX_INIT" start nginx || "$NGINX_INIT" reload nginx
;;
esac

170
rpm.mk Normal file
View File

@@ -0,0 +1,170 @@
RPM_ARCHITECTURE = x86_64
HEROKUISH_RPM_PACKAGE_NAME = herokuish-$(HEROKUISH_VERSION)-1.$(RPM_ARCHITECTURE).rpm
PLUGN_RPM_PACKAGE_NAME = plugn-$(PLUGN_VERSION)-1.$(RPM_ARCHITECTURE).rpm
SSHCOMMAND_RPM_PACKAGE_NAME = sshcommand-$(SSHCOMMAND_VERSION)-1.$(RPM_ARCHITECTURE).rpm
SIGIL_RPM_PACKAGE_NAME = gliderlabs-sigil-$(SIGIL_VERSION)-1.$(RPM_ARCHITECTURE).rpm
.PHONY: rpm-all
rpm-all: rpm-setup rpm-herokuish rpm-dokku rpm-plugn rpm-sshcommand rpm-sigil
mv /tmp/*.rpm .
@echo "Done"
rpm-setup:
@echo "-> Installing rpm build requirements"
@sudo apt-get update -qq > /dev/null
@sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -qq -y gcc git build-essential wget ruby-dev ruby1.9.1 rpm > /dev/null 2>&1
@command -v fpm > /dev/null || sudo gem install fpm --no-ri --no-rdoc
@ssh -o StrictHostKeyChecking=no git@github.com || true
rpm-herokuish:
rm -rf /tmp/tmp /tmp/build $(HEROKUISH_RPM_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build
@echo "-> Cloning repository"
git clone -q "https://github.com/$(HEROKUISH_REPO_NAME).git" \
--branch "v$(HEROKUISH_VERSION)" /tmp/tmp/herokuish > /dev/null
rm -rf /tmp/tmp/herokuish/.git /tmp/tmp/herokuish/.gitignore
@echo "-> Copying files into place"
mkdir -p "/tmp/build/var/lib"
cp -rf /tmp/tmp/herokuish /tmp/build/var/lib/herokuish
@echo "-> Creating $(HEROKUISH_RPM_PACKAGE_NAME)"
sudo fpm -t rpm -s dir -C /tmp/build -n herokuish \
-v $(HEROKUISH_VERSION) \
-a $(RPM_ARCHITECTURE) \
-p $(HEROKUISH_RPM_PACKAGE_NAME) \
--depends 'docker-engine >= 1.9.1' \
--depends 'sudo' \
--after-install rpm/herokuish.postinst \
--url "https://github.com/$(HEROKUISH_REPO_NAME)" \
--description $(HEROKUISH_DESCRIPTION) \
--license 'MIT License' \
.
mv *.rpm /tmp
rpm-dokku:
rm -rf /tmp/tmp /tmp/build dokku_*_$(RPM_ARCHITECTURE).rpm
mkdir -p /tmp/tmp /tmp/build
mkdir -p /tmp/build/usr/bin
mkdir -p /tmp/build/usr/share/doc/dokku
mkdir -p /tmp/build/usr/share/dokku/contrib
mkdir -p /tmp/build/usr/share/lintian/overrides
mkdir -p /tmp/build/usr/share/man/man1
mkdir -p /tmp/build/var/lib/dokku/core-plugins/available
cp dokku /tmp/build/usr/bin
cp LICENSE /tmp/build/usr/share/doc/dokku/copyright
find . -name ".DS_Store" -depth -exec rm {} \;
cp -r plugins/* /tmp/build/var/lib/dokku/core-plugins/available
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/core-plugins/available/$$plugin/.core; done
$(MAKE) help2man
$(MAKE) addman
cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/share/man/man1/dokku.1
gzip -9 /tmp/build/usr/share/man/man1/dokku.1
cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib
git describe --tags > /tmp/build/var/lib/dokku/VERSION
cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION
ifneq (,$(findstring false,$(IS_RELEASE)))
sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak
endif
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
@echo "-> Creating rpm package"
VERSION=$$(cat /tmp/build/var/lib/dokku/STABLE_VERSION); \
sudo fpm -t rpm -s dir -C /tmp/build -n dokku \
-v "$$VERSION" \
-a $(RPM_ARCHITECTURE) \
-p "dokku-$$VERSION-1.x86_64.rpm" \
--depends 'git' \
--depends 'make' \
--depends 'curl' \
--depends 'gcc' \
--depends 'man-db' \
--depends 'sshcommand' \
--depends 'gliderlabs-sigil' \
--depends 'docker-engine >= 1.9.1' \
--depends 'bind-utils' \
--depends 'nginx' \
--depends 'plugn' \
--depends 'sudo' \
--depends 'python' \
--depends 'nc' \
--after-install rpm/dokku.postinst \
--url "https://github.com/$(DOKKU_REPO_NAME)" \
--description $(DOKKU_DESCRIPTION) \
--license 'MIT License' \
.
mv *.rpm /tmp
rpm-plugn:
rm -rf /tmp/tmp /tmp/build $(PLUGN_RPM_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
@echo "-> Downloading package"
wget -q -O /tmp/tmp/plugn-$(PLUGN_VERSION).tgz $(PLUGN_URL)
cd /tmp/tmp/ && tar zxf /tmp/tmp/plugn-$(PLUGN_VERSION).tgz
@echo "-> Copying files into place"
cp /tmp/tmp/plugn /tmp/build/usr/bin/plugn && chmod +x /tmp/build/usr/bin/plugn
@echo "-> Creating $(PLUGN_RPM_PACKAGE_NAME)"
sudo fpm -t rpm -s dir -C /tmp/build -n plugn \
--version $(PLUGN_VERSION) \
-a $(RPM_ARCHITECTURE) \
--package $(PLUGN_RPM_PACKAGE_NAME) \
--url "https://github.com/$(PLUGN_REPO_NAME)" \
--category utils \
--description "$$PLUGN_DESCRIPTION" \
--license 'MIT License' \
.
mv *.rpm /tmp
rpm-sshcommand:
rm -rf /tmp/tmp /tmp/build $(SSHCOMMAND_RPM_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
@echo "-> Downloading package"
wget -q -O /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) $(SSHCOMMAND_URL)
@echo "-> Copying files into place"
mkdir -p "/tmp/build/usr/bin"
cp /tmp/tmp/sshcommand-$(SSHCOMMAND_VERSION) /tmp/build/usr/bin/sshcommand
chmod +x /tmp/build/usr/bin/sshcommand
@echo "-> Creating $(SSHCOMMAND_RPM_PACKAGE_NAME)"
sudo fpm -t rpm -s dir -C /tmp/build -n sshcommand \
--version $(SSHCOMMAND_VERSION) \
-a $(RPM_ARCHITECTURE) \
--package $(SSHCOMMAND_RPM_PACKAGE_NAME) \
--url "https://github.com/$(SSHCOMMAND_REPO_NAME)" \
--category admin \
--description "$$SSHCOMMAND_DESCRIPTION" \
--license 'MIT License' \
.
mv *.rpm /tmp
rpm-sigil:
rm -rf /tmp/tmp /tmp/build $(SIGIL_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
@echo "-> Downloading package"
wget -q -O /tmp/tmp/sigil-$(SIGIL_VERSION).tgz $(SIGIL_URL)
cd /tmp/tmp/ && tar zxf /tmp/tmp/sigil-$(SIGIL_VERSION).tgz
@echo "-> Copying files into place"
cp /tmp/tmp/sigil /tmp/build/usr/bin/sigil && chmod +x /tmp/build/usr/bin/sigil
@echo "-> Creating $(SIGIL_RPM_PACKAGE_NAME)"
sudo fpm -t rpm -s dir -C /tmp/build -n gliderlabs-sigil \
--version $(SIGIL_VERSION) \
-a $(RPM_ARCHITECTURE) \
--package $(SIGIL_RPM_PACKAGE_NAME) \
--url "https://github.com/$(SIGIL_REPO_NAME)" \
--category utils \
--description "$$SIGIL_DESCRIPTION" \
--license 'MIT License' \
.
mv *.rpm /tmp

63
rpm/dokku.postinst Normal file
View File

@@ -0,0 +1,63 @@
#!/usr/bin/env bash
set +o posix # rpm uses /bin/sh that forces bash in posix mode
set -eo pipefail; [[ $TRACE ]] && set -x
setup-user() {
echo "Setting up dokku user"
getent passwd dokku >/dev/null || useradd -m -s /bin/bash dokku
mkdir -p "$DOKKU_ROOT/.ssh"
touch "$DOKKU_ROOT/.ssh/authorized_keys"
chown -R dokku:dokku "$DOKKU_ROOT/.ssh"
usermod -aG docker dokku
}
setup-storage() {
echo "Setting up storage directories"
mkdir -p "${DOKKU_LIB_ROOT}/data" "${DOKKU_LIB_ROOT}/data/storage"
chown dokku:dokku -R "${DOKKU_LIB_ROOT}/data"
}
setup-plugins() {
echo "Setting up plugin directories"
# should be replaced by `plugn init`
mkdir -p "${DOKKU_LIB_ROOT}/core-plugins/available" "${DOKKU_LIB_ROOT}/plugins/available"
mkdir -p "${DOKKU_LIB_ROOT}/core-plugins/enabled" "${DOKKU_LIB_ROOT}/plugins/enabled"
touch "${DOKKU_LIB_ROOT}/core-plugins/config.toml" "${DOKKU_LIB_ROOT}/plugins/config.toml"
echo "Enabling all core plugins"
find "${DOKKU_LIB_ROOT}/core-plugins/available" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do
if [ ! -d "${DOKKU_LIB_ROOT}/plugins/available/$plugin" ]; then
ln -s "${DOKKU_LIB_ROOT}/core-plugins/available/$plugin" "${DOKKU_LIB_ROOT}/plugins/available/$plugin"
PLUGIN_PATH="${DOKKU_LIB_ROOT}/core-plugins" plugn enable "$plugin"
PLUGIN_PATH="${DOKKU_LIB_ROOT}/plugins" plugn enable "$plugin"
fi
done
find -L "${DOKKU_LIB_ROOT}" -type l -delete
chown dokku:dokku -R "${DOKKU_LIB_ROOT}/plugins" "${DOKKU_LIB_ROOT}/core-plugins"
echo "Install all core plugins"
dokku plugin:install --core
}
setup-sshcommand() {
echo "Ensure proper sshcommand path"
echo '/usr/bin/dokku' > "${DOKKU_ROOT}/.sshcommand"
}
setup-version() {
rm -f "${DOKKU_ROOT}/VERSION"
cp "${DOKKU_LIB_ROOT}/STABLE_VERSION" "${DOKKU_ROOT}/VERSION"
}
main() {
readonly DOKKU_ROOT="${DOKKU_ROOT:-/home/dokku}"
readonly DOKKU_LIB_ROOT="${DOKKU_LIB_PATH:-/var/lib/dokku}"
setup-user
setup-storage
setup-plugins
setup-sshcommand
setup-version
}
main

20
rpm/herokuish.postinst Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set +o posix # rpm uses /bin/sh that forces bash in posix mode
main() {
echo 'Starting docker'
systemctl start docker
sleep 5
count=$(sudo docker images | grep -c gliderlabs/herokuish)
if [ "$count" -ne 0 ]; then
echo 'Removing old herokuish image'
sudo docker rmi gliderlabs/herokuish
fi
echo 'Importing herokuish into docker (around 5 minutes)'
sudo docker build -t gliderlabs/herokuish /var/lib/herokuish 1> /dev/null
}
main