Showing posts with label Cloud Computing. Show all posts
Showing posts with label Cloud Computing. Show all posts

Friday, June 2, 2017

Magento Amazon SES - Transactional Emails Not Working with SMTP Pro

Recently in one of our project, we were using Amazon SES service with SMTP pro extension in Magento 1.9. After verification of domain and sender email address, when we to test in SMTP pro, it was working fine. But when we try to send transactional emails such as new order, invoice etc. It was not working. So on debugging we found following exception.

Email address is not verified. The following identities failed the check in region US-EAST-1: hdave10@gmail.com

Now that was bit strange as that raised a question that do we have to verify all the receiver email as well and that was practically not possible as in Magento we can have any number of customers. 

So I checked docs of Amazon SES and after reading for a while I got the issue. 

The issue was we have configured three regions in Amazon SES. But we were still in sandbox mode for two regions and mail was sending from the region where we were still running in sandbox mode. 

To solve this issue log in to your Amazon SES console and select region from top left corner.


Once you select region, Go to SES Sending Limits Increase case.

and submit for limit increase. It will take a while to process your request. Once your limit is increased, you will come out of sandbox mode. You have to do this process for all the regions.

Hope this helps you.

Wednesday, May 31, 2017

Amazon EC2 Create Swap Space

Hello,

Recently in one of my project we have laravel application deployed on amazon ec2 instance. When running composer update command, we were facing issue of swap space as it was not defined. So in this blog I will explain how you can create swap space in your amazon ec2 instance. Please note these steps are specifically for ubuntu instance. If you are running other version of liunx, please check commands first and then use it.

1) Create swap file

sudo fallocate -l 1G /swapfile

2) Verify it

ls -lh /swapfile

It should show following output.

-rw-r--r-- 1 root root 1.0G Apr 25 11:14 /swapfile

3) Enable it and make it accessible by only root user.

sudo chmod 600 /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile

That's it now you have swap space configured in your instance. 

Wednesday, December 28, 2016

Every Company Will be a Technology Company in 2017


Recently I was reading through some tech predictions of 2017 and one prediction caught my attention. It says.

Every Company Will be a Technology Company in 2017


It's very well said. Technology is growing and more and more businesses are adapting technology to grow. No matter what the business or company is, they are in need of more and more technical solutions to sustain in competition and grow the business. In 2011, Marc Andreesen famously wrote a Wall Street Journal essay declaring that “software is eating the world.” Five years later, the five largest companies in the world by market capitalization are all software companies. Today it doesn't matter what industry you are in, how large or small your company is, or where you company is located. Every single company today is a technology company. Whether you are a mining organization looking at automated trucks, a real estate firm deploying an internal social network, a warehouse looking to leverage wearable devices, an agricultural company exploring the internet of things, or a hospital interested in teaming up with IBM Watson, every single company today is a technology company and more companies will be technology company in 2017. 



Today in the era of technology people are becoming smart and at the same time they are becoming demanding in terms of services. You end users will expect and more and more services which can be easily available. They don't like to wait, it should be done immediately. They  want hassle free services. They don't want wait in queue on wait on phone call. If something can be done by sitting at home or through mobile phone, they will prefer it. Today in busy life nobody have time so everyone is looking for a solution and services that can save their time and money. So all the companies must have innovative technology solutions that can make their customer happy and for that they have to go for IT and technology solution. With technology solutions like Mobile Applications and Cloud based services it will be easy to server customer in real time and all the companies will be looking for such solution in 2017. If a company does not adopt technology solution, they may have to lose their customers in 2017. Every company in every industry, from agriculture, mining, and manufacturing to logistics, financial services, and healthcare, will become a technology company. Additionally, every technology company will need a CTO who has a deep understanding of the company’s technological infrastructure, software development, and support needs.



For companies to successfully make the transition and become a technology company, cultures need to change to take into account the unique way that software development works and to highlight the importance of technology and the people who manage and build it. They have to convince their customers about the technology they offer. We have seen certain example where a company wanted to become technology company and implemented IT solutions but it failed to convince customers to use it hence they failed to be technology company.  A company has to create technology driven culture within the company to be successful technology company. They have to hire and train staff to make them understand about technology. Companies need to move fast and adopt agile practices. The pace of technology adoption is getting faster and faster every year. For example, it took decades for electricity and telephones to reach 50% of US households, but today it takes only years for new technologies like smartphones and tablets to reach a majority of the population. To become a successful technology company, company has to invest in technology solutions and infrastructure with proper planning. They have to study market and hire consultants to give them proper directions and build a proper strategy of transformations. Off course this transformation will not be easy also it may end up in mess but a company has to do it. 

