How to configure a Gaiahub on Amazon EC2,step by step tutorial

 
 
 
This teaches you how to run a Gaia hub on Amazon EC2. Amazon EC2 is an affordable and convenient cloud computing provider. This example uses Amazon EC2 together with an EB3 instance for file storage.
 


Prerequisites you need
Task 1: Launch an EC2 instance
Task 2: Test your Gaia server
Task 3: Configure a domain name
AWS hub tips and tricks

SSH into the Host
Displaying the docker services
Locations of key files
Restart services and reload certificates


 
 
Prerequisites you need
 
This procedure uses Amazon AWS to choose and configure an Amazon Machine Image (AMI) running a Gaia service. For this reason, you should have an AWS account on the Amazon AWS free tier, personal account, or corporate account. These instructions assume you are using a free tier account.

These instructions assume you have already created a free domain through the freenom service. If you have another domain, you can use that instead.

Finally, setting up the SSL certificates on your EC2 instance requires you to use the terminal command line on your workstation. Make sure you have the watch command installed using the which command.
$ which watch
/usr/local/bin/watch
If watch is not located, install it on your workstation.
 
 
Task 1: Launch an EC2 instance
 
1.Visit the AWS Free Tier page and choose Sign in to the Console.
 

 
 
 
2. Make sure your region is set to one close to you.
 

 
 
 
 
3.  Under Build a solution choose Launch a virtual machine.

The system opens the EC2 dashboard.

4.  Enter Blockstack Gaia in the search bar.

5.  The system finds AMIs in the Marketplace and the Community.

Choose Community AMIs.

The system displays the available Gaia hub images.
 
 
 
 
6. Select the most recent version of the image.

Each image name has this format:

blockstack-gaia_hub-STORAGETYPE-VERSION-hvm - ami-BUILDTAG

So, the blockstack-gaia_hub-ephemeral-0001.0.1-hvm - ami-0425cf8c91bb2d331image uses ephemeral storage, is at version 0001.0.1 and has the 0425cf8c91bb2d331 tag.

You can choose an image that uses ephemeral or EBS storage. The ephemeral storage is very small but free. Only choose this if you plan to test or use a personal hub. Otherwise, choose the AMI for elastic block storage (EBS).

After you select an image, the system displays Step 2: Choose an Instance Type page.
 
 

 
 
7.  Select t2.micro and choose Next: Configure Instance Details.
 
 
To configure instance details, do the following:

1. Select a VPC.

A default VPC is created with a free tier account. You can use this default VPC. Or you can choose another VPC. If you choose another VPC, ensure the Subnetvalue is set to a subnet reachable by a public IP.
Important: If you're using a private subnet, you should attach an elastic IP (EIP) to the VM. This EIP allows you to reboot the instance without worrying whether the address will reset. To attach an IP, press allocate new address and follow the instructions to attach the EIP to your new EC2 instance.

 
2. Set Protect against accidental termination.

If you terminate a Gaia instance, you lose all the data associated with it. Protection adds an extra step to terminating your Gaia instance.

3. Open the Advanced Details.

At this point, you are going to configure environment variables for your instance.

4. Paste the following into the Advanced Details.
{
"ignition": { "version": "2.2.0" },
"storage": {
"files": [{
"filesystem": "root",
"path": "/etc/environment",
"mode": 420,
"contents": {
"source": "data:application/octet-stream,API_KEY%3D<KEYPHRASE>%0ADOMAIN%3D<DOMAIN_NAME_VALUE>%0ASTAGING%3D<STAGING_VALUE>"
}
}]
}
}

5.  Replace the following values in the JSON.
 
 
VALUE DESCRIPTION
<KEYPHRASE> A phrase to pass when using the hub admin. For example, hubba is a fun key phrase.
<DOMAIN_NAME_VALUE> Your hub's domain name. For example, maryhub.mlis the domain name in this example.
<STAGING_VALUE>

Indicates what type of SSL to create, testing (`1`) or production (`0`). Set testing if you want to test without worrying about rate limiting. A testing cerificate is not secure.

For this tutorial, use production (`0`).
 
6.Check your Advanced Details they should look similar to the following:
{
"ignition": { "version": "2.2.0" },
"storage": {
"files": [{
"filesystem": "root",
"path": "/etc/environment",
"mode": 420,
"contents": {
"source": "data:application/octet-stream,API_KEY%3Dhubba%0ADOMAIN%3Dmaryhub.ml%0ASTAGING%3D0"
}
}]
}
}

 
 
At this point, you have configured your instance details.
 
8. Choose Next: Add Storage.
 

 
 
 
 
The storage is set according to the AMI you selected.

9. Choose Next: Add tags.

10. Add a Key of purpose with the Value gaia.
 
 
 11. Choose Next: Configure Security Group.

12. Create a security group with the following three types:
 
 
 
屏幕快照_2019-06-26_下午8.39_.06_.png


 13. Choose Review and Launch.

The system may warn you that the selection is not free tier eligible. You can ignore this for now.

14. Press Launch.

The system prompts you for a key pair.

15. Select Create a new keypair or Choose an existing key pair.

16. Select Launch Instances.
The system launches your instance.
 

 
During the launch process the machine starts and runs some initial setup processes. These processes take a few minutes depending on the network, typically launching does not take more than 10 minutes. While this is happening the instance Status Checks reflect the Initializing status.
 

 
 
 
 Task 2: Test your Gaia server
 
 
Now, you are ready to test your Gaia server and make sure it is up and running.

1.Visit the AWS Free Tier page and choose Sign in to the Console.

 
 
2. Choose All services > EC2.

The system displays the EC2 Dashboard.
 

 
 
3. Select Running Instances.

The system displays your running instances.

4. Locate your recently launched Gaia server.

Make sure the instance shows as running and Status Checks are complete. Completed status checks ensures the Gaia processes and service were started.

5. Select the Description tab.
 

 
 
 
 
 
6. Locate the IPv4 Public IP value.

7. Copy the IP and paste it in your browser.

You should see a message that your connection is not private.
8. Press Advanced.
  
 
9. Choose to proceed.

10. Extend the IP with the PUBLIC_IP/hub_info tag like so.
 You should see a response from your Gaia hub!

 
 
 
 
At this point, you should see a Not secure message in the browser. That’s because you haven’t yet enabled SSL certification. While HTTPS is not required simple to run the hub services, Blockstack will only connect to a hub and write to its storage over a valid HTTPS connection.
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
0
Share it 26-06-19

0 comments

If you wanna get more accurate answers,Please Login or Register