Coder Social home page Coder Social logo

danwahlin / angular-docker-microservices Goto Github PK

View Code? Open in Web Editor NEW
218.0 10.0 128.0 657 KB

Example of serving an Angular app to the browser using nginx. App calls Node.js/MongoDB and ASP.NET Core/PostgreSQL microservices.

TypeScript 25.09% JavaScript 28.15% Shell 0.31% C# 32.46% HTML 7.65% CSS 3.50% Dockerfile 2.85%

angular-docker-microservices's Introduction

Angular, Docker and Microservices

NOTE: If you're using Docker CE on Windows, remove the cAdvisor service defined at the bottom of the docker-compose.yml file before running the project.

To run the project (development mode):

  1. Install Docker CE for Mac or Windows (http://docker.com)

  2. Install Angular CLI: npm install @angular/cli -g

  3. Run npm install at the root of the project

  4. Run npm install in ./microservices/node

  5. Move back to the project root

  6. Run ng build

  7. Run docker-compose build

  8. Run docker-compose up

  9. Navigate to http://localhost

  10. To see your container CPU utilization, memory, etc. visit the cAdvisor URL: http://localhost:8080

angular-docker-microservices's People

Contributors

danwahlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-docker-microservices's Issues

Question about the app-network in the demo?

Hi Dan. I watched you giving a tutorial on youtube about the Docker and Angular. Thanks, that was awesome. I refer to it quite often. Now, that I come across Docker myself and try to containerize my app locally, I encounter some difficulties. Additionally, I am quite new in programming. Can you explain please how did you create an app_network that you used in the docker-compose.yml? I am having troubles proxying an api requests, since my backend container is working on different port. I configured Nginx, by adding upstream module but I get 502 Gateway issue. Although, all containers operate in the default network, I guess solution might be in creating a new app_network, like you probably did for your demo.

Failing on running cAdvisor

CONDITIONS:
Windows 10
ACTION
clone and follow the instructions
EXPECTED
after docker-compose up everything is up and running
ACTUAL
$ docker-compose up
postgres is up-to-date
mongodb is up-to-date
Recreating nginx ...
Recreating aspnetcoreapp ...
Recreating nodeapp ...
Recreating nginx ... done
Recreating aspnetcoreapp ... done
Recreating nodeapp ... done
ocker:/var/lib/docker"\nis not a valid Windows path'

ERROR: for cadvisor Cannot create container for service cadvisor: b'Mount denied:\nThe source path "\\var\\lib\\docker:/var/lib/docker"\nis not a valid Windows path'
ERROR: Encountered errors while bringing up the project.

reusing angular and node from containers

Hi,
Is there a way that I could reuse node and angular from the containers in order develop the angular app?

I found here but I am not quite sure how to link it all together so that VC code can do code completion and all the checks.

Thank you in advance,

Michal

PWA/Service Worker Compatibility

I'm attempting to use your nginx.conf to host an Angular PWA/service worker project via Docker.

What I'm finding is that the app does not properly leverage the service worker when hosting through my container.

When I follow the Angular docs to serve the app with http-server, the service worker properly intercepts the requests and serves the resources from the cache. I can also load the app when http-server is not running, once the service worker has previously cached the resources. So basically.. it's behaving exactly as I would expect a service worker to behave:

ServiceWorkerWorking

When I host the exact same service worker build through my Docker container/NGINX, however, the app behaves much differently:

ServiceWorkerNotWorking

Furthermore, when I take my container down, I can no longer load the app from the service worker's cache. The only real difference here is that I'm hosting through a Docker container, but more specifically, through NGINX.

So my question is: what changes do I need to make to my nginx.conf in order to make NGINX play nicely with a PWA/service worker setup?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.