0

I have a problem integrating Jenkins and OpenLiteSpeed. The configuration is such that Jenkins is connected to GitLab and when a change is made to GitLab he pulls the changes and needs to build a project. The project consists of two parts frontend and backend (they are separate projects on gitLab) that run on different ports (83 and 84) which I set up in OpenLiteSpeed ​​where I have 2 virtual hosts and 2 listers. I looked up the instructions on the internet and set everything up as said. Jenkins builds an app and reports that everything is fine but it happens that he builds an old app and there are no changes I have made. When I look in the File System I see that the changes are included but in the browser they are not. I thought it might be up to the cache but the same thing happens in incognito mode. Then I don't know how to set my backend to start the server on localhost: 3000 after construction? I am not sure what is the best way to have backend and frontend on the same server. Is this the wrong way to use OpenLiteSpeed with a different port, is there any better way to do this? Oh, the project is made with NodeJS - React. Also, the frontend connects successfully with the backend on my PC but on my Linux server, it won't. Thank you in advance.

rtstorm
  • 339
  • 1
  • 4
  • 16
  • And i forgot to mention that i use freestyle project’s in Jenkins dont know if this is problem – rtstorm Aug 16 '21 at 11:49
  • May I know if a reboot makes any change in your case? And for the two virtual hosts, did you set for document root only, or did you set any app server or proxy web server in each? – Eric Aug 17 '21 at 00:27
  • For the front end, I set up to root build/src/index.html but for the backend, I set it like some app server in OpenLiteSpeed but I do not know if that works. the front end won't connect to the backend. And when I run the backend server manualy it will start on localhost:3000 but my backend is set up on port 84 in OpenLiteSpeed, this confuses me. – rtstorm Aug 17 '21 at 07:38
  • 1
    If you have set a proxy, then you only need to contact through port 84 to the backend. If you have App Server context, then no need to start localhost:3000. See https://openlitespeed.org/kb/running-node-js-apps-with-openlitespeed/. Did you try the server reboot yet? does it makes any different? – Eric Aug 18 '21 at 02:50
  • The server restart did not help. I try to set up context (i did not that I can do it that way) and now it worked. But I do not understand why is it working now. The server.js script on my local machine runs at localhost:3000 and on my server I access the backend through port 84, this is confusing to me. – rtstorm Aug 18 '21 at 08:46
  • I found when i run manually in terminal on my server {NODE_ENV=local node server.js} server is started on port 3000 and the app is working. But the problem is how to set it up so OpenLiteSpeed run this server.js and keep it running. – rtstorm Aug 20 '21 at 10:37
  • To let OLS serve the server.js and you don't want to run service at port 3000 in the backend, then you need to go with app server method. When request goes to the OLS, it will serve with the application server, in the KB, it will just return "Hello World form node js app.js" – Eric Aug 24 '21 at 06:33
  • 1
    I see, I try to install PM2 and set to start script that will keep it running. This is the only way to have it running all the time. don't know if this is the best way but it is working. – rtstorm Aug 25 '21 at 08:30

0 Answers0