Difference between revisions of "Installation"

From Whirlwind eCommerce Wiki
Jump to: navigation, search
(Email DNS Settings: completed 'first' section)
(Web Server Setup: added LimitRequestFieldSize 50000 LimitRequestLine 50000)
 
(5 intermediate revisions by 2 users not shown)
Line 16: Line 16:
 
*Select Read and Run scripts. Next. Finish.
 
*Select Read and Run scripts. Next. Finish.
 
;Linux Apache 2+
 
;Linux Apache 2+
 +
*For URL Maps (SEO friendly URLs) set up the 404 interecept code in a .htaccess file in the root of your website:
 +
    <IfModule mod_rewrite.c>
 +
      RewriteEngine On
 +
      RewriteBase /
 +
      RewriteCond %{REQUEST_FILENAME} !-f
 +
      RewriteCond %{REQUEST_FILENAME} !-d
 +
      RewriteRule . /index.php [L]
 +
    </IfModule>
 +
*To make sure the .htaccess file is usable, find the AllowOverride parameter in your httpd.conf file for the website's directory and set it to:
 +
    AllowOverride FileInfo Options
 
*Open /etc/httpd/conf/httpd.conf
 
*Open /etc/httpd/conf/httpd.conf
 
*Add the following 404 error document line (remove the existing one first, if present) - this sets the index.php as the default 404 error document which will kick in url_map/title page access when appropriate.
 
*Add the following 404 error document line (remove the existing one first, if present) - this sets the index.php as the default 404 error document which will kick in url_map/title page access when appropriate.
Line 27: Line 37:
 
*Add the following directoryIndex line (remove the existing one first, if present)
 
*Add the following directoryIndex line (remove the existing one first, if present)
 
;;;DirectoryIndex index.php
 
;;;DirectoryIndex index.php
 +
*Add the following directory control to ensure file upload directory does not turn into a hacker playground:
 +
 +
    <Directory "/var/www/html/whirlwind/files">
 +
      php_admin_flag engine off
 +
      AllowOverride None
 +
      DirectoryIndex Off
 +
      RewriteEngine On
 +
      RewriteRule \.php$ - [F,L]
 +
    </Directory>
 +
*Add the following lines to httpd.conf to ensure long URLs dont cause an error (often relationship calls with many connections exceed the default value):
 +
 +
    LimitRequestFieldSize 50000
 +
    LimitRequestLine 50000
  
 
==Setup DNS==
 
==Setup DNS==
Line 123: Line 146:
 
*ft_min_word_len: defaults to 4 but most clients will want 3 characters min search word length. NOTE THIS MUST APPEAR BELOW [MySQLd] in the my.ini/cnf file OR IT WILL NOT WORK
 
*ft_min_word_len: defaults to 4 but most clients will want 3 characters min search word length. NOTE THIS MUST APPEAR BELOW [MySQLd] in the my.ini/cnf file OR IT WILL NOT WORK
 
::ft_min_word_len=3
 
::ft_min_word_len=3
 +
*split ibdata file from one HUGE file to one for each table - since the file does not shrink, this will make it easier for dump and recover to maintain the file sizes
 +
::innodb_file_per_table
  
 
*NOTE: memory=key_buffer+(sort_buffer_size+read_buffer_size)*max_connections
 
*NOTE: memory=key_buffer+(sort_buffer_size+read_buffer_size)*max_connections

Latest revision as of 16:35, 8 November 2013

Currently building automated installation package.

Below is the manual process until the package is operational.

File Upload

FTP The entire site file content to the target root of the web site

Web Server Setup

Windows IIS
  • Open 'computer management' (right click 'my computer' and select manage)
  • Expand Computer Management > Services and Applications > Internet Information Services > Web Sites
  • Right click 'Web Sites' and select 'New Web Site'. When the 'Web Site Creation Wizard' opens, click 'Next'.
  • Enter the site name (use a test subdomain if you do not want to interrupt a site currently using the domain i.e.: test.yourdomain.com instead of www.yourdomain.com). Next.
  • Set the IP address to that given by your Hosting ISP (ask you ISP if you do not know what that is), leave TCP port to 80 and set Host Header to the domain/subdomain you selected in the previous step. Next.
  • In the Path field browse to the folder you FTPd all the site files too, than hit OK. Leave allow anonymous access to this website on. Next.
  • Select Read and Run scripts. Next. Finish.
Linux Apache 2+
  • For URL Maps (SEO friendly URLs) set up the 404 interecept code in a .htaccess file in the root of your website:
   <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteBase /
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule . /index.php [L]
   </IfModule>
  • To make sure the .htaccess file is usable, find the AllowOverride parameter in your httpd.conf file for the website's directory and set it to:
   AllowOverride FileInfo Options
  • Open /etc/httpd/conf/httpd.conf
  • Add the following 404 error document line (remove the existing one first, if present) - this sets the index.php as the default 404 error document which will kick in url_map/title page access when appropriate.
