Skip to content

TorOskar/altinn-studio

 
 

Repository files navigation

Altinn Studio

Altinn Studio build status Altinn Apps build status

Altinn Studio is the next generation Altinn application development solution. Together with Altinn Apps and Altinn Platform, it makes a complete application development and hosting platform.

An early test version of Altinn Studio is available at https://altinn.studio.

Use the documentation to get started using Altinn Studio.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

  1. Latest .NET Core 3.1 SDK
  2. Node.js (Version 10.*)
  3. Newest Git
  4. A code editor - we like Visual Studio Code
  5. Docker Desktop
  6. 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.
localhost altinn3.no
127.0.0.1 altinn3.no
localhost altinn3local.no
127.0.0.1 altinn3local.no
  1. Make sure your C drive is shared with docker, Docker Settings -> Shared Drives
    On MacOS: Change docker-compose.yml (both)
      volumes:
        - "C:/AltinnCore/Repos:/AltinnCore/Repos"
    to:
      volumes:
        - "/Users/<yourname>/AltinnCore/Repos:/AltinnCore/Repos"
  2. World Wide Web Publishing Service must be disabled, Services -> "World Wide Web Publishing Service" rigth click and choose "stop"

Installing

Clone Altinn Studio repo and navigate to the folder.

git clone https://github.com/Altinn/altinn-studio
cd altinn-studio

Run all parts of the solution in containers (Make sure docker is running)

docker-compose up -d --build

The solution is now available locally at altinn3.no

If you make changes and want to rebuild a specific project using docker-compose this can be done using

docker-compose up -d --build <container>

Example

docker-compose up -d --build altinn_designer

Running solutions locally

Designer

The Designer component can be run locally when developing/debugging. The rest of the solution (Repository and Loadbalancer) will still have to be running in containers. Follow the install steps above if this has not already been done.

Stop the container running Designer

docker stop altinn-designer

Navigate to the Designer folder. The first time running, or after any package changes, get the latest packages.

cd src/AltinnCore/Designer
npm ci
npm run gulp-install-deps

Build and run the code.

dotnet build
npm run gulp # first time only
npm run gulp-develop

If you are not going to edit the designer react app you can use

cd src\AltinnCore\Designer
npm ci
npm run gulp
dotnet run

Which will build the Designer .net backend and the designer react app, but not listen to changes to the react app.

Apps

If you only need to develop and debug App-Frontend, you can follow the description in 5) (only) and deploy the app to any test environment. The App-Frontend will be loaded from your local webpack-dev-server.

It's possible to run an app locally in order to test and debug it. It needs a local version of the platform services to work.

_NOTE: Currently, it is not possible to run Apps and Altinn Studio (designer) in parallel. To run Apps, make sure that none of the containers for Altinn Studio are running, f.ex. by navigating to the root of the altinn-studio repo, and running the command

docker-compose down

Setting up local platform services for test

  1. Navigate to the development folder in the altinn-studio repo
cd src/development
  1. Start the loadbalancer container that routes between the local platform services and the app
docker-compose up -d --build
  1. Set path to app folder in local platform services:
  • Open appSettings.json in the LocalTest folder, f.ex. in Visual Studio Code
cd LocalTest
code appSettings.json
  • Change the setting "AppRepsitoryBasePath" to the full path to your app on the disk. Save the file.
  1. Start the local platform services (make sure you are in the LocalTest folder)
dotnet run
  1. Navigate to the app folder (specified in the step above)
cd \.\<path to app on disk>
  • If you need to debug (or run locally) the app front-end:
    • Open the file views/Home/Index.cshtml and change the line

      <script src="https://altinncdn.no/altinn-apps/runtime/js/react/runtime.js"></script>
      

      to

      <script src="http://localhost:8080/runtime.js"></script>
      
      • Build and run the runtime front-end project locally (altinn-studio/src/react-apps/applications/runtime):
      npm start
  1. 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 altinn3local.no.

Log in with a test user, using your app name and org name. This will redirect you to the app.

Building other react apps

If you need to rebuild other react apps, for instance Dashboard or ServiceDevelopment, this can be done by navigating to their respective folders, example src/react-apps/applications/dashboard and then run the following build script

npm run build

Some of the react projects also have various other predefined npm tasks, which can be viewed in the package.json file which is located in the root folder of each react project, example src/react-apps/applications/dashboard/package.json

Platform Receipt

The platform receipt component can run locally, both in docker and manually.

Manual

  • Open a terminal in src/Altinn.Platform/Altinn.Platform.Receipt
  • run npm install
  • run npm run gulp (if running for the first time, otherwise this can be skipped)
  • run npm run gulp-install-deps
  • run npm run gulp-develop

This will build and run receipt back end, and build and copy the receipt frontend to the wwwroot folder. The application should now be available at localhost:5060/receipt/{instanceOwnerId}/{instanceId} The script wil also listen to changes in the receipt react app, rebuild and copy the new react app to the wwwroot folder.

Docker

  • Open a terminal in src/Altinn.Platform/Altinn.Platform.Receipt
  • run docker compose up
  • The application should now be available at localhost:5060/receipt/{instanceOwnerId}/{instanceId}

Running the tests

End to end tests

Automated end to end tests are currently being developed.

Coding style tests

Coding style tests are available for the React front end application, using tslint.

Navigate to the React front end application and run linting.

cd src/react-apps/applications/ux-editor
npm run lint

Deployment

The current build is deployed in Kubernetes on Azure.

Automated build/deploy process is being developed.

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the 3-Clause BSD License - see the LICENSE.md file for details.

About

Next generation Altinn applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 53.9%
  • TypeScript 22.7%
  • JavaScript 10.8%
  • HTML 6.6%
  • CSS 5.0%
  • Java 0.6%
  • Other 0.4%