Skip to the content.

Things About Deployment

  • Working Process
  • Team Roles

    Frontend UX Engineer - Collin Ge
    • Frontend UX engineer. This person should be looking at the style across the project and suggest improvements for consistency of Team Project. They should be directing team toward SASS styles. As a bonus, you should be able to demonstrate your project working in two themes.
      • Check if the frontend page to be able to connect with the corresponding backend
        Deployment Admin / Assistant - Anyi and Collin
    • Deployment Admin they should work on and review Deployment blog together. They should teach provided guidance to team on learning Unit 4.
      • Ensure successful deployment for the frontend website
      • Check elements in cockpit terminal to see if they have everything
        Scrum Master - Luke
    • Should be handling Kanban board and initiating Stand-up meetings amongst the table. I should see visability of Stand-up meetings at least 3 times before we finish. They are responsible for 3 people understanding and completing assignments like FRQs for CPT PPR, CPT Video, CRUD methods, etc. This person should consider scripts and uniqueness of each individual as they prepare to submit to CB.
      • Responsible for the team blog
      • Help teammates in cpt ppr, cpt video and the crud method.
        Assistant Scrum Master - Anyi
    • Should take burden of themself and two other people in planning and support Scrum Master. They are responsible for 3 people understanding and completing assignments like FRQs for CPT PPR, CPT Video, CRUD methods, etc.
      • Assit the scrum master
      • Planning about next step of deployment
        Backend Admin engineer - Michelle
    • This person should be customizing backend UI and creating screens for admin functions. Additionally this person should ensure db_backup, db_init, and db_restore are supported and working properly.
      • Ensure the database work properly in the terminal cockpit, also make sure able to create new data base.

    Working Process

    Step 1: Configure AWS Route 53 and Create a Subdomain

    To establish our website under the Nighthawk Coding Society, we will create a subdomain using AWS Route 53. This allows us to set up a custom domain for our deployed application.

    • Access AWS Route 53: Log in to AWS and navigate to the Route 53 dashboard.
    • Create a Subdomain: Within the hosted zone for Nighthawk Coding Society, add a new A record (or CNAME if applicable) to point the subdomain to our EC2 instance’s public IP.

      Step 2: Update Ports and Configure Application for Deployment

      To ensure our application runs on a unique port, we will change all instances of port 8887 to port 8402 across our project.

    • Update Python Backend Modify main.py to run on the new port: ```python if name == “main”: app.run(debug=True, host=”0.0.0.0”, port=8402)

      Step 3: AWS EC2 Setup

      To host our application, we need to set up an EC2 instance on AWS.

    • First, we log in to the AWS Console and navigate to the EC2 dashboard.
    • We select the instance that will host our application, ensuring it is properly configured to allow incoming traffic on port 8402.
    • Security groups should be updated to permit HTTP and HTTPS requests. We also verify that our instance has Docker and Docker Compose installed to run the application containers.

      Step 4: Application Deployment Through VSCode

      Before deploying to AWS, we test our application locally.

    • We check for an available port using docker ps and confirm that port 8402 is free.
    • In the backend terminal, we run make to start the server and replace any references to localhost:8887 with http://127.0.0.1:8402. This ensures the frontend can correctly communicate with the backend through the new port.

      Step 5: Deployment in AWS EC2 Terminal

      Once the local test is successful, we move to deployment on AWS.

    • We SSH into our EC2 instance and clone the project repository.
    • Inside the project directory, we run docker-compose up -d --build to build and start the application in the background. To test the deployment, we replace localhost with our EC2 public IP and verify that the site is accessible on port 8402.

      Step 6: Route 53 and Nginx Setup

      To map our domain to the EC2 instance

    • We create a new DNS record in AWS Route 53, pointing the subdomain to the public IP of our EC2 instance.
    • Then, we configure Nginx as a reverse proxy to forward traffic to our application. We write a custom Nginx configuration file, update the proxy_pass to http://localhost:8402, and restart Nginx to apply the changes.

      Step 7: Certbot Certificate Setup

      To enable HTTPS, we use Certbot to generate an SSL certificate for our domain.

    • Running sudo certbot --nginx, we automatically configure Nginx to serve the website over HTTPS.
    • We also update the Nginx configuration to redirect all HTTP traffic to HTTPS for security. After confirming the certificate installation, we restart Nginx to apply the changes.

      Step 8: Code Updates and Version Control

      Once deployment is complete, any necessary code changes must be carefully managed.

    • We first run git pull to ensure we have the latest version of the code.
    • Any changes are committed with meaningful messages, but commits should not be made directly from the AWS terminal.
    • Locally, we test modifications by running docker-compose up and accessing http://127.0.0.1:8402 in a browser.

      Step 9: Synchronizing AWS with Latest Changes

      To apply new updates in AWS, we SSH into the EC2 instance and navigate to the project directory.

    • We first stop the running containers using docker-compose down, then pull the latest changes using git pull.
    • After ensuring everything is up to date, we rebuild and restart the containers using docker-compose up -d --build.

      Step 10: Final Testing and Debugging

      After deployment, we thoroughly test the website by checking different features and ensuring all API requests are functioning correctly.

    • If any errors are found, we debug by inspecting logs with docker logs .
    • We also confirm that the HTTPS certificate is working, and the subdomain correctly routes to the EC2 instance.
    • If needed, we update security group settings to allow incoming traffic. Once everything is verified, the deployment process is complete, and the site is live for users.