Skip to content
This repository was archived by the owner on Jun 4, 2019. It is now read-only.

Getting Started

Jeff Fredrickson edited this page Jul 27, 2016 · 13 revisions

How to set up a DevOps Workshop environment.

Basic server

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.

  1. Launch an AWS EC2 instance (see AWS user guide)
  2. SSH into the EC2 instance (see AWS user guide)
  3. 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")
  4. Switch to the web server root directory: cd /var/www/html
  5. Clone the static site repository: git clone https://github.com/jfredrickson5/DevOps-test-static.git .
  6. 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.

Containerization

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.

Setting up Docker

  1. Open TCP ports 80, 8000-8100 in EC2
  2. SSH into your EC2 instance
  3. Set up Docker (see AWS user guide - only follow the instructions in the "Installing Docker" section)

Setting up dev, test, and production containers

First, log in to to your EC2 instance.

  1. Clone the static site repository: git clone https://github.com/jfredrickson5/DevOps-test-static.git
  2. Go into the directory you just cloned: cd DevOps-test-static

Development

  1. Build a Docker image: docker build -f Dockerfile.dev -t devops-test-static-dev .
  2. Run a dev container on port 8010: docker run --name devops-test-static-dev -p 8010:80 -d devops-test-static-dev

Test

  1. Build a Docker image: docker build -f Dockerfile.test -t devops-test-static-test .
  2. Run a test container on port 8020: docker run --name devops-test-static-test -p 8020:80 -d devops-test-static-test

Production

  1. Build a Docker image: docker build -t devops-test-static-prod .
  2. 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/)
Clone this wiki locally