Setting up for local development

Downloading the site from Site Factory

  1. Select Backup the site from Site Factory’s site card drop-down list, located to the right of the Log in button.
  2. Once the site has finished backing up, an email will be sent with a link to download the site.
  3. Click on the link or go directly to https://www.ucdsitefarm.acsitefactory.com/site-archive-list
  4. Click the “Download” link which will download a tar.gz file.
  5. If you are on a Windows computer, you will need a program like 7zip http://www.7-zip.org/ to open the file.
  6. Extract the contents to your computer and rename the folder to something useful.

Set-up your local environment

You will need a LAMP style development environment setup with Apache, PHP, and MySQL. There are many options available such as MAMP https://www.mamp.info, WAMP http://www.wampserver.com/en/,  or Drupal VM https://www.drupalvm.com/.

  1. Create a local domain such as sitename.local pointed at the docroot folder of the downloaded site’s code.
  2. Create a new Database.
  3. Import the database.sql file that downloaded with the site’s code.

Drupal settings for local development

There are 3 files needed in the /docroot/sites/default/ directory that Drupal will rely on for doing local development.

  1. Download the settings.php, settings.local.php and services.local.yml from https://goo.gl/yDKmT4. Toward the top right will be a “Download Zip” button which will allow both files to download to your computer.
  2. Place these 3 files into the /docroot/sites/default/ directory.
  3. Customize the settings.local.php file to make it specific to your local environment.
    • Edit the $databases['default']['default'] array by changing the database name to the name set up earlier.
    • Edit the $config_directories['sync'] to match the /docroot/sites/default/files/config_[HASH]/sync directory.
      • In your files structure it will look something like config_f522e50bd94f2207e3dc21e94388ac59ca5015a7

The settings.local.php file can be customized for your local environment as needed.

Preparing a subtheme of “SiteFarm One”

  1. Download a subtheme starter kit from https://bitbucket.org/ietwebdev/sitefarm-theme-one-subtheme-starterkits/downloads/?tab=branches
    • There are 2 starter kits: Basic and Advanced.
    • The Basic branch is a simple starting point for doing CSS, Javascript, and Templates.
    • The Advanced branch allows using Sass, es6 Javascript, and advanced theming with BrowserSync.
  2. Extract the starter kit into /docroot/sites/default/themes/ and rename the folder to site.
  3. Using a console, cd into site with “git init”.
  4. Commit the subtheme code and push it to bitbucket or github.

Connect the theme repository to Site Factory

  1. Select Manage theme repository from Site Factory’s site drop-down menu.
  2. Click Connect site repository.
  3. Grant access to the Repository
    • Bitbucket: Click Show SSH public key and copy it. Add this to a git repo.
      • Click “Settings”, then “Access keys”, and then “Add key”.
    • Github: Click “Settings”, then “Collaborators and Teams”.
      • Add "ietwebdev" to the "Collaborators" list.
  4. Add the git URL into “Git URL” like git@bitbucket.org:ietwebdev/sitefarm-theme-one-subtheme-starterkits.git.
  5. Add a branch or tag into “Branch or tag” such as “master”.
  6. Click Save.
  7. Clear your site's cache by selecting Clear caches from Site Factory’s site drop-down menu.

More information can be found here: https://docs.acquia.com/site-factory/theme/external.

Local Dev Tips

  1. Use “Drush” in a console from the docroot directory with:
    $ ../vendor/bin/drush
  2. Log in as an Administrator:
    $ ../vendor/bin/drush --uli=”sitename.local”
  3. Use “Drupal Console” in a console from the docroot directory with:
    $ ../vendor/bin/drupal
  4. Create a subtheme using a wizard:
    $ ../vendor/bin/drupal sitefarm:generate:subtheme
  5. The following modules can be disabled
    • acsf_*
    • Acquia_connector
    • SamlAuth