Created
June 3, 2014 22:42
-
-
Save richardking/f758652711cf4d07e3e8 to your computer and use it in GitHub Desktop.
Lighthouse_db and EB
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
First you'll need to clone the ```docker-1``` branch of lighthouse_db at <https://github.com/richardking/lighthouse_db/tree/docker-1>. After you clone it, compress the tree into a .zip file[^note]. | |
Also you may want to create an SSH key-pair in the EC2 Console so you can SSH into the EC2 instance after it is built: | |
 | |
### Within Elastic Beanstalk console | |
Start by clicking the 'Create a New Application' in the Elastic Beanstalk console. | |
 | |
Enter an application name: | |
 | |
On the **Environment Type** page, select: | |
Environment Tier: Web Server 1.0 | |
Predefined configuration: Docker | |
Environment type: Single Instance (can be 'Load balancing, autoscaling' if necessary) | |
 | |
On the **Application Version** page, select 'Upload your own', and pick the zip file you created earlier. | |
 | |
The next screen, **Environment Information**, should be pre-populated. You can change the environment name/url if you want, or if there is a conflict. | |
 | |
On the **Additional Resources** page, make sure to select: | |
```Create an RDS DB Instance with this environment``` | |
 | |
On the **Configuration Details** page, select an ```Instance Type``` (I usually select m1.medium or m1.large, just so the environment isn't super slow) and ```EC2 key pair``` (which you may have created earlier) as necessary. I don't change the ```Email address``` or ```Instance profile``` fields. | |
 | |
I don't enter anything on the next page (**Environment Tags**). | |
On the **RDS Configuration** page, change: | |
DB Engine: Postgres | |
Allocated storage: 5 GB | |
Instance class: [change as necessary] | |
Username: postgres | |
Password: [anything] | |
 | |
Review the information on the final step and then click **Launch** to build the instance and DB. It should take about 15 minutes to build the DB and start the instance. | |
### SSH-ing into EC2 | |
Note: You can only do this if added your SSH key-pair in the EC2 console, as specified in the beginning of this document. | |
Log into the EC2 Console, click on ```Instances``` in the left-hand menu and search for your environment: | |
 | |
Click on your instance, and in the bottom section, look for ```Public DNS``` (top right corner): | |
 | |
You can ssh into the EC2 instance by typing ```ssh ec2-user@[public-dns]``` in your terminal. | |
Within the SSH session, you can look up your Docker images using ```sudo docker images```, and your Docker containers using ```sudo docker ps```. | |
[^note]: Make sure the zip file's top level directory is your project root. Note that if you download the zip directory from GitHub, the zip file will contain a folder with the project in it- this will *not* work for EB. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment