Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 1.55 KB

readme.md

File metadata and controls

47 lines (37 loc) · 1.55 KB

Application Deployment with Docker and Instance-based Services

Context Overview

You are tasked with deploying a backend application using Docker while integrating it with services installed directly on an EC2 instance. This setup demonstrates understanding of containerized applications communicating with traditional instance-based services.

Infrastructure Setup

Instance Configuration

  • EC2 Instance: t2.micro (or similar)
  • Operating System: Ubuntu 22.04 LTS
  • Required packages:
    • PostgreSQL 14 or later
    • Nginx (latest stable version)
    • Docker

Requirements

Main Tasks

  1. PostgreSQL Setup

    • Install PostgreSQL directly on the EC2 instance
    • Configure PostgreSQL to accept connections from Docker containers
    • Create necessary database and user
    • Secure the database with proper credentials
    • Ensure PostgreSQL is running on port 5432
  2. Application Containerization

    • Create Dockerfile for the backend application
    • Configure environment variables for database connection
    • Build and run the container
    • Ensure proper network configuration to connect to host PostgreSQL
    • Application should run on port 8000
  3. Nginx Configuration

    • Install Nginx on the EC2 instance
    • Configure as reverse proxy to the Docker container
    • Handle static file serving
    • Basic security headers implementation
    • Listen on port 80

Optional Task: CI/CD with GitHub

  1. GitHub Actions Workflow
    • Automated testing
    • Docker image building
    • Deployment to EC2 instance
    • Environment variable management