Skip to content

Commit

Permalink
Add installation check to install script
Browse files Browse the repository at this point in the history
  • Loading branch information
cywio committed Jan 16, 2022
1 parent accb783 commit 69a4351
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,26 @@ if ! [ -n "$REPO_URL" ]; then
exit 1
fi

echo "-----> Server IP: ${HOST_IP}"
echo "-----> Current User: ${CURRENT_USER}"
echo "-----> Latest Dokku Version: ${CURRENT_VERSION}"

# Check if dokku exists and is root user
if ! which dokku >/dev/null ; then
if [ $CURRENT_USER = "root" ] ; then
echo "-----> Server IP: ${HOST_IP}"
echo "-----> Current User: ${CURRENT_USER}"
echo "-----> Latest Dokku Version: ${CURRENT_VERSION}"

# Install Dokku
echo '-----> Installing Dokku'
wget https://raw.githubusercontent.com/dokku/dokku/$CURRENT_VERSION/bootstrap.sh
sudo DOKKU_TAG=$CURRENT_VERSION bash bootstrap.sh
cat ~/.ssh/authorized_keys | dokku ssh-keys:add admin

# Verify dokku was installed correctly
if which dokku >/dev/null ; then
echo "-----> Dokku installed successfully"
else
echo "!!!!!! Something went wrong with the Dokku installation, please review any errors and try again."
exit 1
fi
else
echo '!!!!!! You must run this as root'
exit 1
Expand Down

0 comments on commit 69a4351

Please sign in to comment.