Dilen Pat
asked on
Deploying code to unix server - using generic server configuration/localhost
As a junior, I'm a bit new to front end programming (crammed learning JS/other languages/NPM/NodeJS/etc within three months for my current role) so apologies if what I say doesn't make sense.
I've helped to build a UI for an application with the use of NPM/Node JS. The application stores data on a UNIX server. The UI accesses the data on the server (https://myhostname:8090/blah/blah) and presents the results with a nice UI. With the help of GIT, I've managed to do move all the src UI code onto the UNIX server. The purpose is for automation
While a specific file (in my UI code) specifies the UNIX server configuration, I've used NPM to build a bundle.js (Which bundles all the JS files into a single file) file. I move this bundles.js along with the index.html and CSS styling files to an appropriate directory in order to use Maven to build a JAR file. And with a start/stop server script to run the process to run the code, I can just enter the UNIX hostname/port number in my browser window in order to access the UI and data. This all works.
However. I now need to generalise the server configuration in my bundle.js file as well as properties file on server side such that I'm not hard coding server configuration anywhere (meaning I can deploy the UI on any server with no issue). i.e. playing with "localhost" instead of the actual server hostname etc.
I want to try my best, but I need to acknowledge that I have no real server configuration experience and hence need a little nudge in the right direction. Would someone be able to help me?
At the moment, I simply replaced the hostname with localhost in my bundle's configuration.
In a browser, when I enter the server hostname/port, this partially doesn't work. Using chrome dev tools, I noticed that when the UI tries to access data, it looks for https://localhost:8090/blah/blah which gives no data (if I manually enter that URL into my browser and replace localhost with the server's hostname, I can access the data). What I think is going on is that the UI thinks localhost is my actual computer and not the server.
if I navigate to /etc/hosts on server side I noticed that localhost is there (although I don't understand the format, there's an IP on the left with another 3/4 columns of other data where localhost/local.domain etc is stated etc).
So it seems like I need to somehow 'link' these two localhosts together? Any advice on how I can move forward or build my knowledge in this specific field?
I've helped to build a UI for an application with the use of NPM/Node JS. The application stores data on a UNIX server. The UI accesses the data on the server (https://myhostname:8090/blah/blah) and presents the results with a nice UI. With the help of GIT, I've managed to do move all the src UI code onto the UNIX server. The purpose is for automation
While a specific file (in my UI code) specifies the UNIX server configuration, I've used NPM to build a bundle.js (Which bundles all the JS files into a single file) file. I move this bundles.js along with the index.html and CSS styling files to an appropriate directory in order to use Maven to build a JAR file. And with a start/stop server script to run the process to run the code, I can just enter the UNIX hostname/port number in my browser window in order to access the UI and data. This all works.
However. I now need to generalise the server configuration in my bundle.js file as well as properties file on server side such that I'm not hard coding server configuration anywhere (meaning I can deploy the UI on any server with no issue). i.e. playing with "localhost" instead of the actual server hostname etc.
I want to try my best, but I need to acknowledge that I have no real server configuration experience and hence need a little nudge in the right direction. Would someone be able to help me?
At the moment, I simply replaced the hostname with localhost in my bundle's configuration.
In a browser, when I enter the server hostname/port, this partially doesn't work. Using chrome dev tools, I noticed that when the UI tries to access data, it looks for https://localhost:8090/blah/blah which gives no data (if I manually enter that URL into my browser and replace localhost with the server's hostname, I can access the data). What I think is going on is that the UI thinks localhost is my actual computer and not the server.
if I navigate to /etc/hosts on server side I noticed that localhost is there (although I don't understand the format, there's an IP on the left with another 3/4 columns of other data where localhost/local.domain etc is stated etc).
So it seems like I need to somehow 'link' these two localhosts together? Any advice on how I can move forward or build my knowledge in this specific field?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Answer is provided, as well as background info.