Tuesday, February 24, 2015

How to add users to your AWS EC2 Linux instance

Do you need to add more users to your AWS EC2 Linux instance? This is a step-by-step tutorial to guide you through the basic process.

1) Open a terminal session and navigate to the path where you have your-key-pair.pem file

2) Type the following command in order to extract the public key from your key pair
ssh-keygen -y -f your-key-pair.pem
3) You will get as a response a string like the one below. Copy it to your clipboard.
ssh-rsa AAAAB3NzaC1yVh0/ThkcfO479gFjMUVw48D2Pi4u0P+0lvP0tpzKcZ/nwnzhFIDyUHsVKMN0F97DCoPQEbk5jmyHRSBok+cuEXAMPLEt1VI7TLSAwWZj5aRedb+awFDLxBgS8SN/nvsaP4+KY8uGum10YV83/wGNZjYEVRLg9NjyDbuVERYFAKEhscyZAbWTMw2t30JELizxyXZx4s4OImfS4yOCnDLFgHFf3JUjGhTUg1O+10I3V2TB3j63166AEB+98JizrRtwJ85AUN/wmMD0V2YIiEaa2rMLbdGZw8lSlPakV3bedx+8NYf+s2+SLwB
4) Login with your ec2-user to your instance, as usual.
ssh -i your-key-pair.pem ec2-user@yourawspublicip
5) Create a Linux user account on the EC2 instance
sudo adduser username
6) OPTIONAL: Only if you want to give this user sudo access, do the following:
  • Switch to root: sudo su -
  • Open sudo config file: visudo
  • Add this line to the commands section: username  ALL=(ALL)  NOPASSWD:ALL

7) Switch to the user you have just created
sudo su - username
8) Create a .ssh directory
mkdir .ssh
9) Change permissions of this directory
chmod 700 .ssh
10) Create a new file authorized_keys in this directory and paste the public key that you have on your clipboard. Make sure that it doesn't miss the first letter.
vi .ssh/authorized_keys
11) Change permissions of this file
chmod 600 .ssh/authorized_keys
12) Send your-key-pair.pem file to the new user. She will be able to connect to the EC2 instance running the following command from the same folder where she has placed your-key-pair.pem file.
ssh -i your-key-pair.pem username@yourawspublicip
13) If thy get public key error, make sure they give the right permissions to your-key-pair.pem.
    chmod 600 your-key-pair.pem

Saturday, February 7, 2015

How to prevent your Heroku dyno from going to sleep

If you are using a free Heroku web dyno, you might have already noticed that sometimes it takes too long to load your website. The reason is that single 1X or 2X web dynos go to sleep after one hour of inactivity. This causes a few second delay for the first request. However, subsequent requests should perform normally.

In order to prevent this, you can do the following:

1) Install Heroku Scheduler free add-on (heroku addons:add scheduler:standard)
2) From your Heroku Scheduler dashboard, add a new job with these details:
- Task: $ curl -I http://YOURAPPNAME.herokuapp.com
- Dyno size: 1X
- Frequency: Every 10 minutes
3) Save the changes
That's it! Heroku Scheduler will send a "keep awake" signal to your app every 10 minutes, so that it won't fall asleep.

Important: Heroku Scheduler runs one-off dynos that will count towards your dyno-hours for the month and you might be charged for extra usage.

Friday, February 6, 2015

How to transform a website into a desktop app

If you want to have immediate access to your favorite sites in an app-like way, you can use Google Chrome's Create desktop shortcut feature.

It enables you to create within seconds a shortcut of a website, that will be placed on your desktop or applications menu. Just to be clear, this is not a real app, but a desktop shortcut to Chrome's viewer, hiding the browser bars, so it does look like an app. The shortcut icon will be the website's favicon.ico image.

In order to create your own desktop shortcut on any operating system supporting Google Chrome (Windows, Ubuntu,...) you can do the following:

1) Open your target website on Google Chrome
2) Click on Chrome's menu (top-right corner)
3) Go to More tools and Create application shortcuts
4) Tick on the kind(s) of shortcuts you want to create
5) Click on Create

This is how it looks for arturocalvo.com on Ubuntu 14.04:

Monday, February 2, 2015

Multitasking in Scrum teams

Let me invite you to perform the following exercise taken from Essential Scrum (Kenneth S. Rubin). Grab a piece of paper and a pencil, draw two identical tables as shown in the figure below, and complete them with two different strategies: row-at-a-time (a, 1, i, b, 2, ii, c, 3, iii, ...) and column-at-at-time (a, b, ..., j, 1, 2, ..., 10, i, ii, ..., x). Don't forget to time yourself!
The average results are 35 seconds for the row-at-a-time table, and 16 seconds for the column-at-a-time table. In addition, the first table has more chances to have errors.

The first table represents multitasking, where we are continuously switching from one task (column) to another, while the second table is single tasking (we don't start with the next column until we have completed the previous one).

The meaning of this experiment is that working on too many items at the same time involves a high level of over-head. Similarly, working on too few items at the same time is also wasteful, leading to idle workers and less value being delivered during the sprint. Finding the balance is not always easy, and it requires several sprints in order to determine the optimal workload for each team member.

The same applies at a project level. In this chart taken from the same book (extremely recommended for people interested in Agile and Scrum frameworks), we can see how the team members' performance decreases when they are involved in more than three projects at the same time.
When we are working on two projects, the time that we spend doing value-adding work is often the highest. The reason is that we can get blocked on one project but we still can switch to the other one.

However, with more than two projects our productivity falls because you cannot be fully committed to so many teams, and commitment (and not involvement) is one of the keys to success on Scrum teams. In the figure below we can see the difference between committed team members and involved ones.