EasyStaging 1.0
- Details
- Category: EasyStaging
- Published on Wednesday, 13 June 2012 23:44
- Written by Craig Phillips
- Hits: 2581
Making "staging" sites easier to copy to "live" servers!
What is a Plan? And How do I run one?
- Details
- Category: 1.0
- Published on Friday, 03 May 2013 14:13
- Written by Yulonda Phillips
- Hits: 59
What is a Plan?
In EasyStaging terminology a plan is a group of settings that are used to control the two core actions that EasyStaging performs.
- copy new files (images, PDF, PHP etc) from the current server to a "live" or second location
- copy database tables from the current server to a "live" or second location
Anyone that has the permissions set by the Super user can create a Plan - so be very careful who you give these permissions to. In most cases only the Super user will need to create new Plans, as the most common use of EasyStaging is not creating Plans but running them.
So, a Plan provides a mechanism to define which directories are copied from you Staging website locaion to your Live website location and through the use of rsync options and exclusion patterns you can define which files/directories are excluded from the synch process. Similarly EasyStaging Plans provide an interface that lets you specify which and under what conditions tables are copied from the Staging database to the Live database.
As a point of note EasyStaging doesn't copy itself or any traces of itself to the Live site.
How do I run a Plan?
To "run" a Plan you need that permission given to your Joomla! user, EasyStaging works with the Joomla! 1.7/2.5 ACL so that you can give a user or user group just that permission. A user with only "Run" permission can't create, edit, delete or publish/unpublish a Plan, they can simply run plans. Thanks to the flexibility of Joomla!'s ACL you can even create a Plan that can be run by only a single user, and that user is in turn restricted to just that single Plan.
Step 1. Select "EasyStaging" from the Components menu. It looks like this:
This takes you to the EasyStaging Manager screen, shown below.
As you can see, each Plan has a description to tell you what it does. In this case the Super user has setup the "Publish Aritcles" Plan to copy Articles, Categories and Front Page settings (ie. database tables that hold this information) as well as synchronise the /images directory at the staging and live locations.
For the "Publish Site" Plan the Super user has created a plan to copy the entire site ie. all the files and all the database tables to the live location.
Step 2. Select the Plan you want to run by clicking it name in the EasyStaging Manager. In the example screen shown below (click to enlarge) there are two Plans available - "Publish Articles" and "Publish Site".
Step 3. If you only have "Run" permissions you will see the Plan details shown below.
The Plan view shown with "Run" only permission shows the basic details of the Plan and a single TAB called "Staus" with 3 buttons. The first two buttons ( 1 & 2 ) start a specific part of the Plan while the third button ( 3 ) runs the entire plan. Clicking on any of these buttons will start the relevant section of the Plan runnng to run both the file copy and then the database copy use the green button (3).
Once a stage start executing the "Waiting..." text will be updated with the progress log, until the run completes.
IMPORTANT: The execution of an EasyStaging Plan is run through AJAX call to the server and thus is dependent on your browser remain on the Plan page until it has completed. If you close the window or navigate to another webpage the run will be incomplete. This could leave your live site in an incomplete state ie. broken.
Start File Copy : As the label states this button will start only the file synchronisation, once it's completed nothing else will happen. This can be handy if you're just replacing media on the live site without making any other changes as it is much quicker than the replication of database tables. In the example "Publish Articles" Plan this will copy the files in the /images directory.
Start Database Copy : As you would expect this button will perform just the database copy section of the current Plan, no files (PDF's, images etc) will be copied during this step. In the example "Publish Articles" Plan this will copy only those tables specified by the Plan creator in the "Tables" tab.
Copy All : As you would expect this button will perform both the file copy and the database copy section of the current Plan. In the example "Publish Articles" Plan this will copy the files in the /images directory and then copy only those tables specified by the Plan creator in the "Tables" tab.
Clicking on any of these buttons will make the Plan present a confirmation prompt, to make sure you really want to proceed. In Google's Chrome it looks this:
What happens when a Plan runs?
The process that EasyStaging follows after you click one of the buttons is relatively simple, and proceeds as follows:
- Checks in with the server.
- The server checks the user has permission and that the current user session is valid by Joomla! standards.
- If all is good we give the Plan the "go-ahead" to proceed.
- If the sever responds that all is OK
- the Plan updates it's current status (so you can see that all good so far) and then
- the Plan proceeds to the next step.
- If you clicked the "Start File Copy" button
- the Plan asks the server to prepare the rsync command (and updates its Status for each step)
- the server creates an exclusion file based on settings it has for the Plan
- if that's works then the server tells that Plan it's ready for the next step.
- once the server confirms that the rsync is ready to run the Plan asks the server to execute it
- the server runs the rsync command and returns the results and a status code to the Plan
- the Plan displays the results and if the Status code was OK then proceeds to the next step.
- If you clicked the "Start Database Copy" button
- the Plan asks for the list of tables that it's allowed to copy to the database live site (and updates its Status for each step)
- the server prepares the list based on the setting for each table in the current Plan
- a table may be set to "Don't Copy" in which case it's left off the list.
- a table may be set to "Copy To Live" in which case it's added to the list
- a table may be set to "Copy To Live, Only if not Found"
- in this case if the sever checks the "Live" site to see if it has a table by that name
- if no table is found it's added to the list
- if a table with the same name is found then the table is ignored.
- this is useful for table like the session table where you don't want to blow away the session information of current users of the site.
- the list of tables is return to the Plan
- the Plan asks the server to create an export file for a table in the list
- the server creates the list and passes the result back to the Plan
- the Plan gets the next table from the list and goes back to step 4D, until all tables are processed.
- The Plan asks the server to process the first file on the list
- The server runs the table export and send the result back to the Plan
- The Plan get the next file name and goes back to step 4G, until all tables are processed again.
- If you clicked the "Copy All" button
- Step 3 is run.
- If no errors occur then
- Step 4 is run.
- Once the Plan reaches the end
- all the log and SQL export files are ZIP'ed up into an archive for later if required.
- the Plan's status and last run information is updated in the database.
- You see a completed message with secondary details.
Visually you will see several things happening while a Plan is running. After you've confirmed that you want the Plan to run EasyStaging will start providing feedback details like:
- what stage its at
- how long since the last server response
- any details the server sends back about each step.
Getting Started
- Details
- Category: 1.0
- Published on Friday, 03 August 2012 22:06
- Written by Craig Phillips
- Hits: 1031
Installation
Warning - never install EasyStaging on a publicly accessible website. EasyStaging is only meant to be installed on private development/staging servers that don't have public access.
EasyStaging is installed like any standard Joomla! component, using the Extension Manager.
Navigate to Extensions->Extension Manager->Install
Choose the latest version of EasyStaging and click the "Upload & Install" button.
After the installation you will see a message similar to this one if it was successful:
EasyStaging Manager
To use EasyStaging select Components->EasyStaging and you will be presented the EasyStaging Manager as shown below:
The Manager has all of the standard Joomla! button for managing staging plans. The standard "Plan" buttons include the "New", "Edit", "Publish", "Unpublish" and of course "Delete".
Finally the Manager has a standard Options button for managing staging plans. There are two tabs in the Options screen, the first allows you to set preferences for the way EasyStaging handles data and the second tab allows you to use Joomla's standard permission model to control who can access the component and create, edit or run plans.
Settings
Permissions
The next article covers creating a new plan.
Creating a Plan
- Details
- Category: 1.0
- Published on Friday, 03 May 2013 12:10
- Written by Yulonda Phillips
- Hits: 75
Basics
Each Plan has several basic attributes including:
- Name
- Description
- Published States
Name
Ideally a Plan should have a name indicative of it's purpose. In our examples we have two Plans, the first is called "Publish Site" which copies the entire staging site ( files and database tables ) to the live site location. The "Publish Articles" Plan by comparison only copies the contents of the /images directory ( Joomla!'s default location for storing user generated content such as PDF, photo's etc ) and the required tables from database, rather than all of the tables.
Description
The description is primarily used to provide a quick explanation of the Plan's function to users viewing the list of Plans in the EasyStaging Manager.
Published States
A Plan can be either Published or Unpublished. In addition you can also specify "Publish Up" and "Publish Down" dates to set a time span during which the Plan can be used.
Tabs
To complete a Plan prior to running it you must configure the details and settings in the "Local Site Details", "Remote Site Details" and the "Table Settings" tabs. When you initally create a new Plan the first tab you see will be that "Status" tab as shown below.
Each of these tabs are discussed below including a description of each field or setting available to configure the Plan.
Once the details of the have been configured to your requirements you can "Save" it ready for use.
Status
The "Status" tab contains the Plan controls and the details of the last time the it was run.
The process of running a Plan is covered in the article "What is a Plan? And How do I run one?"
Local Site
The "Local Site Details" tab contains the details to be used as the source or local site from which files and database tables are copied. The initial values that appear in this AB are copied from the Joomla! configuration file of the staging site and may only need minor tweaking.
The "Site Name" and "Site URL" fields are used in the feedback and logging process to help make it clear to you what each stage is doing.
The "Directory to Sync" is the path to the source directory that will be used the rsync command for the copying of files from the local or "Staging" site to the remote/Live site. In the example shown in the screen capture the path is to the root directory of the website.
The "Table Prefix" is used to process the names of the tables in the database and convert them to the correct name on the remote server. This allows a different prefix to be used on the staging and live sites.
The "Rsync Options" field should probably be left as the default values unless you are very confident in your understanding of rsync options.
The "File Exclusions" field allows you to set patterns that will be excluded from and rsync operation. EasyStaging will not copy itself, log/ ,cache/ , tmp/ or any .htaccess or Joomla!'s configuration.php file.
To be precise the content of the "File Exclusions" field is appended to these predefined exclusions:
- com_easystaging/
- /administrator/language/en-GB/en-GB.com_easystaging.ini
- /tmp/
- /logs/
- /cache/
- /administrator/cache/
- /configuration.php
- /.htaccess
Remote Site
The "Remote Site Details" contains the details to be used for the live site (the destination we are copying files and database tables to).
As you can see in the screen shot below the Remote Site Details that are required.
The value in the "Directory to Sync" field can be any valid rsync directory. This will be used as the destination directory for the rsync process used by this Plan.
The Database Name, User and Password fields are used in conjunction with the "Database Host" field to remotely access the "Live" websites database. The remote database must also be setup to allow remote connections from the IP Address of the "Staging" site that the EasyStaging component is running on.
The "Table Prefix" field is used to convert the names of the local database tables to the correct naming convention for the live site. When used with the "Table Prefix" field from the "Local Site Details" tab EasyStaging can easily swap the prefix out for test and creation of the export SQL.
Table Settings
The "Table Settings" tab contains details of each of the tables in the Database and how they will be treated when a plan is run. The "Action" that is take on a table can be one of three available.
Don't Copy
This table will not be copied and is skipped completely when building the SQL exports for the "Live" database.
Copy To Live
This table will be copied and is included when building the SQL exports for the "Live" database.
Copy To Live, Only if not found.
This table will only be copied if it doesn't exist on the remote server, if EasyStaging finds a table with the same then it is skipped completely when building the SQL exports for the "Live" database. If the table doesn't exist on the remote/live server then it will be included when building the SQL exports for the "Live" database.
This last option is useful for table like Joomla!'s #_session table. Joomla! needs this table to work but the records in it relate to the user session on the actual site. To copy the session data from the staging site to the live site could potentially delete a users sessions and result in site issue for the end user. When you initially create a Plan the #_session table is automatically set to "Copy To Live, Only if not found" to prevent this very issue.
Subcategories
-
1.0
The initial release of the EasyStaging component.













