This repository was archived by the owner on Jun 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
Jeff Fredrickson edited this page Jul 27, 2016
·
13 revisions
How to set up a DevOps Workshop environment.
These instructions will get you set up with a basic web server that can serve a static website, and you will be able to update the website by doing a git pull
.
- Launch an AWS EC2 instance (see AWS user guide)
- SSH into the EC2 instance (see AWS user guide)
- Set up an Apache web server (see AWS user guide - follow the instructions in the sections "Prerequisites", "To install and start the LAMP web server on Amazon Linux", and "To set file permissions")
- Switch to the web server root directory:
cd /var/www/html
- Clone the static site repository:
git clone https://github.com/jfredrickson5/DevOps-test-static.git .
- Verify that Apache in your EC2 instance is now serving up the test static site by going to http://X.X.X.X/, where X.X.X.X is the IP address of your EC2 instance
Now we have a basic static site server. You can update it from the GitHub repository by logging in to the EC2 instance and doing cd /var/www/html
then git pull
.
The next step is to containerize the static website so that it can be easily deployed. Start with your EC2 instance from above. We are going to do things a bit differently in that we are going to use nginx as a web server in a Docker container.
- Open TCP ports 80, 8000-8100 in EC2
- SSH into your EC2 instance
- Set up Docker (see AWS user guide - only follow the instructions in the "Installing Docker" section)
First, log in to to your EC2 instance.
- Clone the static site repository:
git clone https://github.com/jfredrickson5/DevOps-test-static.git
- Go into the directory you just cloned:
cd DevOps-test-static
- Build a Docker image:
docker build -f Dockerfile.dev -t devops-test-static-dev .
- Run a dev container on port 8010:
docker run --name devops-test-static-dev -p 8010:80 -d devops-test-static-dev
- Build a Docker image:
docker build -f Dockerfile.test -t devops-test-static-test .
- Run a test container on port 8020:
docker run --name devops-test-static-test -p 8020:80 -d devops-test-static-test
- Build a Docker image:
docker build -t devops-test-static-prod .
- Run a prod container on port 80:
docker run --name devops-test-static-prod -p 80:80 -d devops-test-static-prod
At this point, on your EC2 instance, you will have:
- A dev environment running on port 8010 (http://YOUR_EC2_IP_ADDRESS:8010/)
- A test environment running on port 8020 (http://YOUR_EC2_IP_ADDRESS:8020/)
- A production environment running on port 80 (http://YOUR_EC2_IP_ADDRESS/)