Directory Changes
The below steps can be followed, in order for you to utilize the directory changes that were done on the investec-online project at the end of 2021.
Your own Pipeline with New BASE
- Uncomment your pipeline in gitlab-ci.yml file.
- In your own pipeline file in \pipelines folder:
- Change TARGET_BASE_HREF to use new URL path as well as the TARGET_DIST_DIR and TARGET_PROJECT.
- Also make sure that changes field contains the correct directory to your new app location.
mu-build-staging:
extends: .build
only:
changes: [ apps/app-platform-pc-mu/**/* ]
needs: [ mu-initiate ]
variables:
TARGET_ENV: staging
TARGET_ARTIFACT: staging
TARGET_PROJECT: app-platform-pc-mu
TARGET_BASE_HREF: /pc-mu/
TARGET_DIST_DIR: ./dist/apps/app-platform-pc-mu
Add SNOW Change Automation
mu-change-request-prod:
extends: .create-change
only:
changes: [ apps/app-platform-pc-mu/**/* ]
when: manual
needs: [ mu-build-production, mu-build-beta, mu-build-staging ]
variables:
SN_SYS_ID: "b6b4748b1bfe74d0637a0d4ee54bcbb6" # Mauritius Digital Services
SN_APP_NAME: "Mauritius Digital Services"
SN_AFFECTED_CI: "8ac17a931b76b014a85f1022b24bcb67"
SN_ENV: prod
CAB_APPROVAL_GROUP: "3De3d6485c1bb63810637a0d4ee54bcb3a"
mu-await-approval-prod:
extends: .await-approval
only:
changes: [ apps/app-platform-pc-mu/**/* ]
needs: [ mu-change-request-prod ]
dependencies: [ mu-change-request-prod ]
variables:
TARGET_ENV: prod
mu-deploy-prod:
extends: .deploy
only:
changes: [ apps/app-platform-pc-mu/**/* ]
when: manual
needs: [ mu-await-approval-prod ]
variables:
TARGET_ENV: production
TARGET_URI: '["login.secure.investec.com/pc-mu*"]'
TARGET_CF_ZONE: $INVESTEC_COM_CF_ZONE_ID
TARGET_CF_URI: pc-mu
TARGET_CF_ENV_NAME: mu-prod
TARGET_PROJECT: app-platform-pc-mu
TARGET_BUCKET: app-platform-pc-mu
mu-review-change-prod:
extends: .review-change
only:
changes: [ apps/app-platform-pc-mu/**/* ]
needs: [ mu-deploy-prod ]
dependencies: [ mu-deploy-prod ]
variables:
TARGET_ENV: prod
mu-close-change-prod:
extends: .close-change
only:
changes: [ apps/app-platform-pc-mu/**/* ]
needs: [ mu-review-change-prod ]
dependencies: [ mu-review-change-prod ]
variables:
TARGET_ENV: prod
SN_SYS_ID: Layer 2 Business Service
SN_APP_NAME: Layer 2 Business Service Name
SN_AFFECTED_CI: 1st Approval Group
CAB_APPROVAL_GROUP: 2nd Approval Group
Tip
The type of IDs set above for SNOW may be different depending on how your team wants to handle SNOW automated changes.
If you need to have a separate CHG for PROD and BETA, then you can add separate steps for those as well.
Octopus DEV Deployment
If you would like your DEV environment to be deployed via Octopus (check with DevOps if Dev routes through Cloudflare yet, if not then you will have to go through these steps in order to deploy to DEV):
Ask DevOps to create a new project in Octopus for you by cloning the Private Client (Dashboard).
For your DEV build step in your pipeline, extend from .build-for-octopus-dev
mu-build-dev:
extends: .build-for-octopus-dev
only:
changes: [ apps/app-platform-pc-mu/**/* ]
needs: [ mu-initiate ]
variables:
TARGET_ENV: develop
TARGET_ARTIFACT: dev
TARGET_PROJECT: app-platform-pc-mu
TARGET_BASE_HREF: /pc-mu/
TARGET_DIST_DIR: ./dist/apps/app-platform-pc-mu
- Add Octopus release step after dev build and extend from .octo-release template
mu-octopus-release:
extends: .octo-release
only:
changes: [ apps/app-platform-pc-mu/**/* ]
needs: [ mu-build-dev, mu-build-beta, mu-build-production ]
variables:
TARGET_PROJECT: app-platform-pc
CHANNEL_ID: Channels-1761
PROJECT_ID: Projects-1761
Tip
You would need to set the project and channel IDs of your new Octopus project. These values can be retrieved by using the Octopus APIs: https://digitaloctopus.investec.com/api/Spaces-1/projects/<new_cloned_project_name>
You can deploy this and check that your new pipeline is triggered and that the DEV deployment on Octopus (if you have configured to deploy there) has passed successfully. If so, we can continue.
Apache Configuration
The next step is that you need to set up vhost in apache for dev. In the sso.conf file for UK and SA dev in the apache project add another section as shown below and change pc-mu to your app path:
# pc-mu web platform config
Alias /pc-mu D:/Investec/pc-mu
<Directory D:/Investec/pc-mu>
Order Allow,Deny
Allow from all
</Directory>
### pc-mu (/pc-mu) SPECIFIC SPA REWRITES START ###
# not rewrite css, js and images
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !bin/restproxy
RewriteCond %{REQUEST_URI} /pc-mu/* [NC]
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png|svg|json|ico|woff|woff2)$ [NC]
RewriteRule ^(.*)$ /pc-mu/index.html [NC,QSA]
### pc-mu (/pc-mu) SPECIFIC SPA REWRITES END ###
# SPA routes
RewriteRule ^/pc-mu/.*$ $0 [PT]
# /pc-mu web platform config
Merge this and deploy merged version via Octopus. Deploy Infra-SA-DEV and Infra-UK-DEV.
Tip
Only DEV vhost needs to be set up and not STG/BETA/PROD
Once deployed, you can check if you can access the new path of you application on DEV and STG by changing /io to /<app_name>. Example: /io/pbmu/account-details becomes /pc-mu/pbmu/account-details.
Potential Errors
- URL Not Found: ask Charl or Ruhan to restart the worker
Running Old and New Pipelines in Parallel
Your new URL path and the original path (/io) will both be available. Once you are ready to make the switch to the new path, you will need to update any rewrites that you have in Apache to use the new path.
Note that if you make any changes to your app and deploy, you will notice that changes will only be reflected in the new URL.
If you are not ready to make the switch to the new URL path for all your pages then you will need to follow the steps below in order to trigger Private Client (Dashboard) project on Octopus (i.e. the old way we used to deploy to the different environments).
In app-platform-pc.yml in /pipelines/app-platform-pc add your new app location in the changes field so that this pipeline can be triggered for any changes in your app directory.
Add this to all steps of the pipeline expect for:
- pc-deploy-branch
- pc-banking-sa-await-approval
Next you must do the same changes in the digital-wealth-sa.yml in /pipelines/digital-wealth-sa in all those pipeline steps except for:
- test-wealth-sa
- pc-wealth-sa-change-request