-
Notifications
You must be signed in to change notification settings - Fork 32
Creating the CIViC AMI
This is a step-by-step guide to configuring a CIViC development EC2 instance on Amazon Web Services (AWS). While we currently provide an AMI for the purpose of developing CIViC, this page provides developers with detailed knowledge of how that AMI was configured. This guide assumes familiarity with the AWS EC2 console. For more information about the console and setting up an account, please see the getting started guide.
We selected the Canonical Ubuntu image ami-0bbe6b35405ecebdb. This image was selected from Canonical's AMI locator tool for the following characteristics:
Attribute | Value |
---|---|
Zone | us-west-2 |
Version | 18.04 LTS |
Instance type | hvm:ebs |
The following steps follow the steps of the Amazon instance creation wizard in the EC2 management console. The image in step 1 is only available in us-west-2 (Oregon), please ensure that your console is searching the correct region (top toolbar, right).
-
Select an AMI: Select the
AMIs
submenu on the EC2 console (left toolbar, underImages
). Search Public images forAMI ID : ami-20be7540
. Right click on the result from this search and selectLaunch
. -
Choose an instance type: Choose the
t2.medium
instance type. Note: this instance type is only needed for installing and configuring the AMI. Once the AMI has been created, subsequent instances used for CIViC development may be of typet2.micro
. -
Configure Instance Details: The default values on this page may be used.
Protect against accidental termination
is a recommended, but not necessary, option to select. -
Add Storage: Only a root volume is necessary. The default values of
8GiB
andMagnetic
are recommended. -
Tag Instance: Add labels to your instance. See the Amazon documentation for more information about tagging EC2 resources.
-
Configure Security Group: Create or select a security group with the following inbound rules:
Type Protocol Port Range Source SSH TCP 22 0.0.0.0/0 Custom TCP Rule TCP 3000-3001 0.0.0.0/0 -
Select a key pair for access: Select an existing key pair or create a new one. See the Amazon documentation for more information on this subject.
-
After configuring and initializing the instance, log into the running instance.
-
Update the pre-installed system packages
sudo apt-get update sudo apt-get upgrade
-
Install Canonical repository dependencies
sudo apt-get install curl git zlib1g-dev build-essential libssl1.0-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev libpq-dev python
-
Configure git
git config --global core.editor vim
-
Install rbenv
cd git clone https://github.com/rbenv/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc exec $SHELL git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc exec $SHELL
-
Install ruby
rbenv install 2.3.7 rbenv global 2.3.7
-
Install bundler
gem install bundler rbenv rehash
-
Install Yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update && sudo apt-get install yarn echo 'export PATH="/home/ubuntu/.yarn/bin:$PATH"' >> ~/.bashrc exec $SHELL
-
Install rails
gem install rails -v 4.2.10 rbenv rehash
-
Install and configure postgresql
sudo apt-get install postgresql-common postgresql sudo -u postgres createuser ubuntu -s sudo -u postgres psql > \password ubuntu > Enter new password: dev > Enter it again: dev > \q sudo service postgresql restart
-
Install the CIViC server
git clone https://github.com/genome/civic-server.git cd civic-server bundle install rbenv rehash
-
Configure rails to work with postgresql
sudo vi /etc/postgresql/10/main/pg_hba.conf
# Database administrative login by Unix domain socket local all all trust # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust
sudo service postgresql restart
-
Update the CIViC server database
rake db:create db:migrate rake civic:load[force]
-
Install the CIViC client
cd git clone https://github.com/genome/civic-client.git cd civic-client yarn install yarn global add bower bower install yarn global add gulp
-
Configure the CIViC client
git update-index --assume-unchanged gulp/server.js vi gulp/server.js
Change the host entry in the config from
127.0.0.1
to0.0.0.0
-
(Optional) Shut down the civic developer instance: On the EC2 control panel
Instances
subpanel, right-click on the running civic developer instance, and selectInstance State
->Stop
. -
Create image from the civic developer instance: Right-click on the civic developer instance, and select
Image
->Create Image
. On the pop-up dialogue, add an image name and description, and then clickCreate Image
. -
Rename snapshot: On creating an image, a new snapshot will be created. Find this in the
Snapshots
subpanel of the EC2 dashboard. Select the new image, hover over the name field, and select the icon that appears. Enter a new name that matches your image name from step 2. -
(Optional) Make your AMI public: In order to find your AMI from another AWS account, you will need to make the AMI public. In the
AMIs
subpanel of the EC2 dashboard, right-click on the newly created AMI and selectModify Image Permissions
. Select thePublic
radio button, and pressSave
.
You now have recreated a copy of the CIViC developer AMI. From here, launch instances to start developing on CIViC!