Hyperledger Fabric Node SDK - node.js

Is it possible to develop the node SDK part of a Hyperledger Fabric project with a microservice Nodejs project or with a simple Nodejs project?

It is better to at least start the development of a Node.js project as something that can run from the command line line. Fixing errors and viewing log output will be easier. I presume that for a microservice, you will run it as a docker container which will listen on some port for activity. All of this can be done first as a standalone Node.js project. Once developed and tested, just create the docker image and then run it.

Related

How to run multiple nodejs version on a single server?

I want to run multiple NodeJs versions on a single system.
For EX:- I have two nodejs apps. One app are running nodejs version 10.xx.xx and another one is running nodejs version 12.xx.xx.
here I want to move both apps on a single server.
how is it possible..??
Package each app using Docker Container then each app will have his own nodeJS version without issues because of the isolation.
You'll find official nodeJS continer in here https://hub.docker.com/_/node/

Is there a 'deployer' native node js equivalent of Meteor's MeteorUp

Deploy Meteor apps is simple with MUP. The key feature here is that it has a docker implementation which is very useful and my team uses this a lot.
Now I'm doing a native express.js app but I can't find nothing similliar to MUP where I just need to set the config file and done. I just find weird that there is not a 'deploy manager' for native node.js apps;
I've checked PM2, almost gets the job done, but can's send directly to the docker image.
Thanks.

Deploying React & Node.JS as a service Linux Ubuntu 14

Have a Node.Js API and a React app semi finished. Working on deploying to get the development cycle churning. Currently using npm start for viewing the react server during development. Same for the Node API. When deployed to AWS EC2 I am building in the most basic fashion, npm build pushing to a 'release' folder.
Once the deploy folder is up, I can go into it and run serve -s release
This gets me up and running. I can do the same for api server.
To get the apps running as a service, for the api, I can see how I can build a systemd process and run that with no issue.
For the react app, is there an easy way to run that server as a system... I'm new to this stack, so I might be confused. I have read in some places that once you've built your react app that you need to serve it out via apache or nginx? (e.g. in development it hosts itself, in production, you need to serve it) Is that sort of the general idea - build with local hosting, deploy with a production webhost?
Help appreciated. This is my last major issue before I can get Jenkins running a nice pipeline for deployment. Thanks!
Since you are already running a NodeJs server, It would be a good idea to host your ReactJs App in the NodeJs App itself.
You can pipline in the Jenkins to Build the ReactJs App first and the move it to static serving folder in the server and then you just need to deploy the NodeJs app in which ever environment that you want.

Best way to implement Angular Universal

I suffer a lot in the past with angular apps and social media, so I'm glad to see that Angular Universal is being developed.
Currently I have some apps that are Angular4 as front end, and Java with Spring as backend. As far as I know there are some ways to implement Angular Universal here but they seem pretty complex (at least is what I read). So I want to know if that is in that way or not...
But anyway, my main question here, is because I saw that in order to implement Angular Universal we should have (ideally) to make the backend with nodejs, how to structure these two technologies, I mean... Should I have Angular app as a frontend app and Nodejs app as a totally different backend app (just like Java) where both are connected with web services? Or should I served Angular4 SPA direcly from Nodejs views?
And where should I place Angular Universal here?
Now that Angular CLI v1.6 is out, there's native support for building Angular Universal into your projects easily using Node.js! Essentially, you would ng build --prod to create a dist/ folder, and then create a simple node back-end and connect to your dist/ folder containing your front-end code. This article gives a great step-by-step guide: Angular server-side rendering in Node with Express Universal Engine.
When you use Angular Universal, it is going to be a single process (Operating system process) that hosts and serves your Angular pages.
In production you may have multiple such processes behind a load-balancer.
Your back-end APIs (if developed in Javascript) may be hosted in the same Node server or in separate server.
The Angular Universal setup steps are detailed here in the official documentation.
However, I had a few wasted hours to find out the following point
Webpack 3 is not compatible with ts-loader versions higher than 3.5.0. At the time of developing this, the latest version of Angular CLI is 1.7.2 which uses Webpack 3.*. Hence, while setting up Angular Universal, install ts-config#3.5.0
Finally, here I have a seed project for Angular Universal. It uses Vagrant to locally setup the development environment. Also, by tweaking an environment variable in your local host machine, you can run it in a production mode in a Docker container. The steps to run it are detailed in the readme file.
If you refer to my Dockerfile in the above Github link, its entrypoint reads:
ENTRYPOINT ["pm2-runtime","start","/home/aus/dist/server.js"]
So, you see, it's just a singe command, and your app is up and running at port 4000. Of course you can use other command line parameters to provide memory limit, port and so on.

Push code to remote Docker

I have a GitLab repository in which I have a node.js app with express, I want "deploy" this code to my Ubuntu Server to use the express server remotely and not only local, but I don't want install node.js instead I want try use Docker.
I have read a lot about Docker, and I had understood the fundamental thing. My question is this, if I install Docker on my Ubuntu Server, how can I "deploy" my code on Docker when I push in my repository?
Basically, you have to divide the process in two steps. One is dockerizing your app, which means creating a Docker image for your repository. The second step is having your server use this image, possibly automating the process on push. So I would do something like this:
Dockerize your app. This means having a Dockerfile where you create an image that contains your app, runs it and possibly exports a port to use it externally.
Run the image in your server. Your server will need to have docker installed, and be able to get the right image (more on this later). If only one image is being used, you can just use a simple docker run command. If there are more parts involved, such as a database or a webserver, I would recommend using docker-compose.
Make the image available on your server. You have more than one option here. You can publish your image to a docker repository (private or public), or you can just download the repository in your server, and build the image there.
Lastly, you need to bind these steps. For that you need a hook that reacts on commits to the server, where you send a command to the server to fetch/build the image, and run the newer version.
You have a lot of flexibility on how to do this, actually. I would start with a simpler process, where you build the image on your server, and build on top of that according to your needs.
Dokku is a Docker based PaaS platform that provides git push deployments. It supports Heroku buildpacks to build an run your application or custom Dockerfile deployments.

Resources