alan-turing-institute / simulate-frontend

Simulate frontend application.
http://simulate.readthedocs.io
0 stars 1 forks source link

Deploy built app to Azure from Travis #12

Closed martintoreilly closed 7 years ago

martintoreilly commented 7 years ago

Description

The front-end app has a build stage so we want to deploy the built artifacts to Azure and would prefer not to check these into our source repository. Options are:

Implementation

We have decided to deploy from Travis. It should be as simple as adding the following to .travis.yml with the following environmental variables set in Travis. This should get Travis to push the repo including the build output to the Azure local Git repo for the app service.

Travis Yaml

before_deploy: rm .gitignore
deploy:
  provider: azure_web_apps
  verbose: true
  skip_cleanup: true
  on: 
    all_branches: true 
after_deploy: echo 'done deploying!'

Removing .gitignore before deploy and skipping cleanup ensures that the dist build output directory is pushed to Azure.

Deploy set to occur on all branches for testing but should be master only once successful. We should also look at having deployment slots for dev / staging / production, linked to different source branches in Travis.

Travis environmental variables

AZURE_WA_SITE set to subdomain of app on azurewebistes.net (i.e. science-gateway-inputs for us) AZURE_WA_USERNAME set to Azure app service deployment username (used for FTP and local Git deployment) AZURE_WA_PASSWORD set to Azure app service deployment password (used for FTP and local Git deployment)

martintoreilly commented 7 years ago

We are getting an authentication error on deployment: fatal: Authentication failed for 'https://hut23-deploy:[secure]@science-gateway-inputs.scm.azurewebsites.net:443/science-gateway-inputs.git/'

We have verified that the username and password are the same on the Azure app service and Travis.

dpshelio commented 7 years ago

Problem solved!! passwords with special characters need to be escaped on Travis. Messaged shown in Travis:

Notice that the values are not escaped when your builds are executed. Special characters (for bash) should be escaped accordingly.

dpshelio commented 7 years ago

Ha!! and $ needs to be escaped with 3\: \\\ - Now it works!!