Deploying meteor.js app using `meteor` - node.js

I was thinking whether we can deploy Meteor.js app doing this:
curl https://install.meteor.com | /bin/sh
meteor create myApp
cd myApp
FTP app files into myApp directory
meteor

I assume you are trying to deploy to your own server. Therefore your need to create the bundle which you can them FTP and expand in your server/directory as follows:
create the bundle: meteor bundle myApp.tgz
FTP myApp.tgz into your server/directory.
Locate the uploaded tar file and extract it with the following command:
tar -zxvf nameofyourapp.tgz
Note: If the machine you developed the application is different than the machine you are deploying to, you will need to rebuild the native package. To do this, enter the bundle/programs/server/node_modules directory.
cd bundle/programs/server/node_modules
Once there remove the fibers directory
rm -r fibers
Rebuild fibers using npm:
npm install fibers
This will install the latest fibers version, specific to the platform you are deploying to.
Best regards,
Vince

Related

Is there an equivalent to java .war files for NPM?

Using gradle and java, I can build and publish (into a local repository) various versions. If a deployment has issues, I can reroll by deploying a prior version.
I can't find anything comparable for NPM applications, e.g. vue.
I foun npm pack which seems to build something that I can later install via npm install.
But I could not find out I then "run" the application. Are the any good documentations?
Thanks in advance.
Unline Jave Javascript doesn't compile into anything (because its interpreted). This means that all you need it the source code.
A basic node app source code will look something like this
main.js # entrypoint
packege.json # dependencies
src/ # application codebase
So if you like to create an artifact that can be deployed to a server you need only to download the dependencies (that's what the npm install is for) and that's it basically.
Now a node_module directory will be created
main.js # entrypoint
packege.json # dependencies
src/ # application codebase
node_module/ # dependencies codebase
You can run the application with node run main.js. But if you are creating an artifact you should bundle (zip) all the files and upload then to a file server (this will be the closest thing to .war in this flow)
You can now unzip and run the node application on a server that has NodeJS installed.

How to install and deploy node.js application?

I'm new to node.js. After creating modularized project with express, tests, .nvmrc etc. it's finally time to deploy the app. How it should be done? in java you bundle your project into a single file, self containing and you put in into a server with some configuration. what about node.js?
Should i just copy the whole directory with sources and node_modules to production machine and use systemd, pm2 or other process manager to just run it? but i heard some of the dependencies might be system-dependend so they may work incorrectly
or should i copy only sources and run npm install --production on the production machine? but this way the deployment is only possible when npm repositories are online. also it takes time to build the application and it has to be done on all machines in the cluster. also what about quickly rolling back to previous version in case there is some bug? again, time and online npm repos are needed
another option is to build a docker image. but it seems awkward that the only way to easily and safely deploy the app is using third party technology
how it's being done in real life scenarios?
sure don't copy the whole directory especially node_modules.
all the packages installed on your system should be installed with --save option example: npm install --save express if you do so you will have in your package.json the dependencies required for your project whether they are dev dependencies or production dependencies.
I don't know what your project structure looks like, but as a node application you have to run npm init . in your project to setup the package.json file and then you can start adding your dependencies with --save.
usually we use git
version control system
to deploy to the server, first we push our code to a git repository then we pull from it to the server git
you have to add .gitignore in your project and ignore node_modules from being committed to your git repository.
then you can pull to your server and run npm install on the server. and sure you need to launch your web server to serve your application example ngnix
you can try Heroku for an easy deployment, all you have to do is to setup your project with Heroku, and when you push your code, Heroku manages the deployment . Heroku

How to apply Node.js secuirty updates?

How to apply node.js security patches?
Is there a specific process to apply security patches when using meteor js on ubuntu 16.04?
When you're running meteor in production mode, it is run as a (pure) node.js app. So the short answer to your question is to just update node (depending on how you installed it; probably sudo apt-get update -y && sudo apt-get install nodejs -y).
There are a variety of tools you can use to deploy a meteor app (e.g. meteor-up), but all of them have essentially the same two steps, which are easy enough to do yourself:
Bundle your meteor app into a node.js app
meteor build ../my-build-output-folder --server https://my.production.site.url --architecture os.linux.x86_64
This will create a meteor-server.tar.gz file in the folder you specified, containing the node.js app. The process is then (as per the README file that is included in the bundle):
Transfer the meteor-server.tar.gz file to your server
tar -zxvf meteor-server.tar.gz to extract the node application
The included README file tells you the rest :
README:
This is a Meteor application bundle. It has only one external dependency:
Node.js v8.11.4. To run the application:
$ (cd programs/server && npm install)
$ export MONGO_URL='mongodb://user:password#host:port/databasename'
$ export ROOT_URL='http://example.com'
$ export MAIL_URL='smtp://user:password#mailhost:port/'
$ node main.js
Use the PORT environment variable to set the port where the
application will listen. The default is 80, but that will require
root on most systems.
Set up a system to survive restarts e.g. upstart , pm2, supervisord , or docker

Ember CLI ember new and ember init files not showing but buildable

I'm using ember v1.13.15, node: 5.4.1, npm 2.14.10 and os linux x64 (ubuntu). I'm actually trying to get ember-cli into my rails app. When executing ember new frontend I get the output that a bunch of files were created. These files don't show up in nautilus, terminal via ls nor can I cd into the directory. I manually typed mkdir frontend && cd frontend then ember init with the same results. If I run ember init again it recognizes the files are there because it asks me if I want to overwrite some files.
Running ember build produces a successful build, but where are the files?
Updated with terminal
uhoh#eblinux:~/Documents/apps/mvp$ cd frontendconsumer/
uhoh#eblinux:~/Documents/apps/mvp/frontendconsumer$ ls
uhoh#eblinux:~/Documents/apps/mvp/frontendconsumer$ ember init
version: 1.13.15
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/user-guide/#watchman for more info.
installing app
identical .bowerrc
identical .editorconfig
identical .ember-cli
identical .jshintrc
identical .travis.yml
identical .watchmanconfig
identical README.md
identical app/app.js
identical app/index.html
identical app/router.js
identical app/templates/application.hbs
identical bower.json
identical config/environment.js
identical ember-cli-build.js
identical .gitignore
identical package.json
identical public/crossdomain.xml
identical public/robots.txt
identical testem.json
identical tests/.jshintrc
identical tests/helpers/destroy-app.js
identical tests/helpers/module-for-acceptance.js
identical tests/helpers/resolver.js
identical tests/helpers/start-app.js
identical tests/index.html
identical tests/test-helper.js
Installed packages for tooling via npm.
Installed browser packages via Bower.
uhoh#eblinux:~/Documents/apps/mvp/frontendconsumer$ ls
uhoh#eblinux:~/Documents/apps/mvp/frontendconsumer$ ls -a
. ..
Update v2
uhoh#eblinux:~/Documents/apps/mvp/frontendconsumer$ locate test-helper.js --all
/home/uhoh/Documents/apps/integration/node_modules/jshint/node_modules/htmlparser2/test/test-helper.js
/home/uhoh/Documents/apps/newapp/node_modules/jshint/node_modules/htmlparser2/test/test-helper.js
/home/uhoh/Documents/apps/vd-integrations/test/test-helper.js
/home/uhoh/Downloads/ace1.3.1/mustache/js/node_modules/htmlparser2/tests/test-helper.js
/home/uhoh/Downloads/ace1_3.0/mustache/js/node_modules/htmlparser2/tests/test-helper.js
/home/uhoh/Downloads/ace3/mustache/js/node_modules/htmlparser2/tests/test-helper.js
/home/uhoh/consumer_frontend/node_modules/ember-cli/blueprints/app/files/tests/test-helper.js
/home/uhoh/consumer_frontend/node_modules/ember-cli-babel/tests/test-helper.js
/home/uhoh/consumer_frontend/node_modules/ember-cli-content-security-policy/tests/test-helper.js
/home/uhoh/consumer_frontend/node_modules/ember-cli-qunit/node_modules/broccoli-jshint/node_modules/jshint/node_modules/htmlparser2/test/test-helper.js
I am unable to comment, so instead I will offer you two main options:
Uninstall all ember related packages and push node to 5.6.0 and npm to 3.6.0 (the version that I using.)
npm uninstall -g ember-cli
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Install Ember and the needed packages, confirm version of node and npm and try to create the project.
Probe the files on the frontendconsumer folder:
Typesyncand see if something shows up on Nautilus.
Use locate test-helper.js -c or locate any other file that was supposed to be there. If the result is 0 then give the other locate params a try.
Type baobab and see if something shows up on the folder.
If nothing yet, then try find -type l to see if there are any symbolic links.
Run a checkdisk on your hard drive.
If none of those options helped, then something really weird is going when scaffolding the new application... If there is no other issues on your system, try to create a rails app through RVM to see if the scaffold of a new app works out. If it does, then chances are that something within npm, node or the ember packages are bad. Otherwise, it may be your system.

how can I open web application requiring node.js

I must run micro-crawler https://github.com/WebMole/Micro-Crawler which is a crawler web application, that run with node.js.
I could not figure out how to open this app, I download node.js, and when I write install npm and install bower to the node.js command line nothing happened. Also I did not understand how to start web applicaion after installations
Please help me
Finally I solved the issue
First, I install node.js, then move node.js folder to wampserver directory,
and move the web sites files in the node.js directory
Second, I go to the path where node.js is from command line, then enter "install npm" command
line
The error appeared in this phase for solving I create a npm
folder in c:users/user_name_of_your_computer/app_data/roaming then I installed git and enter the directories of bin and cmd files of git to the system enviroments/path
Third I enter the commands "bower install" and "npm install -g grunt-cli" from the comand. from the path of where node.js is
and the micro-crawler works
Did you execute your .js file? You can do that with node.js cli thus:
path/to/your/file: node file.js
This is a good reference:
How to run a hello.js file in Node.js on windows?

Resources