I have a CI server which handle to build the node app. It's separated. And once the build is done I want to deploy my node app to the production server. But I have to deploy the node modules as well.
Ofcourse I can run npm install command on the remote server, but it makes the production server to "work" on something that is else of serving the app.
How can I deploy nodejs bundle to production server without bringing all of the node modules, but just a prepared bundle?
Is this possible?
Related
I want to deploy a Node.js app on another server, I have set it up Jenkins in one server and but I need to deploy the Node.js app on another server by using the pm2 service.
I'm able to login into the server from the Jenkins with the command ssh root#servername (servername is the server which I want to deploy), and I have configured the git access and when I run the build command in Jenkins it is cloning the code in Jenkins server itself, but I want to connect to the server and then clone the code and install dependencies and start the Node.js app from pm2 in another server.
It may be trivial question but I need to be sure. I have made node/express app with redis connected as a cache manager. All works fine in dev environment. But how to run this in prod? I'm deploying it on Heroku. On development I'm installing redis with brew package menager, then installing it redis client with npm. How can I set up/mimic this process on remote server on production, f.ex. Heroku?
Use Heroku Redis or RedisCloud provided as addons on heroku.By cost redis cloud may be efficient but I would recommend using heroku Redis as aquarium you can connect and execute all command via cli.
I currently a web app involving a Vue.js frontend with a Flask backend acting as a REST API. They are divided into the client and server folders in my repo, respectively. I am looking to deploy it to Heroku via the Github deployment feature but am running into some errors and questions I need clarified.
All code can be found in this Github Repo: https://github.com/justintranjt/thrive-test
In development, I have been running the application like so:
In one terminal run thriveApp.py. In another terminal run npm run dev. Navigate to localhost:8080 which is the local server running
the Vue.js application.
Is this how the application will be run on Heroku? Or is the Vue application run using npm run build? In that case I would have to take the produced build folder and serve it in the Flask application, correct?
In addition, some of my links between the frontend and backend specify localhost:8080 and localhost:5000 (8080 is Vue and 5000 is Flask) which work locally. But will this work when deployed to Heroku?
<b-form>
<b-button variant="primary" href="http://localhost:5000/loginPage">Login via CAS</b-button>
</b-form>
As you can see here, I have a button in my Vue application that links to a login page routed by my Flask application. Will I have to change the portion of the URL that says localhost:5000 when running on Heroku?
Finally, When I currently try to build the application on Heroku only the Python portion of the code is recognized as modules from the Vue app specified by package.json are not installed while plugins for Python specified by requirements.txt ARE installed by Heroku.
I have a feeling all of these questions are generally related to each other. Any other advice or tips regarding Heroku deployment would also be helpful as I'm quite confused about deployment at the moment.
Is this how the application will be run on Heroku?
No! npm run dev spins up an entire development server with vue in dev mode and hot reloading. That's a lot of overhead, especially when it comes to file sizes.
Or is the Vue application run using npm run build?
Kind of. Vue doesn't need to run on your server at all, it's all client-side. npm run build bundles and minifies your files to a dist folder, you'll be left with only html, css and javascript - this is all of the frontend code that needs to be on your production environment - no need to deploy any of the source files. All you need to do is serve those static files from any server. This could be done by your flask, or just any apache, nginx etc.
But will this work when deployed to Heroku?
That will be very tricky to setup. It's one of the reasons why I would not deploy front- and backend on the same (virtual) server.
modules from the Vue app specified by package.json are not installed
If you deploy your bundled frontend instead of the source code this wont be an issue anymore. I still recommend serving the frontend from a different environment.
I have a mobile (Ionic 2) chat application with the following implementation, that uses nodejs-0.10 and MongoDB 3.2.7 and Meteor 1.4.1.1. It works perfectly on my localhost.
Now I need to deploy it to an OpenShift server. I have followed the following steps and created a server on OpenShift with Meteor. It is connecting with Git, and I can push my code to the server.
I am pretty sure the Meteor server is running on OpenShift, because I saw something to that effect on the startup logs (via ssh). However, I am not sure how to connect to the Meteor server to test it.
The domain is nodejs-easyjobs.rhcloud.com (54.208.77.250) on the OpenShift server, I can ping this successfully.
I am using Ionic 2 to build the mobile app. I am currently just running on Android, but plan to add iOS and Windows.
I am following this tutorial, and it runs on localhost. However, I am not sure where this is configured. I guess localhost is default, and you need to change it to a different host if needs be.
If I check my OpenShift server (nodejs-easyjobs.rhcloud.com) via ssh, I can see that the contents of the Meteor bundle directory is on the server. So Git is pushing the code.
The part I don't understand is:
Do I need to configure Meteor differently for being on the OpenShift
Server? Or do I just leave it as is?
Where do I configure the client
(Ionic 2) to point to the OpenShift server?
Question:
My question is, how do I configure my mobile app (Ionic 2) to connect to the OpenShift Meteor Server?
UPDATE:
My dir structure:
openshift-appname
.../ionic-apps/nodejs/bundle/server/...
meteorapp
.../ionic-aps/myIonicApp/api/.meteor/...
.../ionic-aps/myIonicApp/api/server/...
The contents of the .../ionic-apps/nodejs is cloned on the OpenShift server with Git.
I followed this tutorial to deploy the Meteor bundle to OpenShift. `
So I used the following to build my Meteor app:
> cd .../ionic-aps/myIonicApp/
> meteor build .../ionic-apps/nodejs --directory --server-only
As far as I can see, I may be wrong, but the Meteor Server is all correct and running on OpenShift. I need to know how I can get my Ionic2 app to access it.
Step1: Find the access point to the Meteor server using the OpenShift
IP. i.e. nodejs-easyjobs.rhcloud.com (54.208.77.250).
Step2: Configure my Ionic2 client to use this.
Hi I developed a small application in nodeJs and angular using the angular-fullstack generator for grunt, following the instruction on: https://npmjs.org/package/generator-angular-fullstack, when I finished the developement run:
3) yo angular-fullstack:deploy heroku
4) cd heroku && git push heroku master
my application now is on heroku and the dynos starts, but when I visit the domain where heroku put my application: http://dollsdresses-gnosis.herokuapp.com/
I can see that some files are missing: main.css, script.js , all I can see is a white page with my favicon, when I use my application on my computer, running: grunt server, it works, so I think there is something that I do not know or do wrong on deploying on heroku.
You may not have added main.css, script.js et al to git, so they are not pushed to Heroku when you run git push heroku master. Make sure to git add them.