Can we containerize an electron app using docker? - node.js

Currently, I have developed a desktop application using electron JS, and I am using electron-store to save user preference. And these prefernce are being saved in a config.json file inside the C:/Users/<user>/AppData/Roaming/<applicationName>/config.json
I wonder if I have containerized my electron app using docker:
Would I face any issues related to storage or anything else?
Would I be able to run the app normally?
Would I be able to run the GUI of the electron app?

Related

How can I convert a Node Js web application to a desktop application?

I have created a Node js Web application which is running on an express server. It is a web automation application which is made using puppeteer. I want this app to run in headful mode which is not possible if I deploy this on servers (for eg Heroku). So instead of deploying this application,I wanted to create a desktop app which runs this application on the local host everytime. Is there any way to convert this web application to a desktop application and run it on local host through the desktop app only?
Your best bet would be using Electron.
It is used for cross-platform apps with Nodejs and interacts like website, so you wouldn't need to rebuilt your app from scratch.

Can I use node 'child_process' in a React App?

I'm building a native app with React (I plan to use it inside Electron.js later), and I need to run some local scripts and other things which are common in a native app.
This is easy with NodeJS and it's back-end abilities, but even if mine is not a web app, it seems I just can't use Node with React.
Is using 'web-like' requests and messages, even so it's a local app, the only way to do this?
If your app is running in a browser, you will not be able to use child_process or any other node goodies like that.
Electron uses a browser, but is managed by a node process, so you will have access to all node functions: https://ourcodeworld.com/articles/read/106/how-to-choose-read-save-delete-or-create-a-file-with-electron-framework

Reactjs + Electron + Nodejs

I've been researching for long time but haven't found what I need. Maybe here someone can help me out.
What I want:
I'm trying to create an application that will run inside electron. Both frontend and backend should be encapsulated within a single executable, so I was thinking React js and Nodejs would be a good option.
But it's not as simple as I thought. Found a good boilerplace for reactjs https://github.com/electron-react-boilerplate/electron-react-boilerplate but I have no idea how I could encapsulate nodejs as a backend to it.
It'd also somehow would need to be integrated with the release package and so on...
Additionally I'd need to have a webserver that will run on localhost:[port] when you launch the application.
Technical Summary:
So basically:
Electron with React js - as the application 'face'
Nodejs - as the backend of the application
Webserver running locally - (using react js).
In the application, I would put link to the pages that is served by that locally running reactjs web app.
Hope I was clear. And I really hope someone can help me out.
Thanks!!!
as you know the serverside part is separate from front end.you can lunch react electron together like this article https://flaviocopes.com/react-electron/ .but serverside must start to stand alone . you could use pm2 for launching them.http://pm2.keymetrics.io/
lets talk about electron. what is electron?
according to electronjs.org :
Electron is an open source library developed by GitHub for building
cross-platform desktop applications with HTML, CSS, and JavaScript.
Electron accomplishes this by combining Chromium and Node.js into a
single runtime and apps can be packaged for Mac, Windows, and Linux.
so the electron is a tool for creating desktop applications.it uses chromium engine for accessing resources of the operating system level. but the intention of that is creating apps not a serverside job.
if you have some needs and logics that must handle in a server you should be considering that. otherwise, read about serverless applications.

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.

how to deploy nodejs rest api with express framework on production server windows

I have created a node.js rest api created using express framework for routing. I have used tutorial
Now I want to deploy that rest api on actual production server. How to achieve that thing.
I have gone through below links.
Deploy node js application with express framework on production mode --- Only for linux. I need for windows.
Deploying NodeJs Express Rest API to Windows 10 IoT -- a little bit similar problem but no solution
https://stackoverflow.com/a/38652869/2810015 -- this said to run npm start on production server after copying all of the files on server. But this is not working fine either.
Any help will be highly useful.
You use pm2?
Usually I use it to start the application. It works for both windows and linux. He leaves the service initated, and in case something happens that knocks the service up again.
You install it on the server, and instead of using it
node server.js
You use the command below
pm2 server.js start
Link: http://pm2.keymetrics.io/docs/advanced/pm2-module-system/

Resources