Conclusion


The race to become the market leader across a variety of sectors and geographies is speeding up so Every Company Will be a Technology Company in 2017

Saturday, January 2, 2016

Push Google Cloud Message (GCM) from PHP Web Application

In this blog I am going to explain how to push a Google Cloud Message (GCM) from PHP web application.

First of all you will need API key from your Google API account. Go to Google API console and add GCM t your API project and generate a key for Android.  This key you have to add in your PHP script.

Now add following function to your PHP script.

public function send_notification($registatoin_ids, $message) {
     
        // Set POST variables
        $url = 'https://android.googleapis.com/gcm/send';
        $apiKey = 'your_api_key';
     
        $fields = array(
            'registration_ids' => $registatoin_ids,
            'data' => $message,
        );

        $headers = array(
            'Authorization: key=' . $apiKey,
            'Content-Type: application/json'
        );
        // Open connection
        $ch = curl_init();

        // Set the url, number of POST vars, POST data
        curl_setopt($ch, CURLOPT_URL, $url);

        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        // Disabling SSL Certificate support temporarly
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));

        // Execute post
        $result = curl_exec($ch);
        if ($result === FALSE) {
            die('Curl failed: ' . curl_error($ch));
        }
     
        // Close connection
        curl_close($ch);
        return $result;
    }

As you can see above function takes registration id and message as param and use curl to send push message to particular device. Registration is is unique per device for all the android phones.

Wednesday, September 23, 2015

Upload File From Local Machine to Remote Server with SSH

Hello,

Recently while working on SSL on my Amazon EC 2 server I had to upload few certificates files from my local machine to EC 2 server. I had to spent some time to figure out this so thought of publishing blog on it so this may help others

First lets see how to upload file to remote server with permission on directory. We will use scp command for it. Following is the syntax.

$ scp /path/to/local/file sshuser@host:/path/to/remote/server

Once you run command it will prompt you for password. When you enter password it will upload file.

Now lets see what if you don't have password and have public or private key. Following is the command.

$ scp -i "yourkey" /path/to/local/file sshuser@host:/path/to/remote/server

If you have specified correct key it will upload your file.

Now here comes the real problem with EC 2. I was trying to upload crt file to system directory which was not allowed. So what you have to do is upload that file default ssh directory with following command

$ scp -i "yourkey" /path/to/local/file sshuser@host:filename

And then go to that directory. Usually in amazon EC 2. It's /home/ubntu directory. Then you can copy files from here using cp command with sudo.

I hope this helps you and dave your time.




Monday, September 14, 2015

Amazon EC2 File Upload Permission

Hello,

Recently in one of my project we hosted our PHP website on Amazon EC 2 which was running Apache on ubuntu. In our project we have file upload functionality which was not working. First I tired to set permission to 777 for the upload directory but still it was not working, so I went into details and found out this was the user permission issue. In this blog I am going to explain how to solve this.

Your website is running in Apache on Ubuntu. So there is a apache user, which is actually handling file operations. By default apache user does not have write permission and it does not own your website folder. So there are three basic steps to resolve this issue.

1) Find out your apache user.

Fist we have to find out name of apache user. Run following command in terminal.


ps -ef | grep apache

Check the left most column of the output. See the image below. That is name of your apache user.

In my case it was www-data user. 

2) Change directory owner to Apache user.

Change owner of your upload directory.

sudo chown www-data /var/www/html/uploads

3) Setup permission on your directory.

sudo chmod 755 /var/www/html/uploads

That's it. Now you can upload file from your web application. Hope this helps you and save your time.





Wednesday, May 4, 2011

Cloud Computing part-2 Windows Azure

Hello,

This is going to be theoretical blog. In my last blog on cloud computing I explained what exactly is cloud computing.  In this blog I will explain why one should go for cloud computing. Mostly it will be related to Microsoft Windows Azure .Recently I attended a Windows Azure Training Camp where speaker gave a good example of it.

First of all let's see how windows azure works. Cloud computing is all about virtulization. When you deploy your application on azure cloud your application is actually running on virtual machine. Here you can configure number of instance of application. For example if you set number of instances to three. Your application is running on three different virtual machine. Application load is automatically balanced between these virtual machines. You don't have to worry about anything. So this is how windows azure works. Now let's see an example on how windows azure can help you.

