Local Development

From Metro Studios Knowledgebase

Jump to: navigation, search

Contents

[edit] Creating a Local Site

[edit] Local References

First things first, we need to have local references to whatever site you are working on. To start, you need to have EasyPHP running (Apache and MySQL services should both be active) Once you have EasyPHP running, go to http://localhost . On this site, you will see a box where you will enter the domain name (including the extension) See the image below for an example
Localhost.jpg
The only thing you need to worry about at this step is within the "Add A Site" box. You will type the domain name of the site you are working on into this text box.
Note: in this step you can select "www.". This option will determine how you access the site locally at later steps.
Press "Add" when you have entered what you want within the text box.

[edit] Pull Git Repo

Now that you have a local reference created for the site, you will need to pull down the site files from the server. To do this, we use a program called Git, version control software, to have repositories that we can pull down locally and edit. There are two different sets of instructions here depending on whether you choose to use Git via the command line in SSH or through the Git GUI installed on your machine. Both ways work the same, it just depends on your personal preference.
The Git GUI is more user friendly for people who may not know how to use a command line

[edit] Git GUI

When you open Git GUI, you should see a window come up that looks like:
Gitgui.jpg
On this page, if you do not already have the Repository for this site, you will need to click on "Clone Existing Repository".
You are now prompted to enter in a Source Location and a Target Directory. The Source Location can be obtained from Git_Versioned_Sites. On this page, you will see a list that looks like:
Gitsites.jpg
Find your site within this list and copy the data in the "Clone String" box associated with your site and paste this into the Source Location of the Git window. If for some reason you cannot find the site within the list, it may be because it has not been added or the site does not have a repository. The layout of the "Clone String" is as follows:

ssh://USERNAME@web1.metro-studios.com:11200/var/www/vhosts/metro-studios.com/httpdocs.git

To break this down more:

The Target Location is where you will be storing the site on your local machine. Assuming that you did not skip the steps in the Pull Git Repo section above, you will need to enter this:

C:/var/www/vhosts/DOMAIN/httpdocs

You will need to enter the domain of your site where DOMAIN is.
After you have done this, press "Clone".
You will then be prompted to enter your password three times.

When this window pops up, you have successfully pulled your site down with Git
Gitinterface.jpg

[edit] Git SSH (Older)

Most of the sites have a very basic git workflow. With these old sites, Dev sites are kept separate from their live site counterparts. Locally, work is done on a clone of the "master" branch of the dev site. Once the dev site is approved, the entire repository is cloned to the live site, and the "master" branch is what gets displayed to the browser. Because of this, it happens quite often that dev sites become outdated when changes are pushed directly to the live site.

No matter if you are cloning a dev site or a live site, the process is the same (substitute "webX" with the appropriate server name):

  1. Navigate to the correct site.
    cd /var/www/vhosts/SITE_DOMAIN/
  2. Clone the Repository
    git clone ssh://USERNAME@webX.metro-studios.com:11200/var/www/vhosts/SITE_DOMAIN/httpdocs.git

[edit] Git SSH (Newer)

Some newer sites incorporate a branched git workflow that allows the dev site to exist as a working copy of the live site. The dev site is split into a "master" branch and a "dev" branch. The live site also has a "master" and "dev".

Work is done on a clone of the "dev" branch of the dev site. Once the dev site is approved, these changes are then pushed across to the "master" branch of the dev site, and this master branch is then pushed to the "master" branch of the live site.

This is to hopefully prevent any changes from being pushed directly to the live site - without going through the dev site first. This is turn keeps the dev site up to date with the live site, provides an extra step in revision rollback options, and allows major changes to be sidelined when minor updates need to be pushed out quickly, without losing changes already committed to the dev site.

The cloning process for these sites is a bit different (we will always be cloning the dev site):

  1. Navigate to the correct site.
    cd /var/www/vhosts/SITE_DOMAIN/
  2. Clone the "dev" Branch of the Dev Repository
    git clone ssh://USERNAME@dev1.metro-studios.com:11200/var/www/vhosts/SITE_DOMAIN/httpdocs.git --branch dev --single-branch

[edit] Set up Local Back-end

Now that you have successfully pulled the site files, we need to get the Database so that your local version will have all of the information that has been entered into the Database.
First things first though, we need to determine if your site has our Boost CMS installed.

[edit] Boost Core

To do this, navigate to

C:/var/www/vhosts/DOMAIN/httpdocs

making sure to replace DOMAIN with your site's domain and look for a directory/folder named

_Boost

If there is a folder/directory with this name, then the site has the Boost CMS installed. If not, then you can skip the rest of this step. Navigate back to http://localhost and find your site within the Drop down menu called "Install/Update Boost Core"
Localhost.jpg
This Boost Core is ignored by Git, so if you plan on working on a Boost site locally, you need to get this.

[edit] Retrieve Database

The next step will be to obtain the Database structure and data from our servers. Recall back to what server your site was located on and go to the appropriate Web interface:

You can obtain the login credentials for each server through KeePass.

Once you have logged in, you will see this section on the page:
Pleskpanel.jpg
Click on phpMyAdmin.

A new window should have opened with the Database interface.

[edit] Manually Retrieve Database

  1. Install Boost via localhost and detrimine DB name in _boost/bootstrap.php
  2. Go to http://SERVERNAME.metro-studios.com:8443
  3. Get login from Kee Pass > Server Admin Web Portals
  4. Go to: Tools & Settings > Apps & Databases > Database Servers
  5. Click "Local Mysql Server"
  6. Click the Database tab > Web Admin Icon > Click the Export tab > Custom Button
  7. Select site database
  8. Tick view Output as text and click Go
  9. Select and copy all the text and past into a Notepad++ doc
  10. Go back to localhost click phpmyadmin
  11. Select the SQL tab
  12. Copy all the text from your Note Pad++ doc paste it into the sql field and click GO
  13. Open _boost/bootstrap.php and get the database username and password
  14. If user doesn't exist under users in privileges tab, create new
    1. Selet local under host
    2. Database specific privilages add name of site database in dropdown (this may have to wait until after step 4
    3. Check all boxes (quick link at the top of panel)
    4. Click GO
Personal tools
Namespaces
Variants
Actions
Wiki Navigation
Knowledgebase
Toolbox