Skip to content

Instantly share code, notes, and snippets.

@sigwo
Last active August 3, 2018 03:11
Show Gist options
  • Save sigwo/1752ffe23ba686e741c28a8017be9c7e to your computer and use it in GitHub Desktop.
Save sigwo/1752ffe23ba686e741c28a8017be9c7e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
# Copyright 2017-2018 Tierion
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Tested with Google and Digital Ocean Ubuntu 16.04 LTS Virtual Machines
#
# You can run this startup script manually, by copying it to the host,
# or by issuing this curl command. Since this command pipes the script
# directly into a bash shell you should examine the script before running.
#
# curl -sSL https://chainpoint-node.storage.googleapis.com/setup.sh | bash
#
# Digital Ocean provides good documentation on how to manually install
# Docker on their platform.
#
# https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
#
# Pre-requisites:
# - 64-bit Ubuntu 16.04 server
# - Non-root user with sudo privileges
# Don't run this script more than once!
if [ -f /.chainpoint-installer-run ]; then
echo "Looks like this script has already been run. Exiting!"
exit 0
fi
# Make sure we're running on Ubuntu 16.04 (Xenial)
if [ "$(. /etc/os-release; echo $NAME)" != "Ubuntu" ]; then
echo "Looks like you are not running this on an Ubuntu OS. Exiting!"
exit 1
fi
if [ "$(. /etc/os-release; echo $UBUNTU_CODENAME)" != "xenial" ]; then
echo "Looks like you are not running this on Ubuntu version 16.04 (Xenial). Exiting!"
exit 1
fi
echo '#################################################'
echo 'Installing Docker'
echo '#################################################'
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-cache policy docker-ce
apt-get install -y docker-ce make
echo '#################################################'
echo 'Installing Docker Compose'
echo '#################################################'
mkdir -p /usr/local/bin
curl -s -L "https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
echo '#################################################'
echo 'Downloading chainpoint-node Github Repository'
echo '#################################################'
if [ ! -d "~/chainpoint-node" ]; then
cd ~ && git clone -b master https://github.com/chainpoint/chainpoint-node
fi
# Start docker
service docker start
echo '#################################################'
echo 'Creating .env config file from .env.sample'
echo '#################################################'
cd ~/chainpoint-node && make build-config
echo '#################################################'
echo 'Docker and docker-compose installation completed!'
echo 'Please now exit and restart this SSH session'
echo 'before continuing with the README instructions.'
echo '#################################################'
touch /.chainpoint-installer-run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment