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.

The dev, stage(test) and prod
environments are associated with git branches used in the continuous-deploy workflow and can not be attached to different branches or repository tags without disrupting and potentially breaking the workflow.
The dev2, dev3, ci and uat
environments can track any desired branch or tag (even develop-deploy
or master-deploy
) without disrupting the continuous-deployment workflow.
Set-up a site branch (or tag) on Acquia.
Elsewhere this might be termed spinning up an on-demand instance of the site.
Make sure you have the latest copy of the main Drupal 8 repository cloned to a folder
<repo-root-path>.
Checkout the branchdevelop
and make sure the latest commits are pulled (fetch+merged) locally.Commit your work to a new branch (
on-demand-branchname
) off thedevelop
branch .Push that branch to GitHub, but do not create a PR or merge into
develop
.Edit
<rep-root-path>/.travis.yml
file and make the following additions: (Note: replace<on-demand-branchname>
withon-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 ===
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>
withon-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 ...
Commit the
.config.yml and .travis.yml
changes toon-demand-branchname
and push to GitHub - but do not merge intodevelop
.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 theon-demand-branchname-deploy
branch in the Acquia Repository.The Travis build can be tracked here in Travis.
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 currentstage
database and update with configuration from theon-demand-branchname
branch.The "on-demand" environment is now set. Users may view and interact with the environment as required. See Notes in "gotcha's" box below.
Once you have finished the demo/test/showcase cycle, you can merge the
on-demand-branchname
branch todevelop
- provided you wish the code changes to be pushed through the continuous-deploy process toproduction
.Finally you can detach the
on-demand-branchname
branch from the Acquia environment, and set it back to thetags/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
(public DNS entry)
ci
(public DNS entry)
dev2
(no DNS - make entry in local hosts file)
dev3 (pending)
https://d8-dev3.boston.gov
(no DNS - make entry in local hosts file)
Housekeeping.
When finished with the environment, you should consider rolling-back the changes you made to .travis.yml
and .config.yml
in steps 4 & 5 before finally merging on-demand-branchname
to develop.
It is likely that the on-demand instance is no longer required, and its unnecessary for the the on-demand-branchname
to be tracked by Travis.
Also as a courtesy, change the branch on the environment back to tags/WELCOME
so it is clear that the environment is available for use by other developers.
On-demand instance gotcha's:
Updating: If you push changes to
on-demand-branchname
in GitHub (which eventually causes Acquia'son-demand-branchname-deploy
to be updated) - then in Aquia's terminology you are "updating" the code. Any commits you push to the GitHubon-demand-branchname
will cause Travis to rebuild and update the code on the Ci/Uat environment and this will cause Acquia'spost-code-update
hook script to run. - That update-hook script will backup your database and update and new configurations but will not update or overwrite any content (so changes made by users will be retained).Deploying: If you switch the code on the Acquia server from
on-demand-branchname-deploy
to some other branch or tag, and then back again - then in Acquia's terminology each switch of branch is a "deploy" of the code. GitHub is not affected by this change, so nothing will run on Travis, but once each switch is complete, Acquia'spost-code-deploy
hook script will run. - That deploy-hook script will sync the database from thestage
environment and will overwrite any content in the database. Therefore, any content previously added/changed by users will be lost.
Last updated
Was this helpful?