Process to Promote Staged Site to Production

Top  Previous  Next

This is internal documentation only.  It explains the process for promoting a NeatWorx managed web-site from a staging area into production.  For security reasons some details have been omitted.  This process assumes ssh access to one or more NeatWorx servers.

Enter new customer in PLESK

use the http://manage.neatwrx?.com interface for the NeatWorx server you are hosting on, and login with the secure password obtain the PLESK login credentials specific to the server. (this information found in the server configuration summary)
Login to PLESK and create a new customer

Inside PLESK - Create a new Client Account and Add a new Domain

Select "clients" under the general tab
Select Add new client account and provide information for the client. record the username and the password that you give this customer in PLESK as you will need it later.
If available, configure using a NeatWorx supplied template in PLESK
Add a vacant IP address to the Client IP pool (in post cases where will be only one shared address, so just click add to move it to the client's IP pool and click OK
Select "Add New Domain" to add a domain to this account using a template if available and make sure that the proceed to hosting setup box is ticked before clicking OK. (Note - you can add the domain at this stage even though the DNS records may not be properly setup - ignore any warnings related to DNS settings resolving to a different address)
For the hosting type, select "Physical Hosting"
For preferences, normally do not select SSL support - recommend making the FTP login and password for this account the same as the PLESK login (as long as the customer is only hosting one web-site with NeatWorx. Recommend setting a hard disk quota of 1000 MB (1 GB) -  (hard disk quotas may not be supported depending on the server configuration - just ignore the setting if not supported - shell access should be forbidden with FTP user credentials
Do not include site builder support
Under "Services" Select only PHP - (ensure that safe_mode is *not* checked - this will cause the application not to run - If NeatClubs does not run on one web-server instance, but runs on others, this is a likely cause) recommend leaving other options unchecked.  Under "Web Statistics", select Webalizer. Tick the box that makes it available via a password protected subdirectory (plesk-stat)

Retrieve the staged MYSQL database from the Staging subdomain

Select the principal domain for the machine you are hosting on after clicking on "Domains" in the "General" area (top left) in PLESK - for example, for the neatwrx2.com server, you would select "neatwrx2.com".  The manage.neatwrx?.com URL on each site has a "map" of server names and details such as this.
Once you are managing the domain, select databases to see a list of the databases associated with this domain - all databases for sub-domains are visible here.
Select the name of the staged database that you want to export
Select the DBWebAdmin icon for that database to launch PHPMySQL into a separate window. You should see that the database is has tables present down the left hand side of the display
Select "Export" to export to an SQL file accepting all the default options - ensure that the "save as file" box is ticked and that the export type is "Insert".
Click "Go" to save your MySQL database to a local text file
Open this downloaded file in a text editor to make sure it is readable
Remove the first two lines of the exported database (Create <databasename> and Use <databasename> - these will be redundant and will generate an error if not removed since we will be importing this content into a new database - save the database file after removing these lines. Recommend saving the file as <instance-name>.sql so you will be able to find it  later.            

Retrieve uploaded graphics and images via FTP

Note - this can be done via a directory copy on the server as well, however we recommend retrieving the files so that there is a second (local) copy in case something goes wrong.

ftp to the server using the neatwrx?.com master FTP account (you will need to know these in advance)
From the ftp server, change into the ./subdomains/<staging-instance>/httpdocs/uploads directory
Make sure you are downloading to a known local directory
Retrieve all files in this directory via FTP (ensure binary mode is on - recommend turning off prompts and using mget from the command line if you do not have a graphical tool) - you can ignore sub-directories.
Remember where you downloaded the contents of the "uploads" directory too as you will need this information later.
Exit PHPMyAdmin

Restore the Database into the New (Permanent) Domain

In PLESK, select Domains from the General area and select the name of the prodeuction domain (created earlier) that you will load the SQL database into. (Make sure that you are not still under a subdomain when you create a database)
Select Databases, followed by "Add New Database"
Give the database a name (this will need to be different than the name that was used to stage the database as a subdomain) - the type will be MySQL and the database server will be local.
Add a new user - for simplicity, make the user-name the same as the database name and use a standard password.
Click "DB Web Admin" to open PHPMyAdmin in a separate window - you should now see an empty database - if PHPMyAdmin fails to open, you may have made an error in creating the MySQL user account
.Select "Import" and retrieve the SQL file that you downloaded earlier. (make sure that you removed the create database statement and the use statement from the exported MySQL text file) - select "Go" when ready to import.
This should result in all the database tables appearing down the left panel in PHPMyAdmin
Close the PHPMyAdmin window

Setup NeatClubs.COM in the newly provisioned domain

These steps assume SSH access to the server at present - while most of the work is automated, the process of adding the new server instance to NeatWorx configuration files is still manual.

ssh onto the server
"su" to root using the server root password
cd /var/www/vhosts
list the contents (ls -l) to ensure that your new domain has been created
cd into the httpdocs directory in the new unpopulated instance and remove the template index.html file put there by PLESK

Modify key NeatClubs scripts

This step modifies NeatClubs.COM configuration files to be aware of the newly added domains. This step needs to be done before NeatClubs.COM software can be loaded into the new web-hosting area for the domain .

cd /var/www/vhosts/scripts
vi sites to edit the sites file - add a line at the bottom of the list of sites with the domain name that you have just added. This file is checked by the cron job to that runs every few minutes to decide what MySQL resident mail-queues need to be polled for outgoing mail
vi update_all.sh - add a new line for the new domain, similar to existing lines in this file and  save the file- you will be provisioning a top level domain, so the syntax will be something like ./update.sh domainname.com top - this script will be used in future to update the software for all instances of NeatClubs in future
vi backup_all.sh - add a new backup line to the backup_all.sh script for the newly created production domain - this script will be called nightly by a system-wide cron job - the backup scripts needs information including the DB name, the DB user login, the DB password, a notification e-mail address for the Backups, The NeatWorx service name and the top level domain or subdomain name

Load NeatClubs.COM Software into the new domain

** Be Careful - this will work only if you've executed all of the steps properly up until now.

cd /var/www/vhosts/scripts
./update.sh domainname.com top

If this worked properly, you should see a series of lines scroll by. There may be some notification that some files could not be created because they already exist - this is normal and nothing to be concerned with (The PLESK template uses some of the same directory names as NeatClubs and NeatClubs over-writes them)

Edit the Instance Specific Configuration File

The parameters.txt file stores the parameters that a NeatClubs instance needs to know about itself in order to load. At present parameters.txt needs to be manually edited for each NeatClubs.COM instance.

The items in the file are:

http://domainname.com/    must have trailing slash!

db_username               The username from when you created the database

db_password               The password from when you created the database

db_host or IP             Usually the hostname or IP address of the local server

1                         binary flag meaning the mail is supported

1                         binary flag meaning the ImageMagik is present

NeatClubs                 The Name of the NeatWorx product (for future use)

Gold                      The Level of Service (for future use)

 

Edit your local hosts file

To make sure the new service is responding before configuring DNS, edit your local hosts file to add an entry for the domain you want to pre-view on the NeatWorx server - on Windows XP and Vista, the hosts file is under c:\windows\system32\drivers\etc
Map the domain name to the IP address of the server you are hosting on
From the DOS prompt type "ipconfig /flushdns"
From a browser, if all was done properly, you should not see the new NeatClubs.COM instance (not all the graphics will appear because you haven't loaded them yet! :-)

FTP Content to new web-server instance

In the FTP upload tool, create a new profile for the new domain for convenience (you created the ftp login and username earlier in this procedure)
Upload the contents of the contents that were previously saved into the uploads directory of the new production site instance

View and Clean-up the new Production Site

Login to the new site as the administrator and re-apply the color scheme to force the CSS file to be rebuilt (this needs to be done since the CSS file is unique to each site) - the fonts will be incorporated automatically when this is done
Re-generate all the thumbnails - this too needs to be done since altough we uploaded the images, we did not migrate the various sized versions of images stored in the thumbs directory
Use a global search and replace to replace any instances of http://subdomain.neatwrx?.com with http://sitename.com (note - at present this does not catch all potential issues - a careful review is still in order to make sure there are no broken links - it is a good idea to put the staging site into maintenance mode so that it will be obvious if links on the production site are still directing back to the staging site.

Other Details to review

In Plesk, remove the password from the protected plesk-stat directory (plesk inserts this by default)
Recommend uploading a graphic icon for the site
Add the new site to the NeatClubs.COM "referral circle" to improve Google Page Ranking

Set the DNS zone files on the Name Server

Before we can re-point a DNS domain to a new name-server, we first need to configure the name-server to resolve the various types of DNS records.

Note: Although we could use our own servers for this purpose (DNS settings are configurable in PLESK) we would prefer not to do this. It is a much better practise to have multiple redundant name-servers that are on separate machines than individual service components (mail, web, database etc.)

The steps involved in setting up the DNS zone file (using servage.net in this example are)

Login to servage.net
Select Domain Administration and select "Add a domain you already own to this account" (even though the customer may in fact own the domain)
After the domain has been added to the list of domains servage are serving zone records for, select "Edit DNS Settings" under "Domain Settings"
Change the DNS settings as follows:
Change the IP address fomr "*.domainname.com" and "@.domainname.com" to be the IP address of the server you are hosting on.
Add a new A-record for "mail.domainname.com" resolving to the same address as the web-server (no strictly necessary, but this will ease migration if in future the web-services and e-mail services are decoupled onto different machines)
Change the new MX records to resolve to the same machine "mail.domainname.com." (<-- remember the trailing dot!) - this is not a best practise, but with one mail-server it is all we can do at present. (the "External Mail Servers" box will need to be checked) - if you want to keep the MX records with a different mail service, you can enter the third party MX mail-servers here.

A correctly formatted zone file when complete will look something like the file below:

$TTL 86400

$ORIGIN londongymnasticsacademy.com.

@ 1D IN SOA ns1.servage.net. hostmaster.servage.com. (

2008090763 ; serial (d. adams)

3H ; refresh

15M ; retry

1W ; expiry

1D ) ; minimum

 

1D IN NS ns1.servage.net.

1D IN NS ns2.servage.net.

1D IN NS ns3.servage.net.

1D IN NS ns4.servage.net.

 

mail IN A 67.205.89.115

* IN A 67.205.89.115

@ IN A 67.205.89.115

localhost IN A 127.0.0.1

@ IN MX 10 mail.londongymnasticsacademy.com.

@ IN MX 20 mail.londongymnasticsacademy.com.