It is possible to test and debug applications created in Altinn Studio on local development machine.
Currently we have not been able to provide a 100% common setup between Windows and Linux.
- Latest .NET 5.0 SDK
- Newest Git
- A code editor - we like Visual Studio Code
- Also install recommended extensions (f.ex. C# and Debugger for Chrome)
- For Windows/MacOS Docker Desktop
- Update hosts file (C:/Windows/System32/drivers/etc/hosts) by adding the following values. On MacOS add the same values to values /private/etc/hosts using cmd
sudo nano /private/etc/hosts
.127.0.0.1 altinn3local.no
- Clone the altinn-studio repository to a local folder
git clone https://github.com/Altinn/altinn-studio cd altinn-studio
- Navigate to the
development
folder in the altinn-studio repocd src/development
- Setting up loadbalancer
- Windows:
Start the loadbalancer container that routes between the local platform services and the appdocker-compose up -d --build
- Linux:
Install NGINXEdit the NGINX configurationsudo apt-get update sudo apt-get install nginx sudo service nginx start
Modify the default to this:cd /etc/nginx sudo nano nginx.conf
Save and go back to src/develpment folder in altinn-studioworker_processes 1; events { worker_connections 1024; } http { client_max_body_size 50M; sendfile on; upstream localtest { server 127.0.0.1:5101; } upstream app { server 127.0.0.1:5005; } server { listen 80; server_name altinn3local.no localhost; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location = / { proxy_pass http://localtest/Home/; } location / { proxy_pass http://app/; } location /Home/ { proxy_pass http://localtest/Home/; } location /localtestresources/ { proxy_pass http://localtest/localtestresources/; } } }
Reload NGINX configurationsudo nginx -s reload
- Windows:
- Set path to app folder in local platform services:
- Open
appSettings.json
in theLocalTest
folder, f.ex. in Visual Studio Codecd LocalTest code appSettings.json
- Change the setting
AppRepositoryBasePath
to the parent folder where you have your application repos (C:/repos/
as an example) as to your app on the disk. - Change the setting
LocalTestingStaticTestDataPath
to the full path of the altinn-studio repository. For example:"C:/repos/altinn-studio/src/development/TestData/"
- Save the file.
- Open
- Start the local platform services (make sure you are in the LocalTest folder)
dotnet run
- Navigate to the app folder (specified in the step above)
cd \.\<path to app on disk>
- Start the app locally
dotnet run -p App.csproj
The app and local platform services are now running locally. The app can be accessed on http://altinn3local.no.
Log in with a test user, using your app name and org name. This will redirect you to the app.