ErrorDocument 404 /index.php
  • Add the following documentRoot line (remove the existing one first, if present)
DocumentRoot /path/to/your/website
where "/path/to/your/website" is the absolute path from the root of the server drive to the folder containing the website. Usually "/var/www/html/www.yoursitedomain.com" where yoursitedomain is the domain name of your site.
  • Modify the <Directory> tag value to:
<Directory "/path/to/your/website">
where "/path/to/your/website" is the absolute path from the root of the server drive to the folder containing the website. Usually "/var/www/html/www.yoursitedomain.com" where yoursitedomain is the domain name of your site.
  • Add the following directoryIndex line (remove the existing one first, if present)
DirectoryIndex index.php
  • Add the following directory control to ensure file upload directory does not turn into a hacker playground:
   <Directory "/var/www/html/whirlwind/files">
     php_admin_flag engine off
     AllowOverride None
     DirectoryIndex Off
     RewriteEngine On
     RewriteRule \.php$ - [F,L]
   </Directory>
  • Add the following lines to httpd.conf to ensure long URLs dont cause an error (often relationship calls with many connections exceed the default value):
   LimitRequestFieldSize 50000
   LimitRequestLine 50000

Setup DNS

Call your Hosting ISP for specific instructions on how to set up DNS for your web site. You can setup your local HOSTS file (located in c:\windows\system32\drivers\etc on a windows client) so that your web browser will resolve the domain to the web server until DNS is set and propigated. Follow instructions in the HOSTS file to add a line for your domain / web server IP address.

Database Setup

  • NOTE: If on linux you find you cannot create databases (err 103), it's most likely a permissions issue, run the following shell command in linux:
chown mysql\
mysql /var/lib/mysql
  • Backup the latest database version at the commend prompt in windows / shell in linux: (substitute m.d.y with current month.day.year; substitute "username" with the root user name):
mysqldump -u username -p iproductsbase > iproductsbase.m.d.y.sql
  • FTP the backup to the new server
  • Create the database on the new server in mysql (substitute "databasename" with the name you wish to call the database):
Create database databasename;
  • move the files into the database at the command prompt in windows / shell in linux (substitute "databasename" for the newly create database name; substitute 'username' for the root user; substitute "m.d.y" for the month.day.year in the iproductsbase backup file name):
mysql -u username -p databasename < iproductsbase.m.d.y.sql
  • Create a database user account with the appropriate access in mysql (substitute "newusername" with your website database username you wish; substitute "databasename" with the name of the database you created for the site; substitute "password" with your password of choice):
GRANT CREATE TEMPORARY TABLES, DELETE, INSERT, LOCK TABLES, SELECT, UPDATE ON databasename.* TO 'newusername'@'localhost' identified by 'password';
  • Point to the appropriate database in the appGlobals.php file (located in the root of the website). Change the following code (located at the beginning of the file) by filling in your "databasename", "username" and "password" for database access:
$iProducts['dbUser'] = "username";
$iProducts['dbPassword'] = "password";
$iProducts['dbDatabase'] = "databasename";


Scheduled Task Setup

All core scheduled tasks are executed by the following file located in the root of the website: /taskScheduler.php

For linux servers

Setup the below cron jobs:

* * * * * /usr/bin/lynx -source http://www.websitedomainname.com/taskScheduler.php
* 1 * * * root ntpdate 0.pool.ntp.org
  • The first cron job calls the task scheduler every minute. Change "www.websitedomainname" to match the domain name of your website.
  • The second cron job ensures the system clock is accurate.
  • Add the following 3rd cron job line if using EBO (TEM by Fiddlehead):
*/10 * * * * . /path/to/website/root/folder/ebo/xmlExporter.sh >> /dev/null 2>&1 # TEM XML Exporter

Replace "/path/to/website/root/folder/" with the path to the website root folder on your server


Directory Setup

Images and Files

Create a root folder for the images and files to be used by the image and file management libraries. They can be in root of the website (/images, /files), in a common directory (/library/images, /library/files) or even within each other (/files, /files/images). These folders will need to be entered into the site settings when later configuring the website via the administration console.

Clear and Set Parsed
  • Delete contents of /parsed (located in the root of the web site)
  • Set parsed for full access (linux > chmod 777 parsed)


MySQL Configuration

Open the config file
  • Look for my.ini in Windows (usually located in the C:\Program Files\MYSQL folder)
  • Look for my.conf in Linux (usually located in the /etc folder)
Perform the following to the config file
  • Set group concat length
group_concat_max_len=32768
  • Set Sort Buffer
