Skip to content

Instantly share code, notes, and snippets.

@richardking
Created June 3, 2014 22:42
Show Gist options
  • Save richardking/f758652711cf4d07e3e8 to your computer and use it in GitHub Desktop.
Save richardking/f758652711cf4d07e3e8 to your computer and use it in GitHub Desktop.
Lighthouse_db and EB
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:
![](http://bleacher-report.d.pr/aTAS+)
### Within Elastic Beanstalk console
Start by clicking the 'Create a New Application' in the Elastic Beanstalk console.
![](http://bleacher-report.d.pr/3bZ2+)
Enter an application name:
![](http://bleacher-report.d.pr/mgBb+)
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)
![](http://bleacher-report.d.pr/s5gN+)
On the **Application Version** page, select 'Upload your own', and pick the zip file you created earlier.
![](http://bleacher-report.d.pr/Rjs2+)
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.
![](http://bleacher-report.d.pr/2tjq+)
On the **Additional Resources** page, make sure to select:
```Create an RDS DB Instance with this environment```
![](http://bleacher-report.d.pr/2HAI+)
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.
![](http://bleacher-report.d.pr/OIiy+)
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]
![](http://bleacher-report.d.pr/GWjQ+)
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:
![](http://bleacher-report.d.pr/zMmg+)
Click on your instance, and in the bottom section, look for ```Public DNS``` (top right corner):
![](http://bleacher-report.d.pr/rlSN+)
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