Running a bash script in nodejs application deployed on amazon ECS - node.js

I have a nodejs application that is deployed on Amazon ECS. I have setup codepipeline to automatically build and deploy the application. The application is dockerized and is deployed on a ubuntu machine. The application is working fine. However, there is a requirement to run a shell script from within the application. I am calling the shell script using await exec(path/to/shellscript). However, I keep getting the following error:
2021-02-08 17:19:48FAILED: undefined, 4e9d8424-3cfd-4f35-93cb-fac886b1c4918fc9f680cfea45ec813db787f8b8380a
2021-02-08 17:19:48/bin/sh: src/myApp/myScript.bash: not found
I have tried giving it permission using chmod but I keep getting errors still.
Any help is appreciated.

I realized that the script that I am running calls an executable created to run on Ubuntu. However, the docker image is an alpine Linux distribution. The issue has been explained in detail here:
Why can't I run a C program built on alpine on ubuntu?

Related

Nodejs executing microvm with Vagrant : terminal simulation

Introduction
I am currently working on a Nodejs project to run a simulation of an Ubuntu terminal in a secure way.
To do this, I intend to use Vagrant in the NodeJs application to run a microVM and redirect outputs to the front page.
Problem
I don't know if the utilization of Vagrant it's a good solution, and how to do this.
Question
Do you have a solution for executing a microVM inside NodeJS application, and redirecting the outputs to a front web ?

Why do tutorials that dockerize Node.js require you to also install Node.js on the host?

What's the point of having Node.js and Vue.js installed on my host and then also getting a Node/Vue image for Docker? Every Vue.js tutorial says to install Node and Vue to the host first and then get the Docker image, is this not redundant?
Examples:
https://morioh.com/p/3021edac7ef1
https://jonathanmh.com/deploying-a-vue-js-single-page-app-including-router-with-docker/
https://mherman.org/blog/dockerizing-a-vue-app/
I'm using a Windows 10 host and was trying to avoid installing Node and Vue to Windows if possible, unless there are particular advantages to doing so, which hopefully someone can enumerate. Otherwise, maybe someone can confirm that it's redundant to also install Node/Vue on the host and state why it's silly and redundant.
Like you say, it is redundant but easier. A container is a running instance of an image, an image that was created (probably) using a Dockerfile with the instructions, so how would you go about doing everything from the container?
Would you add the creation of the app to the Dockerfile or would you connect to the container using bash and run the commands from there? If you connect with bash you'll lost everything once you remove the container. Once your app is created inside your container how would you get it out? I mean you need to write your app's code. You could store you data using docker volumes but that gets complicated depending were you are running Docker. For example on Mac a virtual machine is created for Docker, so to find that data you'll need to connect to the virtual machine...
It is just easier to do all of that from your local machine and use docker to host your app.

How to run React Web Application forever

I have created a web application using React framework. I am able to Run it in localhost using npm start command.
I have a server in AWS ubuntu 14.04. I have uploaded all code there and run the application using npm command. It is working well. But if i close the terminal then it has been stopped. I know we need to run that instance or service. But how can we do it forever without any UI of ubuntu?
Did you link the public directory's file(HTMl/PHP file) to your dedicated host server?
If not, Look to do how to setup it with AWS in local you can do it with virtual hosting. I'm sure in AWS there'll be any same way to do.
You can use a library called forever which will keep the process running in the background.
https://github.com/foreverjs/forever

confused about writing script for helloworld.js using node-windows in nodejs

I am using node-windows in nodejs to run my nodejs script as a windows service.
now let's suppose that my helloworld.js code is a simple command which creates a folder on desktop. how do I execute this code ??
because my service app starts successfully but it does not do anything at all. it creates no directories on desktop.
please help..
what error am I doing?

Unable to run query in Presto

I am installing presto for first time. I created a single ubuntu instance in amazon ec2 and installed all the dependences required to install presto. I followed https://github.com/facebook/presto .
I did git clone and got the source code then I ran $mvn clean install as per instruction. Then I ran $presto-cli/target/presto-cli-*-executable.jar. while executing query it is showing an error as shown in image below
Please help me in solving this. The same I want to try in cluster containing master and slaves.
while working with ec2 make sure that you have your own AMI, Keypair and security group.
It seems, your server is not running or is hosted on another port number.
Have you started the server using
./presto-server-x.x/bin/launcher.py start

Resources