Ani-theme on an empty EC2 RedHat instance

From AWS console, we will instance a new Red Hat instance as usual.

Next, i will show the main commands

My target is to run the Ani-theme template (with angular, bootstrap, etc) on this instance, and then, I would run a Docker instance

Let´s Start

First of all, I will install nodejs

$ curl -sL https://rpm.nodesource.com/setup_7.x | sudo bash -

$ sudo yum install -y nodejs

With sftp I copied the template zip file on the EC2 RedHat instance:

$ sudo yum install zip unzip -y

according to

The installation is:

But, we have the problem with “webpack: Failed to compile.”:

$ sudo ng serve

continue …
webpack: Failed to compile.

Fix #01: Is correct IP:PORT?

Let´s start another simple NodeJS app based on our previous post NodeJS on AWS

So, nodejs is working but the ani template don´t…

FIX #02: What the testing environment say?

$ ng test

we open karma on port 9876, but nothing happened:

Let´s install CHROME on ubuntu according to the following error message:

12 02 2017 18:59:25.318:INFO [launcher]: Starting browser Chrome

12 02 2017 18:59:25.322:ERROR [launcher]: No binary for Chrome browser on your platform.

Please, set “CHROME_BIN” env variable.

$ > google-chrome.repo

$ sudo cp /tmp/google-chrome.repo /etc/yum.repos.d/

$ yum info google-chrome-stable

$ sudo yum install google-chrome-stable

FIX #03: What the testing environment say (chrome installed)?

The problem

ERROR in ./src/app/signup/signup.component.scss

Module build failed: Error: ENOENT: no such file or directory, scandir ‘/home/ec2-user/mySoft/Ani-theme-angular2-bootstrap4/node_modules/node-sass/vendor’

the solution:

$ sudo npm rebuild node-sass

continue…

It looks ok … but … why still this page don´t work?

Problems:

In RedHat
Ubuntu
on PC Notebook works ok

The only reason why this work on notebook and this don´t work on EC2 instances from the free tier is that, on free tier the instances have 1GB of RAM versus 8 GB RAM from PC…. (wrong conclusion: see below, just set the host in ng serve -host 0.0.0.0 -port 4200)

.. what happening if we built the instance? Would it be faster? Would it be able to run?

It is too match for the angular instances: while angular is trying to running, on another windows is not able to run a simple command like “ls -la”

Solutions!

The last problem was that ng serve was config to let access to the angular only when it have http://localhost:4200/ so the app config don´t allow any other way like using an IP instead localhost

The simple solution was run the app in the following way

$ sudo ng serve -host 0.0.0.0 -port 4200

And now we can access to the app:

ubuntu_2
ubuntu_2
Ubuntu_2 working!

and in the EC2 redhat:

EC2 redhat
EC2 Redhat ok!

OK! the app runs ok!

Next: Building the instance

The command is

$ ng build — prod

I could build on PC and copy the “dist” folder to EC2 to run it on AWS…

I will be do it later…

End of the post

… so. I won´t use any theme template to make my Docker project on the free tier from AWS

… But, I would have simple angular projects on the free tier and play with Docker, Angular and The MEAN Stack

#cloud . #mobile ~} Sharing IT while learning It! ... Opinions are for my own