Post by pradeepn » Tue Jul 19, 2011 10:04 pm

First thanks for a great software. OpenCart looks clean, fast and easy to setup.

I wanted to hear any experience deploying OpenCart to Amazon EC2.
I want to design this for scalability for future, though initially I will have only web instane and a database instance.
In future I would like to be able to add additional web instances.
In order to scale to multiple web front end I have to share the web root for OpenCart.
I am looking to see what directories defined in the config.php (both root and admin) that I should keep local to an instance and what directories I need to share across all instance. My initial assumption is the directories that get written to i.e. image uploads and download directories, needs to be shared while others that don't persist anything such as cache, catalog, system, language, config etc. can be local. (I am planning to share only the highlighted ones to be shared). Appreciate if anyone can validate this assumption.


define('DIR_APPLICATION', '/var/www/catalog/');
define('DIR_SYSTEM', '/var/www/system/');
define('DIR_DATABASE', '/var/www/system/database/');
define('DIR_LANGUAGE', '/var/www/catalog/language/');
define('DIR_TEMPLATE', '/var/www/catalog/view/theme/');
define('DIR_CONFIG', '/var/www/system/config/');
define('DIR_IMAGE', '/var/www/image/');
define('DIR_CACHE', '/var/www/system/cache/');
define('DIR_DOWNLOAD', '/var/www/download/');
define('DIR_LOGS', '/var/www/system/logs/');

I would love to hear any other caveats with multiple web instances that I need to be aware of.
Any suggestions and pointers on using memcache for performance would also be appreciated.
Thanks in advance.

Newbie

Posts

Joined
Fri Jul 08, 2011 9:12 am

Post by pradeepn » Sun Jul 31, 2011 9:44 pm

Some update from my end.. I finally deployed OpenCart 1.5.1 into Amazon EC2. I shared the web root using the NFS so that my new launched web instances can share the web root. The only directories I kept local to the web instances were the cache and log directories.

A short summary of the deployment

1. Single Amazon RDB instance hosting the database. Initial size set to 5GB.
2. Single primary Web instance (LAMP stack) and running NFS server.
- Use a separate EBS (elastic block storage with initial 15GB size) with Linux LVM (logical volume manager) for the web root folder. Using LVM will allow increasing the storage later easily when required. This device is shared using NFS.
- Install OpenCart on this instance with the web root set to the NFS mounted device
- This instance will initially act as the primary web instance, however this instance can be re-purposed to act as just the NFS server hosting the web root later when launching scalable web instances.

3. Create a clone of the above instance web instance without the additional EBS storage device, and remove the nfs server. Set this instance to mount the web root folder to the NFS server instance instead. Note the cloning allows us to re-use the already installed Open Cart installation.
- Create an AMI (Amazon Machine Image) with the above cloned and modified instance.
- New web instances can be easily launched on demand to scale horizontally
4. An elastic load balancer in front of the web instances does the load balancing

Scaling is achieved via the following:

1. Add more web instances for horizontal scaling as demand and traffic grows
2. Increase the Amazon RDB instance storage size as database grows when required
3. Add additional Elastic Block Storage (EBS) to the NFS server instance when web root storage requirement grows (esp. when adding images for product and categories).
4. Move to higher compute and memory for each instance as needed


I would like see if anyone has any recommendation on using the memcache for caching in Opencart.

If anyone need more specifics and have additional questions let me know.

Cheers

Newbie

Posts

Joined
Fri Jul 08, 2011 9:12 am

Post by psutinrerk » Tue Sep 20, 2011 12:58 pm

Hello, I'm very new to Opencart and I want to do the same way as you did with amazon ec2, could you please explain in step by step for me please

Thank you

Newbie

Posts

Joined
Tue Sep 20, 2011 12:57 pm

Post by pradeepn » Wed Oct 05, 2011 11:53 pm

Sorry for the delayed response...

Here are some tips and hints from my experience deploying Opencart into Amazon EC2.

I noticed during my deployment to Amazon EC2 using a ELB (Elastic Load Balancer) I could not use HTTP and HTTPS together. There was some issue with certain pages especially image uploads etc. and pages that used jquery would not work when switching from HTTP to HTTPS and vice versa. As a workaround I have to run my store in full HTTPS mode. The HTTPS was terminated at the Elastic load balancer. The Web Server themselves were running in HTTP mode. Amazon Web Services have some recent enhancements where you can do HTTPS between ELB and the web server also. Running HTTPS on the web server will require more horsepower and you may need to opt for a larger instance with more CPU. I noticed that running the web server with HTTPS on the small instance was very compute intensive and made response really slow.

Another thing I saw was the remote address of the client is not captured properly when behind the elastic load balancer. I had to patch code using vqmod to get the forwarded for address to get the remote client IP address that is used when sending order confirmation e-mails.

When designing for high scalability, typically we need multiple web servers. This means we need to share the www root directory across all the web servers. In Amazon EC2 this necessitated either using a dedicated instances as an NFS server that would host the www root directory and multiple web servers as nfs client and acting as web front end for your store. You will need to make sure the elastic load balancer uses sticky session, so that requests from a single client always goes to the same webs server.

I ended up using a primary web server which acted as an NFS server also. My deployment design consisted of adding additional web servers depending on the load, sharing the www root folder via NFS client. I used a separate EBS volume (Elastic Block Storage) for my www root folder. This design gives me flexibility to increase the EBS size as needed when my store grows with more images and product, at the same time adding additional web servers as the client users grow. I used a separate instance - RDS (Relationa Data Store) instance for my MYSQL database. So essentially my plan is to start out with two instances -

