Reference
- install 2 vm ubuntu 14 LTS (https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-magento-on-ubuntu-14-04)
- web open port 80 & 22
- db : open port 22 & 3306
- web : (reference https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04)
- sudo apt-get update
- sudo apt-get install apache2 (apache/2.4.7)
- sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
- sudo nano /etc/apache2/mods-enabled/dir.conf
- sudo service apache2 restart
- sudo apt-get install php5-cli
- sudo nano /etc/apache2/sites-available/magento.conf
- sudo a2ensite magento.conf
- sudo a2dissite 000-default.conf
- sudo apt-get install libcurl3 php5-curl php5-gd php5-mcrypt
- sudo a2enmod rewrite
- sudo php5enmod mcrypt
- cd ~ && wget http://www.magentocommerce.com/downloads/assets/1.9.0.1/magento-1.9.0.1.tar.gz
- tar xzvf magento-1.9.0.1.tar.gz
- sudo rsync -avP ~/magento/. /var/www/html/
- sudo chown -R www-data:www-data /var/www/html/
- sudo apt-get install mysql-client
- apt-get install php5-mysql
- db :
- sudo apt-get update
- sudo apt-get install mysql-server
- sudo mysql_install_db
- mysql -u root -p
- CREATE DATABASE magento;
- CREATE USER 'mangento2'@'localhost' IDENTIFIED BY 'password';
- GRANT ALL PRIVILEGES ON *.* TO 'mangento2'@'localhost' WITH GRANT OPTION;
- CREATE USER 'mangento2'@'%' IDENTIFIED BY 'password';
- GRANT ALL PRIVILEGES ON *.* TO 'mangento2'@'%' WITH GRANT OPTION;
- FLUSH PRIVILEGES;
- exit;
- sudo nano /etc/mysql/my.cnf (Bind address 0.0.0.0)
- mysqld --help --verbose
- Install ubuntu 14.04 LTS
- Install apache2
- install php
- unzip the shopping in web root
- Change the config file
Chef :
CloudFormation Template:
- install aws command line tools
- $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
$ unzip awscli-bundle.zip
$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws - aws cloudformation create-stack --stack-name myteststack2 --template-body file://///Projects/cc/cf/shop.json
- aws cloudformation delete-stack --stack-name myteststack2
Chef + cloudformation
Setting up chef
Vagrant:
- vagrant box add win81 http://aka.ms/vagrant-win81-ie11
Mac Setup
$ brew tap caskroom/cask
$ brew install brew-cask
$ brew cask install google-chrome
$ brew update && brew upgrade brew-cask && brew cleanup
$ brew install brew-cask
$ brew cask install google-chrome
$ brew update && brew upgrade brew-cask && brew cleanup
- brew cask install virtualbox
- brew cask install vagrant
- brew cask install vagrant-manager
- vagrant box add precise64 http://files.vagrantup.com/precise64.box
- vagrant init precise64
- vagrant up
- vagrant ssh
- vagrant halt
- mkdir -p ~/chef/cookbooks/helloworld/recipes
$ echo '
file "/tmp/helloworld.txt" do
owner "ubuntu"
group "ubuntu"
mode 00544
action :create
content "Hello, Implementor!"
end' > ~/chef/cookbooks/helloworld/recipes/default.rb - echo '
{
"run_list": [ "recipe[helloworld]" ]
}' > ~/chef/node.json - echo '
file_cache_path "/home/vagrant/chef"
cookbook_path "/home/vagrant/chef/cookbooks"
json_attribs "/home/vagrant/chef/node.json"
' > ~/chef/solo.rb
RUBY
//setting up chefdk for Ruby
- brew install chruby
- brew install ruby-install
- ruby-install ruby 2.2
Chef DK
install chef & Ruby
- brew cask install virtualbox
- brew cask install vagrant
- brew cask install vagrant-manager
- brew cask install chefdk
- vagrant plugin install vagrant-berkshelf
- vagrant plugin install vagrant-omnibus
- vagrant plugin install vagrant-chef-zero
- vagrant plugin install vagrant-vbguest
Good one
VBoxManage dhcpserver remove --netname HostInterfaceNetworking-vboxnet0
brew cask install sublime-text
Test app:
https://box.scotch.io/ (this works)
https://github.com/r-baker/simple-magento-vagrant (this works)
good one
Performance & Scalability:
Tools
- FastCGI
Reference Architecture
VPC:
AWS re:Invent 2014 | (SDD422) Amazon VPC Deep Dive
VPC Security
Network ACL : Stateless lives on network level, outbound and inbound rules need to be specified
Security Group : Stateful default outbound rules are allowed
3 Security Groups
DB security groups,
VPC security groups, and
EC2 security groups
cd /etc/apache2/site-enabled
NAT Instance
DB Subnet Groups
RDS Essentials
Cloud Deployment Steps:
1.
|
Mysql Setup
| |
2.
|
Create webserver
| |
3.
|
scp the zip file extract and run machine-init script
| |
Magento Install
sudo apt-get install -y ssh
sudo apt-get install -y apache2
sudo apt-get install -y php5 libapache2-mod-php5
sudo apt-get install -y php5-mysqlnd php5-curl php5-gd php5-intl php-pear php5-imap php5-mcrypt php5-ming
sudo apt-get install -y php5-ps php5-pspell php5-snmp php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl php-soap
VPC:
Building A Non-Default VPC
Database:
Load test on DB
Best Practice
- Have a subnet block that does not overlap with local network
- VPC for Dev,Stage,Prod (VPC peering)
- Security
- Firewall Virtual appliance
- VM encryption
Subnet
172.16.0.0/16
Concerns 6/17
Action Item
| ||
Cost
|
2 Compute + 1 DB + Data transfer Cost
db.m3.xlarge- 4vCPU, 15 GiB RAM
Store 100 GB
IOPS : 1000
|
Sriram
|
Security
|
VPC (Virtual private Cloud)
| |
Performance
|
will load test, and publish the results
| |
App Scalability
| ||
Db Scalability
|
https://www.scalebase.com/, Scale up, Read Replicas
| |
Data Recovery
|
we will do daily backup of db in our DS
| |
Exit Strategy
|
will have 1 Prod instance running in our DS
| |
Data that are stored in magento
| ||
DNS
Deployment
BOTO
Shopping Cloud Setup:
Reference:
X
|
Build for Prod
|
X
|
Setup VPC
|
X
|
Setup SSL
|
X
|
Setup Mail
|
Password protected page
| |
X
|
Basic load test
|
X
|
Fast CGI ?
|
X
|
NGNIX + FAST CGI
|
X
|
Disable XDebug
|
X
|
JS minification
|
X
|
install n98
|
Debug : capture all http traffic
| |
X
|
Move Sessions and Caching to Redis
|
remove public ip address access
| |
remove public access on S3
| |
NFS and S3
| |
Prime all the pages for resize Images
| |
X
|
Security Check
|
X
|
Add reindexing cron job
|
X
|
Create Roles for CC and Product Team
|
X
|
PHP Page Complilation
|
X
|
Full page cache
|
X
|
replace mysql with aurora
|
X
|
IAM Role for S3 Bucket
|
X
|
CDN
|
Cloudfront Hosting (Stretch)
| |
X
|
Database Tuning
|
Flat Tables
| |
X
|
Smoke Test
|
X
|
Capacity Test
|
X
|
Load Test
|
Endurance testing
| |
X
|
Auto Scaling test
|
Failover Testing web
| |
Failover Testing DB
| |
DR Testing
| |
X
|
Backup Testing
|
Security Testing
| |
Cleanup
| |
Garbage Collection
| |
Setup AWS alarms
| |
SSL certificate
| |
X
|
build for Load testing
|
Re-configure AWS Production (VPC, Subnets, Routing, etc.)
| |
FOR HIGH LOAD: Set DB instance to db.m1.xlarge (or another type with high memory) and run a query to increase InnoDB Buffer Pool Size to 10GB (or 60 - 70% of total memory)
| |
X
|
Add expires header to content hosted in s3
|