Friday, January 8, 2016

Node.js running on Amazon EC2

Recently Amazon introduced t2.nano instances and I want to try if it is possible to run node.js application on this low cost instances.

Create Amazon EC2 instance

Login to Amazon AWS console and create new EC2 instance. I wanted to check if it is possible to use ultra low cost t2.nano. I also used default option Amazon Linux.

Be sure that in Step 6 Security Group you will allow to connect using HTTP and HTTPS from anywhere and SSH from your IP (or another IPs you use).

TypeProtocolPort RangeSource
HTTPTCP800.0.0.0/0
HTTPSTCP4430.0.0.0/0
If you will forget, you can do in later in NETWORK & SECURITY / Security Groups (Inbound tab).

Optional - Go to INSTANCES /Instances and click on newly created instance.  Set the name - e.g. node.js test.

Next attach public IP to instance - NETWORK & SECURITY / Elastic IPs / Allocate new Address. Then use this IP as public IP for the new instance. Right click on new IP and select Associate Address. In instance field attach newly created instance. 

Go back to INSTANCES /Instances and click on newly created instance and right click on it and select Connect. Follow the instructions and connect to your instance using SSH.


Update yum (sudo yum update) and install node.js.

Instructions:
https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora

TLDR:
Run as root on RHEL, CentOS or Fedora, for Node.js v4 LTS Argon:

curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -

yum install -y nodejs 

EPEL info:
https://aws.amazon.com/amazon-linux-ami/faqs/

TLDR:
Q: How do I enable the Extra Packages for Enterprise Linux (EPEL) repository?

Modify /etc/yum.repos.d/epel.repo. Under the section marked [epel] , change enabled=0 to enabled=1.


Verify installation:

Run on instance:
# node -v
v4.2.4

Create Node.js application


TLDR:
$ npm install express-generator -g
$ express testec2 

Initialize
cd testec2 && npm install

Set port 80
vi app.js

At the end add
app.listen(80, function () {
  console.log('Example app listening on port 80!');
})

Start application
npm start

Type public IP to browser and see default nodejs/express application


Run on background

Use forever

TLDR:
[sudo] npm install forever -g
[sudo] npm install forever-monitor
forever start app.js

List of background:
forever list
Stop running app:
forever stopall
or 
forever stop ID


Thursday, April 30, 2015

Aliases to simplify android development

Recently I added some aliases to bash
(I use Ubuntu : gedit ~/.bashrc )

I added aliases for assemble release, assemble debug and adb install -r

alias ar='./gradlew aR'
alias ad='./gradlew aDeb'

alias ainst='function _ainst(){ adb install -r $1;};_ainst'

Now i can simply build release using ar, and the install it on device using ainst:

Example:
ainst app-flav1-release-1.0-build1.apk

Saturday, January 3, 2015

How to install Postgresql 9.4 with extensions on Ubuntu 14.04

Just by notes, byt maybe this will help to someone...

Install postgress
sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update
sudo apt-get install postgresql-9.4 pgadmin3

Install extensions
sudo apt-get install postgresql-contrib

Restart postgresql
sudo /etc/init.d/postgresql reload


Show available extensions
sudo su - postgres
psql
SELECT * FROM pg_available_extensions;

Importing dumps
Getting error: Peer authentication failed for user “postgres” when importing dump
see:
http://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge


Sunday, October 26, 2014

PRESS RELEASE: Enjoy watching NFL 2014 with Football Glossary

Football Glossary is Android application developed for easy displaying of information about penalties, scores, types of players, interactive info about formations and many more. It contains 100+ entries, info about NFL teams and NFL 2014 Schedule.

Football Glossary provides for a quick search, and in device,  which comprises it, vocal search as well. Just say e.g. „illegal formation“ and immediately you get the meaning of the definition, how many yards the penalty is, etc. Consequently, Football Glossary offers web links for more information. Some questions include also pictures which promptly illustrate the given definition. At penalties Referee signal is shown as well. You can also watch related YouTube videos.

Users who took part in testing Football Glossary application acknowledged simplicity and lucidity. They appreciate highly that the application displays a short definition concurrently with the possibility to show more web information about.com, wikipedia.org and suchlike. Users were captured mainly by the possibility to make use of the vocal search,YouTube videos and NFL Schedule.


Google Play Store:
Football Glossary

Football Glossary PRO (Ad Free)
https://play.google.com/store/apps/details?id=com.shoopshoop.nflguide