1. Primary Web server instance with NFS server exporting the www root folder. This instance used an EBS volume of around 20GB, that can be expanded later on demand.
2. RDS instance to host my MYSQL database with initial size of 5GB that can also be expanded on demand later as my database grows

Additional web server instances were cloned from (1) and kept ready. This additional web server instance shared the www root folder with the primary web server instance via the NFS client.

I also have an elastic load balancer in from of the web server instance this way I can load balance the requests when I have multiple web servers.

Graphically speaking

Amazon ELB ---->> Primary Web Server 1 with NFS Server hosting attached EBS Volume --------->>> RDS MYSQL
---->> Additional Web Server 2 with NFS Client (clone of 1 without EBS volumen---->>>
---->> Additional Web Server 3 with NFS Client (clone of 2)---------------------------->>>
----->> .... scale as needed.....



Hope this helps

Newbie

Posts

Joined
Fri Jul 08, 2011 9:12 am

Post by jordan » Thu Nov 03, 2011 3:56 am

Pradeep,

Thanks for the post, I am looking to do something similar. If you are sharing the web-root over NFS, doesn't the NFS server now become a single point of failure? Any workarounds to this?

What happens if each web server runs their own local web-root and then on cron each webserver pulls images from S3 and pushes logs to S3 every so often to sync itself with S3, where S3 acts as the 'central repository' for non-DB data? I have not tried this yet, but maybe you have so would love to get your feedback.

Thanks,
Jordan

The Veloz Group
Beverly Hills Chairs: The leaders in ergonomic seating
Custom Tobacco: Customized cigars for any occasion


New member

Posts

Joined
Fri Sep 23, 2011 3:55 pm

Post by vhaggle » Thu Dec 31, 2015 3:30 am

Hi Pradeep/Jordan,

Do you have any further details on successfully running the OpenCart on Amazon AWS with scalability?. Please share the successful setup details, appreciate if you can share the deployment diagram. I also readh about AWS BeanStalk, did you guys try this?

Thanks
Venkat

Newbie

Posts

Joined
Thu Dec 31, 2015 3:27 am

Post by azazqadir » Thu Mar 31, 2016 6:49 pm

vhaggle wrote:Hi Pradeep/Jordan,

Do you have any further details on successfully running the OpenCart on Amazon AWS with scalability?. Please share the successful setup details, appreciate if you can share the deployment diagram. I also readh about AWS BeanStalk, did you guys try this?

Thanks
Venkat
Here is guide I found for installing OpenCart on cloud: http://www.cloudways.com/blog/how-to-in ... art-2-ssh/

If you are using this platform then you only need to click on AWS icon in their dashboard to select AWS hosting. This guide has step by step instructions, so there shouldn't be any confusion. As for scalability, this platform has dashboard where there is a slider that you can use to easily scale up or down the the server size or storage size.

Newbie

Posts

Joined
Thu Mar 31, 2016 6:41 pm

Post by LongerVogue » Wed May 02, 2018 11:24 pm

Install opencart in AWS is not difficult. Anyone has migrated opencart to AWS. Any ideas where to upload or set up database.

New member

Posts

Joined
Sat Mar 24, 2018 8:24 pm

Post by LongerVogue » Fri May 04, 2018 5:06 pm

pradeepn wrote:
Sun Jul 31, 2011 9:44 pm
Some update from my end.. I finally deployed OpenCart 1.5.1 into Amazon EC2. I shared the web root using the NFS so that my new launched web instances can share the web root. The only directories I kept local to the web instances were the cache and log directories.

A short summary of the deployment

1. Single Amazon RDB instance hosting the database. Initial size set to 5GB.
2. Single primary Web instance (LAMP stack) and running NFS server.
- Use a separate EBS (elastic block storage with initial 15GB size) with Linux LVM (logical volume manager) for the web root folder. Using LVM will allow increasing the storage later easily when required. This device is shared using NFS.
- Install OpenCart on this instance with the web root set to the NFS mounted device
- This instance will initially act as the primary web instance, however this instance can be re-purposed to act as just the NFS server hosting the web root later when launching scalable web instances.

3. Create a clone of the above instance web instance without the additional EBS storage device, and remove the nfs server. Set this instance to mount the web root folder to the NFS server instance instead. Note the cloning allows us to re-use the already installed Open Cart installation.
- Create an AMI (Amazon Machine Image) with the above cloned and modified instance.
- New web instances can be easily launched on demand to scale horizontally
4. An elastic load balancer in front of the web instances does the load balancing

Scaling is achieved via the following:

1. Add more web instances for horizontal scaling as demand and traffic grows
2. Increase the Amazon RDB instance storage size as database grows when required
3. Add additional Elastic Block Storage (EBS) to the NFS server instance when web root storage requirement grows (esp. when adding images for product and categories).
4. Move to higher compute and memory for each instance as needed


I would like see if anyone has any recommendation on using the memcache for caching in Opencart.

If anyone need more specifics and have additional questions let me know.

Cheers
May I know how you migrate opencart to AWS. Where to restore files and create database.

New member

Posts

Joined
Sat Mar 24, 2018 8:24 pm

Post by webocreation.com » Thu Dec 17, 2020 12:58 pm

Just created this post so it may be helpful to whoever is hosting the Opencart in AWS

Blog free tips and tricks
Free extensions
OpenCart Tutorials
OpenCart Tutorials Youtube Video for developers


User avatar
New member

Posts

Joined
Fri Feb 02, 2018 11:51 pm
Who is online

Users browsing this forum: No registered users and 36 guests