On Demand Instances

Attach a GitHub branch to an Aquia environment.

On demand instances of the Drupal site (boston.gov) are useful to demonstrate new features or functionality sand-boxed away from the continuous-deployment process.

These on demand versions of boston.gov are designed to be housed on a near-duplicate environment to the production site, and be easily accessible in a normal browser from anywhere by people with the correct link.

Acquia provide 6 environments to CityOfBoston.

Set-up a site branch (or tag) on Acquia.

Elsewhere this might be termed spinning up an on-demand instance of the site.

  1. Make sure you have the latest copy of the main Drupal 8 repository cloned to a folder <repo-root-path>.Checkout the branch develop and make sure the latest commits are pulled (fetch+merged) locally.

  2. Commit your work to a new branch (on-demand-branchname) off the develop branch .

  3. Push that branch to GitHub, but do not create a PR or merge into develop.

  4. Edit <rep-root-path>/.travis.yml file and make the following additions: (Note: replace <on-demand-branchname> with on-demand-branchname.)

    branches:
      only:
        - develop
        - master
    =>== Addition ===
        - <on-demand-branchname>
    <=== Addition ===
        
      ... existing config ...
    
    deploy:
      - provider: script
        skip_cleanup: true
        script: bash scripts/deploy/travis-deploy.sh $TRAVIS_BRANCH
        on:
          branch: develop
      - provider: script
        skip_cleanup: true
        script: bash scripts/deploy/travis-deploy.sh $TRAVIS_BRANCH
        on:
          branch: master
    =>== Addition ===
      - provider: script
        skip_cleanup: true
        script: bash scripts/deploy/travis-deploy.sh $TRAVIS_BRANCH
        on:
          branch: <on-demand-branchname>
    <=== Addition ===
  5. Edit <rep-root-path>/scripts/.config.yml file and make the following additions: (Note: This partial example addition is configured to deploy to the Ci environment on Acquia) (Note: replace <on-demand-branchname> with on-demand-branchname.)

    project:
      
    ... existing config ...
    
    build:
      travis:
        develop:
          ... existing config ...
          
        master:
          ... existing config ...
          
    =>== Addition ===    
        <on-demand-branchname>:
          # With Travis, the type will control what type of build is deployed to Acquia (dev/prod).
          type: dev
          suppress_output: 0
          database:
            # Set source to 'initialize' to start a fresh install.
            # Otherwise set it to sync to sync from the drush-alias environment.
            source: initialize
            drush_alias: "@bostond8.test"
          config:
            # define the folder, relative to the drupal docroot, for config files to be synchronised, no trailing slash.
            # aquia require ./config/default:
            #     @see https://docs.acquia.com/acquia-cloud/develop/config-d8/
            sync: "../config/default"
    <=== Addition ===
    
    deploy:
      develop:
        ... existing config ...
        
      master:
        ... existing config ...
        
    =>== Addition ===    
      <on-demand-branchname>:
        # Folder in Travis container where deploy files will be "built"
        dir: ${LANDO_MOUNT}/deploy
        # Name of the target branch in the Acquia repo.
        deploy_branch: <on-demand-branchname>-deploy
        # Path to the drush command in the Travis container.
        travis_drush_path: '${LANDO_MOUNT}/vendor/bin/drush'
        # Alias for deploy target Aquia server. Ci or Uat
        drush_alias: "@bostond8.ci"
        # Definition of files that will and wont be copied from build to deploy.
        includes_file: ${LANDO_MOUNT}/scripts/deploy/deploy-includes.txt
        excludes_file: ${LANDO_MOUNT}/scripts/deploy/deploy-excludes.txt
        sanitize_file: ${LANDO_MOUNT}/scripts/deploy/deploy-sanitize-files.txt
        # Message we want to appear in Acquia repo for the deployment commit.
        commit_message: "Automated commit by Travis CI for Build \#\${travis.id}"
        # Dry-run (for testing).
        dry_run: false
        # Whether (and where) to sync the database on the deploy target. NB: copy-db=false means db left intact.
        copy_db: false
        drush_db_source: "@bostond8.test"
        # Array of user:host for (Acquia) git remotes to be used for deployment.
        remotes:
          - [email protected]:bostond8.git
    <=== Addition ===
    
    git:
      ... existing config ...
      
  6. Commit the .config.yml and .travis.ymlchanges to on-demand-branchname and push to GitHub - but do not merge into develop.

  7. Make a small inconsequential change to the code and commit to the on-demand-branchname branch, and push to GitHub. This will cause the first-time build on Travis, and deploy into the on-demand-branchname-deploy branch in the Acquia Repository.

    The Travis build can be tracked here in Travis.

  8. Login to the Acquia Cloud console. In the UI switch the code in the Ci/Uat environment to the on-demand-branchname-deploy branch. This will cause a deploy on the Acquia server, which will copy across the current stage database and update with configuration from the on-demand-branchnamebranch.

  9. The "on-demand" environment is now set. Users may view and interact with the environment as required. See Notes in "gotcha's" box below.

  10. Once you have finished the demo/test/showcase cycle, you can merge the on-demand-branchname branch to develop - provided you wish the code changes to be pushed through the continuous-deploy process to production.

  11. Finally you can detach the on-demand-branchname branch from the Acquia environment, and set it back to the tags/welcome tag.

Public URL's for the on-demand environments.

You can direct users to the URL's below, select the environment you switched to the on-demand-branchname-deploy branch (in step 8) from the table below.

Environment

URL

uat

https://d8-uat.boston.gov

(public DNS entry)

ci

https://d8-ci.boston.gov

(public DNS entry)

dev2

https://d8-dev2.boston.gov

(no DNS - make entry in local hosts file)

dev3 (pending)

https://d8-dev3.boston.gov

(no DNS - make entry in local hosts file)

On-demand instance gotcha's:

Last updated

Was this helpful?