sort_buffer_size=1M
  • Turn on Query Caching:
query_cache_type=1
query_cache_limit=1M
query_cache_size=32M
  • Set Max Connections:
max_connections=1000
  • Reduced wait_timeout to prevent idle clients holding connections.
wait_timeout=15
connect_timeout=10
  • Reduced key buffer it by checking current size of *.MYI files, see notes below. Recommended to set between 1/4 - 1/2 total server memory
key_buffer=1024M
  • thread_concurrency = 2 * (no. of CPU)
thread_concurrency=4
  • The default is 64. Each time MySQL accesses a table, it places it in the cache. If the system accesses many tables, it is faster to have these in the cache. Check opened tables and adjusted accordingly after running for a while.
table_cache=1024
  • MyISAMCHK sort_buffer: The sort_buffer is very useful for speeding up myisamchk operations (which is why it is set much higher for that purpose in the default configuration files), but it can also be useful everyday when performing large numbers of sorts.
sort_buffer=64M
  • If you have a busy server that's getting a lot of quick connections, set your thread cache high enough that the Threads_created value in SHOW STATUS stops increasing. This should take some of the load off of the CPU.
thread_cache=128
  • tmp_table_size:: "Created_tmp_disk_tables" are the number of implicit temporary tables on disk created while executing statements and "created_tmp_tables" are memory-based. Obviously it is bad if you have to go to disk instead of memory all the time. 32M by default.
tmp_table_size=128M
  • log slow queries is a must. Many queries that take more than 2 seconds. If so, then your tables need enhancement. Be sure to create log file and set rights so mysql can manage the file.
log_slow_queries=/var/log/mysql/mysqld.slow.log
long_query_time=2
  • read_buffer_size=128K by default.
read_buffer_size=1M
  • ft_min_word_len: defaults to 4 but most clients will want 3 characters min search word length. NOTE THIS MUST APPEAR BELOW [MySQLd] in the my.ini/cnf file OR IT WILL NOT WORK
ft_min_word_len=3
  • split ibdata file from one HUGE file to one for each table - since the file does not shrink, this will make it easier for dump and recover to maintain the file sizes
innodb_file_per_table
  • NOTE: memory=key_buffer+(sort_buffer_size+read_buffer_size)*max_connections
  • If commented, uncomment all innodb my.conf vars
  • set up mysql logging, test

PHP Configuration

Open the php.ini config file
  • Default location in Windows is C:\PHP
  • Default location in Linux is /etc
Perform the following to the config file
  • Set the session lifetime by adding or uncommenting the "session.cookie_lifetime" variable and setting to "2592000" (30 days). For 8x8 eComm sites set to 3 months 7776000:
session.cookie_lifetime=2592000
  • Add or uncomment GPC_magic_quotes and set to "off":
GPC_magic_quotes = OFF
  • Set default time zone (we recommend client headquarters time zone)
[Date]
date.timezone = America/New_York

FUSEBOX Configuration

Open the fusebox.xml.php config file located in the root of the web site
Perform the following the the config file
  • Set fusebox mode to "production" (scripts are stored in memory for optimal performance, set back to "development" when modifying web site scripts):
<parameter name="mode" value="production" />


Mail Order Manager Integration

If integrating with MOM (Mail Order Manager), a scheduled task needs to be setup on the windows server that is hosting MOM.

First set up the import environment. Do this by creating the following directory structure (location doesnt matter, so long as the following structure exists): /MOM_INT/ /MOM_INT/logs/ /MOM_INT/imports/ /MOM_INT/importBackups/ /MOM_INT/exports/ /MOM_INT/exceptionreports/ /MOM_INT/orderImportIncremental.vbs

Ensure BOTH MOM and the scheduled task running "orderImportIncremental.vbs" have ALL access rights to /MOM_INT and all subfolders.

Place the following visual basic code into the /MOM_INT/orderImportIncremental.vbs file (Change the "URL" attribute to use the domain name of your web site):

' init attribs
Dim fileName
Dim URL
 
' set the URL of your web site here!!!!!
URL = "http://www.yourwebsitedomain.com/index.php?fa=ORDER.orderExportMOM_5_4&dBug=0&onlyNotSent=1&markAsSent=1"
 
' increase timeout for script processing
WScript.Timeout = 270
 
' access file system
Set fso = CreateObject("Scripting.FileSystemObject")
 
' open (create) the master import log that will list ALL import attempts
set f = fso.OpenTextFile("orderImportLog.txt",8,True)
 
' create the TEMPORARY in process file. This will automatically be deleted at the end of this script. If this file remains, the import process stalled.
importInProg = "logs/importInProgress." & DatePart("yyyy",Now) & "_" & DatePart("m",Now) & "_" & DatePart("d",Now) & "_" & DatePart("h",Now) & "_" & DatePart("n",Now) & "_" & DatePart("s",Now) & ".txt"
set fl = fso.OpenTextFile(importInProg,2,True)
fl.Write "running file"
fl.Close
 
