Running multiple instances of JHipster - jhipster

I'm running two instances of JHipster. Each have its server port different. What do I else need to change to make the grunt serve and other stuff to work ?

You must change the ports for gulp browser-sync 3000 and browser-sync ui 3001 and spring-boot 8080.
It means that:
in application-dev.yml, you must change server.port from 8080 to another value (e.g 8081)
in Gruntfile.js, you must set browser-sync server to use another port (e.g 3002 not 3001 as it is used for BS UI) and also change browser-sync ui port (e.g 3003) . You must also change the proxy port to what you set in application-dev.yml

Related

Prevent "EADDRINUSE" with pm2?

I am about to switch my node application server from phusion passenger to pm2.
Most of the ports of my apps are set to 3001. With passenger that's never been a problem, but with pm2 ports collide (EADDRINUSE).
Do I have to set a different port for every app to prevent port collisions?
Yes, of course you need to have each application listen on a different and free port. It is your app that listen to port, not PM2.
You can leave the same port in source code, but in this case, start your app like this to change port when starting your app:
// Work for express and some others
PORT=3012 pm2 start -n "My Application" app.js
That's because express add this in your starter script:
var port = normalizePort( process.env.PORT || '3509' );
Notice that other package may use another name env var, like NODE_PORT for example.

How to bind port 4200 (Angular web server) to port 80 (Apache web server)?

I have Apache Web Server running on EC2 (RHEL 7) on port 80.
Also have Angular App running on port 4200 on the same server.
How to bind port 80 so that when someone from outside goes to IP (e.g. 1.2.3.4) goes directly to Apache port 80 (that part works now) which then redirect (or bind) to port 4200 so that the end user can see Angular app output (instead of Apache output)?
Thanks.
Use a reverse proxy Nginx for example.
The step will be the following: Nginx listens 80 port from outside and passes this request to 4200 to your Angular app.
Why do you use apache on this port? And what does apache do?
You should instead like Red Cricket says follow the docs.
First run ng build prod or whatever build you need.
Then add the .htaccess file with redirect rules into your dist folder and place it wherever your apache will serve the angular app.
For extra details see the link provided by Red Cricket.

Meteor always listens on port 3000

I created a new Meteor project in WebStorm on Windows 8.
In "Run/Debug Configurations" I set the port value to 3008, but when I run the app, it always works on port 3000.
Does anybody know where Meteor defines the port number or how can I change it?
I've searched the words "3000", "PORT" and "listen" in the entire project but they don't exist.
I've also seen these questions which didn't help me because they use Express which defines the port number hard-coded:
Node.js/Express.js App Only Works on Port 3000 ,
Express is listening on port 3000 despite setting it to 80?
Any help will be profoundly appreciated!
Try passing -p 3008 as a program argument in Meteor run configuration:
http://localhost:3008 in Browser/Live Edit tab is just used for browser launching (i.e. it tells WebStorm to launch the browser with specified URL), it's not supposed to affect Meteor port in any way

run multiple apps on different ports in nodejs express framework

I am running an application using node.js express framework on port 3000 (http://localhost:3000) in my windows machine. Also i want to run another(second) application on different port say like 3005 or 8080 etc. In my first application i didn't specified any port number and i believe expressjs by default runs on port 3000. But in second app i mentioned port number app.listen(8080) in my app.js. When i tried to start second application am getting port 3000 is already in use error. So i stopped first appliction and then only i can run second application and also it is running on both 3000 and 8080 ports. I didn't understand why it is still running on 3000 still i specified port 8080 number in app.js.
Could any one help to run both application on different ports in same instance
Thanks
If you're using express generator also check the www file in the bin folder, which probably contains a part similier to this:
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
Change the '3000' part to the port you desire and it should run as intended.
Lastly to change port use "PORT=4000 node app/app.js" in cmd line.
Port no can be changed to any other port no. 5000,6000 etc ...
i believe expressjs by default runs on port 3000
It's true, but you can change it.
I think you run express default boilerplate app.
In this case you should update line var port = normalizePort(process.env.PORT || '3000'); in bin/www.
It worked after changing port number in www file. www file is located in bin folder that was created during enviornment setup.

Heroku running a node module server

I am trying to create a node app that runs a module called noodlejs. This starts its own server running on port 8888 (on my local version). I have pushed the changes to heroku and no errors are caused. However how do I now access the noodlejs server on port 8888? Is this possible or does it need to run on another port?
Thanks!
I don't think you can run the app on port 8888 or any other port for that matter on Heroku. You can only choose between 80 or 443. And to do that, you use process.env.PORT environment variable that Heroku exposes.

Resources