Skip to the content.

Deployment blog

Deployment Blog

Prerequisites

  • Review the backend-to-frontend functionality
  • Document the deployment process with key steps and visuals
  • Assign deployment admin roles
  • Ensure configuration files (Dockerfile, docker-compose.yml, nginx config) are set up

Local Testing Before Deployment

  • Verify the backend is fully functional locally
  • Test CRUD operations using API calls
  • Confirm the frontend correctly interacts with the backend

Domain and Subdomain Setup

  • Register a subdomain using AWS Route 53
  • Configure the subdomain to route traffic correctly

Selecting Ports

  • Choose an available backend port
  • Update the port across all necessary files
  • Backend configuration
  • Docker-related files
  • Frontend settings

Setting Up AWS EC2 Instance

  • Log in to AWS and navigate to EC2
  • Launch an appropriate EC2 instance
  • Connect to the instance via SS

Preparing Docker on Localhost

  • Open the backend project in VSCode
  • Ensure Docker files are correctly configured
  • Run Docker locally and verify the service is accessible
  • Push the latest changes to GitHub

Deploying to AWS EC2

  • SSH into the AWS instance
  • Clone the backend repository
  • Navigate into the project directory
  • Build and start the Docker container
  • Verify the deployment by checking if the service runs

Configuring Route 53 DNS

  • Open AWS Route 53
  • Add a CNAME record pointing to the EC2 instance
  • Confirm that the domain resolves correctly

Setting Up Nginx for Reverse Proxy

  • SSH into the EC2 instance
  • Navigate to the Nginx configuration directory
  • Create a new configuration file
  • Configure the reverse proxy settings
  • Save and activate the configuration
  • Restart Nginx and test domain accessibility

Securing with SSL (Certbot)

  • Install Certbot
  • Select the domain for HTTPS configuration
  • Redirect all HTTP traffic to HTTPS
  • Verify that the SSL certificate is working

Updating and Redeploying Code

On Local Machine:

  • Test changes in VSCode
  • Run Docker locally and verify functionality
  • Push the latest changes to GitHub
  • On AWS EC2:
  • SSH into the instance
  • Navigate to the repository
  • Stop the running containers
  • Pull the latest changes from GitHub
  • Rebuild and restart the container
  • Verify updates on the live website

Final Checks

  • Confirm the website is accessible via HTTPS
  • Ensure API requests function correctly
  • Validate SSL security
  • Perform end-to-end testing

Troubleshooting Deployment Issues

  • Check if the application is running correctly
  • Verify running Docker containers
  • Inspect logs for errors
  • Confirm proper port forwarding and domain configuration

Cockpit for Server Management

  • Log into Cockpit for server monitoring
  • Review CPU, memory, and network usage
  • Check system logs for any issues
  • Manage users and access control settings
  • Perform system updates if required

Image