Last active
November 8, 2021 20:39
-
-
Save ccooper21/fb9ee6dca018885a1ced87cd5c60a935 to your computer and use it in GitHub Desktop.
This is a bash shell script for bootstrapping the Hyperledger Fabric development environment on an AWS Ubuntu AMI instance. It has been tested with Ubuntu v14.04 (AMI ID ami-2d39803a). While I wrote this to enable AWS deployments, this script should be usable in any Ubuntu based environment. See the first comment below for the detailed background.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install "git" | |
sudo apt-get update | |
sudo apt-get -y install git | |
# Clone the Hyperledger Fabric base image repository. It would be preferable | |
# to use the "/tmp" directory as the destination, since this repository is no | |
# longer needed once the base image has been built. However, this is | |
# problematic because one of the scripts that builds the base image removes | |
# everything from the "/tmp" directory, as opposed to just the artifacts that | |
# it created. | |
git clone http://gerrit.hyperledger.org/r/fabric-baseimage | |
# Execute the first part of the setup that builds the base image. If in the | |
# past you have only setup a Fabric development environment using an existing | |
# Vagrant box (e.g. "hyperledger\fabric-baseimage"), then you have not seen | |
# this part run before since its final state is what is captured in the box. | |
# Normally, this part is executed via Packer to build a Vagrant box. | |
cd fabric-baseimage | |
BASEIMAGE_RELEASE=`cat ./release` sudo bash -c ./scripts/common/setup.sh | |
sudo bash -c ./scripts/devenv/setup.sh | |
# Setup the directory structure that will contain the Fabric main repository. | |
# When using Vagrant, this repository resides on the host and is made | |
# available to the guest via a VirtualBox shared folder. | |
sudo bash -c 'umask 00002 && mkdir -p /opt/gopath/src/github.com/hyperledger' | |
sudo chown -R ubuntu:ubuntu /opt/gopath | |
# Clone the Fabric repository | |
cd /opt/gopath/src/github.com/hyperledger | |
git clone http://gerrit.hyperledger.org/r/fabric | |
# Create a symbolic link to the repository. Again, when using Vagrant, the | |
# repository on the host is exposed to the guest via another VirtualBox shared | |
# folder. | |
sudo ln -s /opt/gopath/src/github.com/hyperledger/fabric /hyperledger | |
# Execute the second part of the setup. This part produces the majority of | |
# the console output when you use the 'vagrant up' command to start the | |
# Vagrant based development environment for the first time. In this case, you | |
# won't see the output from the preliminary steps that Vagrant takes to | |
# provision a VirtualBox instance. | |
# | |
# Before executing the script, it is necessary to apply a few changes to it. | |
# Specifically, references to the "vagrant" user and group names must be | |
# replaced with the equivalent "ubuntu" user and group names that are baked | |
# into the standard AWS Ubuntu AMI. | |
cd /hyperledger | |
sed -i 's#^usermod -a -G docker vagrant#usermod -a -G docker ubuntu#' ./devenv/setup.sh | |
sed -i 's#^sudo chown -R vagrant:vagrant#sudo chown -R ubuntu:ubuntu#' ./devenv/setup.sh | |
sed -i 's#>> /home/vagrant/.bashrc#>> /home/ubuntu/.bashrc#' ./devenv/setup.sh | |
sudo -H bash -c ./devenv/setup.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UPDATE 2016, SEP 23: Revision 6 includes the necessary changes to again make this script work following the base image creation artifacts being split off from the
fabric
repository into to the newfabric-baseimage
repository. The following is the commit record from thefabric
repository showing when this change was merged into themaster
branch: