climsoft / climsoft-web

Climsoft web application
MIT License
0 stars 6 forks source link

Challenges with Docker Containerization in Development Setup #15

Open Patowhiz opened 4 months ago

Patowhiz commented 4 months ago

Overview

I've encountered several challenges while attempting to containerize our full application stack for development deployment. These issues have significantly impacted the efficiency of our development process, particularly regarding our Angular and NestJS applications running within Docker containers. Below, I detail the specific problems faced:

Challenges Encountered

  1. Angular Development Server Accessibility:

    • The Angular development server does not respond when accessed from the host machine, despite running inside a Docker container.
  2. Angular Hot Reloading:

    • Hot reloading for the Angular application does not work, even after mounting the Docker volume to the host directory. Changes made to the codebase do not trigger a live reload, hindering efficient development.
  3. NestJS Hot Reloading:

    • Similarly, hot reloading for the NestJS application fails to function as expected. While there is a workaround mentioned on Stack Overflow, it introduces significant delays in compilation times following file changes, making it impractical for a smooth development workflow.

Temporary Resolution

Given these substantial hurdles, I've decided to limit Docker containerization solely to the PostgreSQL instance within our development deployment setup. This approach circumvents the issues encountered with the Angular and NestJS applications but is not an ideal solution.

Request for Assistance

I am seeking advice or solutions from the community that might help address these challenges, enabling full-stack containerization without compromising on development efficiency. Any insights, alternative approaches, or updates that could alleviate these issues would be greatly appreciated.

You can have a look at the attempted docker development set up in the docker-backup-2 branch

isedwards commented 4 months ago

@Patowhiz - can you confirm whether docker-compose.prod.yaml is working and (if production is working) how is your local development environment differs from where you are deploying for production?

(or is production also not working yet?)

Patowhiz commented 4 months ago

@isedwards, thank you for your input.

For the development deployment, my plan includes:

  1. Dockerizing all three application instances.
  2. Utilizing the Angular development server to serve the frontend Angular application.
  3. Ensuring that both the Angular and NestJS applications support hot reloading through their respective development servers.

As for the production deployment, I'm still in the planning phase, and it will significantly differ from the development setup. My current approach involves:

  1. Dockerizing all three application instances.
  2. Serving the Angular application via Nginx.
  3. Serving the NestJS application with NodeJS.
  4. Including only compiled files in the containerized Angular and NestJS applications.

I'm not anticipating the mentioned development challenges in the production deployment. I'm also contemplating adjusting the production deployment strategy to incorporate a containerized Nginx application responsible for routing to the Angular and NestJS applications.