Giter VIP home page Giter VIP logo

Comments (6)

hurzelpurzel avatar hurzelpurzel commented on June 10, 2024

Got the same problem. But now I got it working by comment the access_log declaration at 04_routing/webserver/nginx.conf.
The problem that its just runs with root user only still remains. Even www-data as user (default for nfinx service) was not possible.

# comment out on windows
#access_log /dev/stdout compact;

Starting the app using

 sudo -u root  npm run 04_routing  
did the job, even the scripts complains about opening the browser is not possible, but you can do it by your self.

from micro-frontends-in-action-code.

hurzelpurzel avatar hurzelpurzel commented on June 10, 2024

Final solution which solve all the problems was the following.

daemon off;
error_log  /tmp/error.log;
pid        /tmp/nginx.pid;
events {}

http {
  upstream team_decide {
    server localhost:3001;
  }

  upstream team_inspire {
    server localhost:3002;
  }

  log_format compact ':3000$uri $status';

  server {
    listen 3000;

    
    # comment out on windows
    access_log /tmp/access.log compact;

    location /product/ {
      proxy_pass  http://team_decide;
    }

    location /decide/ {
      proxy_pass  http://team_decide;
    }

    location /recommendations {
      proxy_pass  http://team_inspire;
    }

    location /inspire/ {
      proxy_pass  http://team_inspire;
    }
  }
}

I found that by visiting the full example at https://www.nginx.com/resources/wiki/start/topics/examples/full/. This sets log an Pid files to /tmp which is accessible for all users by default.

from micro-frontends-in-action-code.

trevorgithub avatar trevorgithub commented on June 10, 2024

Thanks @hurzelpurzel . Dumb question - where do I put that configuration? I see under 04_routing/webserver there's a nginx.conf. I tried updating that, but it didn't seem to help.

from micro-frontends-in-action-code.

hurzelpurzel avatar hurzelpurzel commented on June 10, 2024

from micro-frontends-in-action-code.

trevorgithub avatar trevorgithub commented on June 10, 2024

Yeah, what you did makes sense. It's just that after modifying 04_routing/webserver/nginx.conf to look like your sample nginx config above, and then running npm run 04_routing, it still complains:

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)

This despite the fact that I look at package.json, and for the 04_routing script, I see:

"04_routing": "concurrently --names \"nginx ,decide ,inspire\" \"node nginx.js 04_routing/webserver/nginx.conf\" \"mfserve --listen 3001 04_routing/team-decide\" \"mfserve --listen 3002 04_routing/team-inspire\" \"wait-on http://localhost:3000/product/porsche && opener http://localhost:3000/product/porsche\"",

So, it looks like it should be referencing the nginx.conf in the 04_routing/webserver folder.

I did try sudo npm run 04_routing and that did get past the original problem. It introduce a 2nd problem though:

Running Firefox as root in a regular user's session is not supported.

I could work around this problem by taking the URL the script tried to load, and manually copying it into the browser:

http://localhost:3000/product/porsche

Thanks for the help!

from micro-frontends-in-action-code.

trevorgithub avatar trevorgithub commented on June 10, 2024

@hurzelpurzel, well I spoke too soon. Running as sudo did work for 04_routing example. But once I got to the next chapter, 05_ssi, it fails:

nginx: [emerg] open() "/dev/stdout" failed (6: No such device or address)

I can confirm that 05_ssi/webserver/nginx.conf contains the ssi on feature. So, I'm quite sure that's the intended configuration file.

If I run npm run 05_ssi without sudo, then the error message is different:

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)

I tried commenting out this line in 05_ssi/webserver/nginx.conf:

access_log /dev/stdout compact;

Since there's a comment mentioning that it should be commented out in Windows (even though I'm on Ubuntu), but no luck.

It's clearly a file permission issue, but I'm not sure what's going wrong. Any further suggestions?

EDIT: Oh, wait. It still works with sudo, provided I comment out the line above

from micro-frontends-in-action-code.

Related Issues (6)

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.