Skip to content

842u/docker-nginx-rpi

Repository files navigation

Overview

This project was built to gain a fundamental understanding of Docker, NGINX, and the development and deployment processes on private remote machines. Initially deployed on a Raspberry Pi private server, it is now hosted on AWS.

Live demo

Tools & Technologies

Docker GitHub Next.js

Others
Tool Used for/as
nginx nginx reverse proxy, request forwarding
Raspberry Pi Raspberry Pi private container hosting
AWS AWS container hosting
VS Code VS Code remote development
SSh SSh remote development
TypeScript TypeScript
TailwindCSS TailwindCSS

Description

Details

The main focus of this project was to get a grasp on containerization technology and the management of remote machines. At its core, it is a simple NextJS application. Incoming public requests are forwarded to the containerized application with NGiNX used as a reverse proxy, providing routing between containers, the host machine, and the web.

To centralize both the codebase and container images and simplify image management, the project utilizes GitHub Packages image registry.

The application takes two approaches on containerization strategy:

  • Single-Container (main branch): In this approach, NGiNX is installed inside the container at the image build step in the Dockerfile. This method encloses the entire application in a single image, stored in the image repository. It provides a convenient way to download the image and run the container to start the application.

  • Multi-Container (multi-container branch): Here, NGiNX is used as a separate image in a Docker Compose file. This method produces two separate services, one for the application and one for NGiNX. This adds a layer of separation but requires building images using Docker Compose, which results in longer build and start times.

Initially, the application was hosted on a Raspberry Pi 3B+ with a headless OS Lite and developed remotely in VS Code with the help of SSH. However, to ensure the demo application is always live regardless of private server availability and to learn how to deploy containers in the cloud, it was moved to AWS Elastic Container Service.

This project does not follow semantic versioning for images. Instead, there are two latest versions of images based on the main branch for different environments: development and production.

Setup

Single-Container
  • Download image:
    docker pull ghcr.io/842u/docker-nginx-rpi:production
  • Run container:
    docker run ghcr.io/842u/docker-nginx-rpi:production
Multi-Container
  • Checkout on multi-container branch.

  • Build and run containers from docker-compose file:

    docker-compose -f ./docker/production/docker-compose.yaml up

License

Code is under GNU GPLv3 license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages