Difference between revisions of "Installation"

From Whirlwind eCommerce Wiki
Jump to: navigation, search
(clarified the table fixes for linux)
Line 162: Line 162:
 
==Table Fixes for Linux==
 
==Table Fixes for Linux==
  
On linux run the following to fix the case of the table names. This is necessary because Windows likes to make the table names lower case, but all tables are referenced in scripts upper case letters to delineate words - since Linux is case sensitive, they need to be case correct to work:
+
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.
  
 
<source lang="mysql">
 
<source lang="mysql">

Revision as of 17:48, 6 December 2008

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+
  • 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 index.php

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 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
  • 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):
session.cookie_lifetime=2592000
  • Add or uncomment GPC_magic_quotes and set to "off":
GPC_magic_quotes = OFF


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. Change the "URL" attribute to use the domain name of your web site:

Dim fileName
Dim URL
URL = "http://www.yourwebsitedomain.com/index.php?fa=ORDER.orderExportMOM_5_4&dBug=0"
fileName = "c:\MOMIMPORT." & DatePart("yyyy",Now) & "_" & DatePart("m",Now) & "_" & DatePart("d",Now) & "_" & DatePart("h",Now) & "_" & DatePart("n",Now) & "_" & DatePart("s",Now) & ".txt"
' get web page data
Set WinHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
WinHttpReq.Open "GET",URL,False
WinHttpReq.Send
' save to file
Set fso = CreateObject("Scripting.FileSystemObject")
set f = fso.OpenTextFile(fileName,2,True)
f.Write WinHttpReq.ResponseText


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 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 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;