Overview:
This section provides a comprehensive guide for deploying an application to the Add-On Mart infrastructure (TEAM). Follow the steps outlined below to ensure a successful deployment.
Tools:
Add-On Mart tool - used to push images to Harbor registry, push instance module schema, helmfile templates to Add-On Mart.
For more details and Add-On Mart tool instructions, please refer → How to use Add-On Mart Tool for Testing environment (TEAM)
Documentation Variables:
The documentation contains custom variables:
- <application_name>
- <application_version>
- <vendor_name>
For details related to variables meaning, please refer => Guide to deploy application in Add-On Mart for third-party developers
Requirements:
Vendor credentials for deploying application and artifacts storing.
For details related to vendor credentials obtaining, please refer => Guide to deploy application in Add-On Mart for third-party developers
Artifacts:
For the purpose of this tutorial, we will be using this artifacts repository: https://gitlab.portaone.com:8949/read-only/tutorial-for-simple-application
Preconditions:
To deploy the application to TEAM, the "addon-mart" tool must be installed and configured in advance.
This guide provides a general comprehensive workflow for configuring and deploying the application to TEAM.
For more details related to "addon-mart" configuration, usage in the context of TEAM, settings on different OS, and tool-specific details, please refer to the application's README.md
and the instruction: How to use Add-On Mart Tool for Testing environment (TEAM)
1. Download the "addon-mart" tool repository
git clone https://gitlab.portaone.com:8949/read-only/microservices-tools-addonmart.git && cd microservices-tools-addonmart
2. Install "addon-mart" tool
make install os=[darwin|linux] arch=[amd64|arm64]
3. Set context to staging
addon-mart set-context staging
4. Set up application configuration
Unless instructed otherwise, use following values
server_url = https://ipaas-testenv.portaone.com
registry_hostname = registry.portaone.com
docker_repository_name = vendor_name
charts_repository_name = vendor_name
addon-mart set-app-settings --context staging \ --login <vendor_name> \ --password <vendor_password> \ --server-url <TEAM server url> \ --registry-addr <Harbor registry> \ --docker-repo-name <image repository name> \ --charts-repo-name <charts repository name>
Deployment workflow:
1. Create Docker Image
Build the Docker image using Docker Compose:
docker compose build
2. Push Artifacts to Add-On Mart Resources
Use the addon-mart
tool to push the Docker image, Helm charts, Helmfile templates, and module schema to Add-On Mart:
addon-mart sync \ --module_name <application_name> \ --configuration-schema ./schema/schema.json \ --image <application_name>:<application_version> \ --chart-dir ./charts_AddOnMart/ \ --version <application_version> \ --templates ./auto_deployer_templates
INFO: reading ./schema/schema.json file... INFO: pushing registry.portaone.com/<vendor_name>/<application_name>:<application_version> image to the registry... The push refers to repository [registry.portaone.com/<vendor_name>/<application_name>] 885e9846852f: Layer already exists b38fa00938bd: Layer already exists 35fa9ffc0696: Layer already exists ec6949936a52: Layer already exists f71fab544a97: Layer already exists d42276be00b5: Layer already exists cc2286334a7b: Layer already exists e0781bc8667f: Layer already exists <application_version>: digest: sha256:61133e2d8bff581ec4e34738bef02b6c9a04c844d0bb46a1df51746deee73eab size: 1995 SUCCESS: registry.portaone.com/<vendor_name>/<application_name>:<application_version> image has been successfully pushed to the registry. INFO: checking registry.portaone.com repository... INFO: pushing chart to registry.portaone.com repository... SUCCESS: the chart has been successfully pushed to the repository.
3. Create Application Instance
Create an instance of the application using the addon-mart
tool:
> addon-mart create --module_name <application_name> --instance_name <application_name>
Instance created successfully Instance ID: 168-3700 Config UI URL: https://ipaas-testenv-dev.portaone.com/ipaas-config-ui/?access_token=cDFfc2FnaXRhcmlvX3VzZXJfMTcyMzEwODc2MzozU2pid3pGMXhF&instance_id=168-3700
Link to the Add-On Mart Config UI was provided.
4. Configure Application
Follow the provided link and fill in the required data according to the uploaded module schema.
5. Save and Deploy Application
Save the configuration and deploy the application via the Config UI.
6. Troubleshoot Deployment Issues
If deployment fails, troubleshoot by verifying the following:
- Docker image creation
- Helm charts
- Module schema
- Helmfile templates
Refer to previous sections for detailed instructions on preparing artifacts.
Additionally, check the Harbor registry for the existence of the image and Helm charts, and verify versions.
Ensure that:
- Module schema name and version match the Helmfile (provided in the sync command).
- Helm charts exist in the repository stated in the Helmfile template with the correct version.
- Docker image stated in the Helm charts values.yaml exists in the Harbor registry with the specified tag.
- There are no inconsistencies in module schema name/version , helmfile name/version, Helm Charts name/version, Docker image name/tag
- There are no parameters overwritten by helmfile during the deployment (Helm Chart values are overriten with helmfile values). Review Helm Charts and helmfile templates.
- All mandatory fields were provided in helmfile template to satisfy Add-On Mart requirements → Step 6: Prepare helmfile - Auto-Deployer template
- All data/parameters/values that are required by application(Helm Charts + source code) for deployment were provided in Helm Charts values, helmfile templates:
- Step 4: Prepare Kubernetes Manifests to Deploy the Application Locally
- Step 6: Prepare helmfile - Auto-Deployer template
- Step 5: Prepare Helm Charts to Deploy the Application Locally
- Step 7: Adapt Helm Charts to Add-On Mart Specifics - All Add-On Mart requirements were satisfied → Step 7: Adapt Helm Charts to Add-On Mart Specifics
- There are no inconsistencies between helmfile templates and instance module schema provided:
- Step 2: Prepare a Config Schema for the Module
- Step 6: Prepare helmfile - Auto-Deployer template
Re-deploy the application if needed.
If issues persist and logs are insufficient to understand the root of the issue, contact PortaOne Support for further assistance.
7. Test Application
Test the application to confirm it works as expected:
Use domain name that was provided during application configuration on Config UI.
Endpoint /health:
curl -k -X 'GET' 'https://testenv-domain-05.portaone.com/health' | jq .
{ "status": "OK" }
Endpoint /config_values:
curl -k -X 'GET' 'https://testenv-domain-05.portaone.com/config_values' | jq .
{ "SERVER_URL": "https://jsonplaceholder.typicode.com/users", "CONFIG_OPTION": "Custom config value that was added via Config UI" }
Endpoint /environment_variables:
curl -k -X 'GET' 'https://testenv-domain-05.portaone.com/environment_variables' | jq . | grep -E 'CONFIG_PATH|BASE_PATH|CUSTOM_ENV_VARIABLE|SECRET_USERNAME|SECRET_PASSWORD|SECRET_BASE_64_ENCODED'
"CONFIG_PATH": "/app/config.yaml", "BASE_PATH": "/", "CUSTOM_ENV_VARIABLE": "Custom env var value that was added via Config UI", "SECRET_USERNAME": "My secret username", "SECRET_PASSWORD": "My secret password", "SECRET_BASE_64_ENCODED": "This string was encoded using base64",
Check that data configured via Config UI is properly saved. Ensure that configuration values, environment variables, and secrets are correctly set.
8. Check Application Logs
To review logs of the deployed application, use the Opensearch resource link: https://ipaas-testenv.portaone.com/logs
Log in to Opensearch using vendor credentials and set filters to monitor the required application or for troubleshooting purposes.
9. Remove Instance
After testing, remove the instance:
addon-mart remove 168-3700
Instance removed: {"instance_id":"168-3700","tag":"dev"}
Summary:
This instruction module provides a step-by-step guide for deploying an application to the Add-On Mart infrastructure. It covers building a Docker image, pushing artifacts to the registry, creating and configuring an application instance, deploying the application, troubleshooting potential issues, and testing the deployed application. Additionally, it includes steps for reviewing application logs and removing the instance after testing.
1 Comment
Kseniia Kriukova