-
Notifications
You must be signed in to change notification settings - Fork 1
1. Setup development environment
To set up the development environment, there are two main configurations methods:
- Docker & Visual Studio (Recommended)
- Stand Alone (no Docker and you can choose any IDE you like, for example Visual Studio Code)
-
Install Docker Desktop
- You can get it for Windows and Mac here
-
Install Visual Studio
- Use the Community Edition if you don't have a license. During installation, select the "ASP.NET and web development" toolbox when given the choice to enable good support for Docker and the application.
-
Open the solution (the code) in Visual Studio
- Open Visual Studio and open the solution file
Nexpo.sln
.
- Open Visual Studio and open the solution file
-
Make sure the
docker-compose
"project" is selected as the startup project- If not already selected as the startup project, right click
docker-compose
in the Solution Explorer and select "Set as Startup Project".
- If not already selected as the startup project, right click
-
Run the backend
- A databse with automatically be created
-
Install Docker Desktop
- You can get it for Windows and Mac here
- Containerize the database, by running:
docker run -d --name nexpo_database -p 5432:5432 -e POSTGRES_USER=nexpo -e POSTGRES_PASSWORD=nexpo postgres:14
Click to Expand for additional information
2. The default development database connection tries to access the database nexpo on localhost:5432 using the credentials nexpo:nexpo. The nexpo user of course needs the correct permissions on the database and if you change anything in the setup make sure to update the connection string as well.
3. It will pull down the correct PostgreSQL server and set it up as we want it. Keep in mind though that no persistent volume is added to the container so don't do this in production.
summary {
cursor: pointer;
font-weight: bold;
} </style>
-
Install .NET SDK
- It is available here
-
Run the backend
- Run the following command to run:
dotnet run --project Nexpo
Click to Expand for additional information
1. Change directories to the `Nexpo` project folder.
2. run `dotnet run` (without the `--project Nexpo` flag)
summary {
cursor: pointer;
font-weight: bold;
} </style>
How to visualize DBeaver
2. Download DBeaver https://dbeaver.io/download/
3. Connect to open postgres connection with settings Postgresql and default 5432 default port. db_name, user, password as nexpo
summary {
cursor: pointer;
font-weight: bold;
} </style>
No matter the chosen setup method, it´s required to start an external database server before running the tests for them to pass. This is due to some tests utilizing black-box testing through testing against the controllers. It may take a while for the container to populate the tables with the example data, so if most controller-tests fail during the first run try to run them again.
NOTE: Running docker-compose in Visual Studio and then the tests do for some reason not work, even though it creates and starts the postgres container. Try instead to run the the shell command which creates a separate container for testing:
docker run -d --name nexpo_database -p 5432:5432 -e POSTGRES_USER=nexpo -e POSTGRES_PASSWORD=nexpo postgres:14