' append the master import log
f.Write vbcrlf & "-------------" &vbcrlf & "starting Import " & DatePart("yyyy",Now) & "-" & DatePart("m",Now) & "-" & DatePart("d",Now) & " " & DatePart("h",Now) & ":" & DatePart("n",Now) & ":" & DatePart("s",Now)
 
' create name for import file
fileName = "MOMIMPORT.INCR." & DatePart("yyyy",Now) & "_" & DatePart("m",Now) & "_" & DatePart("d",Now) & "_" & DatePart("h",Now) & "_" & DatePart("n",Now) & "_" & DatePart("s",Now) & ".XML"
 
	' get web page data
	Set WinHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
	WinHttpReq.Open "GET",URL,False
	WinHttpReq.Send
 
' append master import log
	f.Write vbcrlf & "data retrieved"
 
	' save to file
 
	If(trim(WinHttpReq.ResponseText) <> "") then
		f.Write vbcrlf & "data not empty. writing files..."
 
' save the import file in BOTH the imports directory (for MOM to pull) AND the importBackups directory (to keep an archive)
		set f1 = fso.OpenTextFile("imports/" & fileName,2,True)
		f1.Write WinHttpReq.ResponseText
 
		set f2 = fso.OpenTextFile("importBackups/" & fileName & ".bak",2,True)
		f2.Write WinHttpReq.ResponseText
 
		f.Write vbcrlf & "file writing complete"
	End If
 
' append the master import log
f.Write vbcrlf & "ending import " & DatePart("yyyy",Now) & "-" & DatePart("m",Now) & "-" & DatePart("d",Now) & " " & DatePart("h",Now) & ":" & DatePart("n",Now) & ":" & DatePart("s",Now)
 
' Delete the TEMPORARY importInProg file
fso.DeleteFile(importInProg)

Table Fixes for Linux

On linux run the following to fix the case of the table names.

This is necessary because Windows makes the table names lower case, regardless of specifying upper case letters in the table names. Since the starting database is being transferred from a windows box, the table names will be set to lower case by windows. The linux file system is case sensitive, meaning that if a script calls for the table using any upper case letters where the table name is stored as lower case, it will not find the table. To correct this, the below commands need to be run in order to change the table names to their correct case.

The following commands need to be run in mysql. This can be done by logging on to SSH for the server housing the database than logging into mysql on that server. The below commands can all be run by copying the entire command list and pasting it into your ssh session while in the mysql prompt.

alter table customfields rename customFields;
alter table customfieldvalues rename customFieldValues;
alter table customlibraries rename customLibraries;
alter table customlibraryitems rename customLibraryItems;
alter table page_forumpostagree rename page_forumPostAgree;
alter table page_forumposts rename page_forumPosts;
alter table page_pollanswers rename page_pollAnswers;
alter table page_pollquestions rename page_pollQuestions;
alter table page_searchgroup_languages rename page_searchGroup_languages;
alter table page_searchgroups rename page_searchGroups;
alter table page_searchoption_languages rename page_searchOption_languages;
alter table page_searchoptions rename page_searchOptions;
alter table page_send2friend rename page_send2Friend;
alter table pendingapproval rename pendingApproval;
alter table prod_optiongroups rename prod_optionGroups;
alter table prod_optiongroup_link rename prod_optionGroup_link;
alter table prod_pricegroups rename prod_priceGroups;
alter table stat_pageviews rename stat_pageViews;
alter table user_groupaccess rename user_groupAccess;
alter table user_loginsessions rename user_loginSessions;
alter table user_usersingroups rename user_usersINgroups;
alter table user_wishlist rename user_wishList;
alter table lk_zipcodes rename lk_zipCodes;
alter table lk_fedexzipstozones rename lk_fedexZipsToZones;
alter table lk_paytypes rename lk_payTypes;


Email DNS Settings

The following settings will allow emails sent from the server to avoid spam filters. This is to fulfill the three-way mail check. To do this we need the name the server identifies itself as (258258-web1.greatgardenplants.com) to resolve both forward and backward. That is, the IP address of the server needs to resolve to 258258-web1.greatgardenplants.com and the name 258258-web1.greatgardenplants.com resolves to the IP address of the server (204.232.239.36). From linux shell type the following to see what the server identified itself as:

  1. hostname

First, create a PTR record with the server hosting company pointing the IP address used to send email to the server name subdomain.

Second, a subdomain has to be created with the domain name registrar. This subdomain needs to match the server name (#hostname) and resolve to the IP address that will be sending outbound mail.