Consider you have created an application which consumes more server resources than any other application. Now initially you have 100 users of application. So you buy a server and deployed your application. You are happy, your users are happy too. Now number of users increase to say 1000. Now your single server can not fulfill requirements. Now your users are not happy. So you buy another server for load balancing. After some time again number of users increase and you have to buy another server. This is how you buy almost 20 servers. Each month you have to pay for those servers. Now suddenly number of users decrease and now you can run application only on 5 servers and this situation continues. So what about other 15 servers? Those servers are not utilized and are ideal and still you have to pay for each sever per month.

Now let's see power of Windows Azure. Consider same scenario as above with Windows Azure. Initially you application is running on tow instances. When number of users increase you simply have to increase number of instances. Now your application is running on 20 instances and you are paying for  20 instances per month. Now number of user decreases and you have to reset number of instances to 5. That's it now you don't need to pay for other 15 instances because you are not using it. You only have to pay for 5 instances that you are using.

So it gives you flexibility on number of instances of your application. Anytime you can change it and you have to only pay for the resources which are in use. So that's the power of cloud computing and windows azure.

Hope this posts help you. Being a programmer usually I don't like to write theoretical blogs but still it's necessary to write. Now next posts will be on examples windows azure.


Tuesday, September 14, 2010

Cloud Computing

I think everybody must have heard the word "CLOUD COMPUTING" now a days. So this blog is about little bit introduction about cloud computing and cloud computing platforms.

Wikipedia gives following definition of cloud computing.

"Cloud computing is internet-based computing, whereby shared resources, software, and information are provided to computers and other devices on demand, like the electricity grid."

That's a really good definition. Now a days cloud computing is the Buzz. Everybody is talking about it. Legends like Microsoft has invested heavily in cloud computing. So many companies are entering in to cloud computing business. CIOs/CTOs of any company want to bring Cloud Computing to their business. They are exploring options available for cloud computing platform. After cloud computing two new words are introduced.

SaaS: Software as a Service
PaaS: Platform as a Service

So what is this all about? Lets explore it in details. First of all lets talk about Cloud Computing. Why its been introduced? What was wrong with earlier approach? If you consider scenario before cloud computing , you have one server available. You use it for almost all your computing need. But the problem was CPU idle time. When server is busy with some request. It can not pay attention to other request. Also CPU is also in idle mode. What if we can utilize CPU idle time for other computing needs. But how we can do it? Then something called Virtualization is introduced. Yes this is the technology upon which cloud computing is built. My physical CPU is only one while I have more than one Virtual CPUs on top of it. Which can use my physical CPU. Virtual CPUs use almost all the real CPU cycle. Real CPU will never be in ideal mode.

So I have some hardware + software combinations which boost up my server performance. This is what is Virtualization. This is what is cloud computing. There are some large data centers in which bunch of servers are there. In those servers virtulazation is used so that each server can act as more than one server. This is the Magic of cloud computing.

Now lets talk about Cloud computing platforms available in market. There are various platforms available in market for cloud computing, but I will discuss about only two platform that I know.

As a former Microsoft .Net developer (although I am still passionate about .Net), first platform comes in my mind is Microsoft Windows Azure

Microsoft Windows Azure:

Microsoft definition for Windows Azure: "
The Windows Azure platform is a flexible cloud–computing platform that lets you focus on solving business problems and addressing customer needs."



Microsoft has invested heavily in data centers for Azure. Windows Azure is the platform using which one can develop cloud based application. If you want to develop .Net based application on local machine, you need certain things like .Net Framework,Sql Server, Windows server etc. This all provided by Windows Azure Platform in slightly different manner through App fabric, Sql Azure.

So in short It’s a platform for running Windows applications and storing their data in the cloud.

Its designed in a way that developer can develop cloud based application using various .Net supported languages like C#,VB.Net.

I will not go in more details as lots of stuff are available for windows azure on internet. Let's discuss the second cloud computing platform.

Salesforce:

Its a leading cloud platform now a days. Using it you can build your on demand internet application five time faster than any other app building platform. Its built on multi tenant architecture. It provides a very good interface to build business objects, and apps. Its service is composed of two main parts

1) appExchange Directory: market place to share your app
2) Force.com platform: This is the platform upon which applications are developed.

The language which is used to build the app is Apex Code. Force.com platform provides various features that makes easy to develop,maintain, publish and customize any app. Force.com platform have various features like multi tenancy that make its unique.

So this is the little bit introduction about cloud computing and cloud computing platforms. I will publish detailed blogs in future.