Deploying Express JS Server With Functions That Use Selenium WebDriver - node.js

I am a building an Express JS Server where some (at least 1) route uses Selenium to perform specific actions on another website in a browser. For example, I have a route: mywebsite.com/api/login that route should open a Selenium instance on Google Chrome that logs in to a specific website (e.g. anotherwebsite.com).
What is the best way to achieve this and which method or service can provide such service for Free for development and/or cheap. As well as being cheap for production.
Thank you!

You can develop own your own machine for free. Either Express.js or Selenium is FOSS. To host for production you can find any Linux VPS provider that runs Node.js. DigitalOcean, Vultr or Linode would be the more affordable option.

Related

What is the recommended way to run a react app and a node js backend in the same container using cloud run

I would like to containerize a react app and node js backend API, that's currently running on a GCE VM. The majority of the information that's available online leads me to believe that I need to deploy them as separate containers to Cloud Run. However as Martin points out in the video - https://www.youtube.com/watch?v=WHH7eQLbG_s - Simplify your web apps on Google Cloud Run, that one could you use Cloud Run itself.
Is this possible and if so, is there any info. available online relating to this
Cloud Run can export only one port. Therefore, if you want to expose 2 different things (i.e. the frontend and the backend), you need to have a unique entrypoint.
You can wrap your static pages in your NodeJS backend server, or package, in your container, a NGINX server that will route to the react app the request to the static content, and to the nodeJS backend, the backend request.
About the Martin's video, you can also read my comments. It's better to deploy 2 different stuffs and to put a Load Balancer in front of both (similar to your NGINX in fact, but decoupled and therefore more scalable and easier to update). I personally recommend App Engine Standard for the static content (because serving that content is processing free, and the cheapest!), and cloud run for the backend.

Running flask application without command prompt

I have been developing a dashboard based on the Python Flask. I am in the verge of my work. After completing my work, I don't know how to host my flask application in the production server. To be clear, I want my user need not to run the flask application in command prompt, then type the URL in the browser to see the dashboard. I want users of the dashboard have to type the URL only in the browser to see the dashboard.
It's important for you to know the basics of flask. It's is a framework to serve web applications. So, you need to host a web application...
You can host it on your lan network or you can host it on a dedicated server on the web. You can use heroku(https://devcenter.heroku.com/articles/getting-started-with-python) to host your app for free (he free plan has a lot of limitations). Heroku has support for some RDMS like postgres. Note that heroku free plan is not supposed to be used as a production server!
I suppose that you've been using the embbed flask server(dev server) that is NOT production ready, for that you should be looking to use gunicorn or some wsgi server.
If you want to deploy to your client`s server you'll need a reverse proxy(NGINX,Apache2), a WSGI server(GUNICORN,uWSGI...), your app in it and some more. But if you do not know what you are doing, maybe you need to talk to a sysadmin, since you'll need to manager the server.
Check this guide of how to do it.
hope it helps!

How to build a Node.js application with web hosting service?

Is it possible to build a node application with a web hosting service, such as blue host, godaddy or media temple? Or does it need to be on a hosting site such as Heroku or Back4App? If so where do I start to learn how to do this?
"Web hosting" is a pretty broad term, but typically you're going to see static HTML, and some hosted PHP, and a few other technologies. It's atypical to see Node.js application hosting as part of a general web hosting package. The reason is that you're going to want more control over the environment in which it runs.
That gives you a couple general classes of options:
Virtual or Dedicated Hosting
Having a VPS instance, or even a full machine if you can afford it, gives you full access to the OS and what you install on it. This means you can run whatever you want, including Node.js. You can get very cheap VPS hosting.
Node.js Application Hosting
This is the sort of service you get with Heroku or on AWS Elastic Beanstalk. Your application more directly integrates with the hosting provider, allowing you to take advantage of some of their automation and deployment tooling. If you need to do any automatic scaling, this is your best option.
You can try one of this five:
RedHat OpenShift
Nodejitsu
Microsoft Azure (don't!, well... try if you want to)
Modulus
Heroku (my fauvorite)
You can see details of each one here! But I would start with heroku app, but it's your choice
To get started with heroku
Godaddy does allow nodejs as part of its "web hosting" offering:
https://www.godaddy.com/pro/one-click-installation/node-js
That said, I really recommend Heroku and similar services for having less upsell and letting you work closer to cruft-free.

Deploy a MEAN stack application to an existing server

I have a Ubuntu Server on DigitalOcean which hosts a website, and a Windows Server on AWS which hosts another website.
I just built a mean.js stack app on my MAC, and I plan to deploy it to production.
It seems that most of the existing threads discuss about using a new dedicated server. For example, this thread is about deploying on a new AWS EC2 instance; this video is about deploying on a new Windows Azure server; this is to create a new droplet in DigitalOcean.
My question is, is it possible to use an existing server (which hosts other websites), rather than creating a new server? If yes, will there be any difference in terms of performance?
My question is, is it possible to use an existing server (which hosts other websites), rather than creating a new server?
Yes. Both Windows and Ubuntu allows you to deploy multiple applications on same instance.
For Ubuntu you can read this post which will help you server multiple apps.
In this example used Nginx, but you can follow to this example and use it without any server like Apache or Nginx. If you need subdomains I would suggest to use Apache virtual hosts with reverse proxy module and pm2
For Windows and its IIS I would suggest to use iisnode, in google you can find a lot of articles how to configure it.
will there be any difference in terms of performance?
It is depended on your applications, if you are already serving applications which handles huge traffic and need CPU and memory, I would not suggest you to use multiple apps on same instance, but if you are going to use simple web apps, you can easily use same instance.
Hope this answer will help you!

How can I use my host, a regular dream host acct as a node server?

I've tried some methods online using ssh but can't figure it out. why is it so difficult to install when it's basically just Javascript?
A regular Dreamhost account will not allow a long running process which a node server is. You will need a VPS account.
Also, the node application and V8 engine inside it is not just javascript. It's an actual native application. Your scripts are "just javascript", but the infrastructure that makes the node server run is native code.
In 2015, Dreamhost started to support the deployment of nodejs (as well as ruby, python) applications through the Passenger domain option. For more information on Passenger, check Node.js with Passenger tutorial.
Unfortunately, this is available only on VPS running Unbuntu.
Note that on the Dreamhost wiki, under Nodejs, they write
DreamHost does not support node.js on shared web servers, as the security setup on DreamHost shared servers is incompatible with compiling or running node.js. If you try to compile node.js on one of the shared web servers, your user will automatically be banned through grsec (taking down all the php websites that run under that user) and the server will have to be rebooted before your user can be unbanned. If you do it one more time, you will be forced to move to a VPS.

Resources