Last modified: Oct 2, 2024

Module 3

Build and deploy application to test environment

This module requires that you are part of an organization with an enabled test environment for Altinn Apps. If this is not the case, move on to the next module.

If you have a personal application registered that you would like to move to an organization, you can ask for access to an organization by asking an administrator or the service desk.

When you have access to an organization with enabled test environments, the application can be moved by following these steps:

  1. Move the repository for the application in Gitea to your organization via the “Settings” menu on the Gitea-page.
  2. Update the id and org-fields in the App/config/applicationmetadata.json-file, so that they refer to the new organization

In this module you are going to build and deploy the application to Altinn’s test environment (TT02) and verify that everything works as expected.

Topics covered in this module:

  • Set custom requirements for resource use
  • Building application
  • Deploying application

Tasks

All applications come with a standard setup for resource use and scaling in the application cluster. This setup can be overridden if your application has different needs.

  • You can change the number of replicas (instances of the application running at once)
  • You can change the rules for how early or late the application should scale the number of instances based on CPU or memory usage
  • You can change how much resources are to be dedicated to the application’s instances in the cluster.

By overriding these values, smaller applications may save costs, and for bigger applications make sure they have optimal performance with all necessary resources available.

For this test application, we want you to scale down resource usage to a minimum.

Scaling: replicaCount: 1

Resource use: Set requests to cpu: 50m and memory: 128Mi

All changes related to scaling and resource use are made in the deployment/values.yaml file

Useful documentation

When you refer to building an application in Altinn Studio, this means creating a version of the current state of the application that can be deployed to one or more environments.

Create a new build for the application with version number 0.0.1 and add a descriptive comment of what the version includes.

Useful documentation

Deploying an application to the test environment allows you to test all integrations. In addition to this, TT02 is often used to verify that an application works as expected before deploying to production.

To be able to deploy an application to TT02, the organization that owns the application has to have an app cluster in the test environment. In addition to this, the developer deploying the application needs the role Deploy-TT02 for the organization in Altinn Studio.

Deploy your application to TT02.

Useful documentation

Knowledge check

  • Is it possible to have two versions of one application in TT02 at the same time?
  • What happens if you try to deploy your application using an existing version number?
  • Will the application be available immediately after deployment?
  • Is it possible to remove an application from the environment after deployment?

At the deployment page you will find the direct link to your application. It is in the format {org}.apps.tt02.altinn.no/{org}/{app}

Unless you’re already logged in with a user this link will bring you to Altinn’s login page. Your organization should have access to a set of test users, use one of these to log in.

Internal users in Digdir can use the “TestID” electronic ID, which lets you generate a random personal ID, or retrieve credentials from the internal Altinn 3 testing dataset.

Test the different tracks and pages to confirm that the behaviour is as expected.

Summary

In this module you have built and deployed your application to TT02, logged into Altinn with a test user and tested your application.

Løsningsforslag

Source code Module 3

The following changes have been made to the code:

App/deployment/values.yaml
deployment:
  
  replicaCount: 1
  
  requests:
      cpu: 50m
      memory: 128Mi

...