Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/backend-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 10.0.x

- name: Restore dependencies
run: dotnet restore
Expand All @@ -28,10 +28,13 @@ jobs:
{
"JwtSettings": {
"Issuer": "AnalySim",
"Secret": "very_hard_secret",
"Secret": "github-actions-smoke-test-secret-with-at-least-32-chars",
"ExpireTime": 60,
"Audience": "https://www.analysim.tech/"
},
"ConnectionStrings": {
"DBConnectionString": "Host=localhost;Port=5432;Database=analysim;Username=postgres;Password=postgres"
},
"Logging": {
"LogLevel": {
"Default": "Information",
Expand All @@ -48,20 +51,20 @@ jobs:
- name: Start backend
run: |
cd src/Analysim.Web
dotnet run --no-launch-profile > ../../backend.log 2>&1 &
ASPNETCORE_URLS=http://localhost:5000 ASPNETCORE_ENVIRONMENT=Development dotnet run --no-launch-profile --no-build --configuration Release > ../../backend.log 2>&1 &
echo $! > ../../backend.pid

- name: Wait for backend to be ready
run: |
for i in {1..15}; do
RESPONSE=$(curl -k -s https://localhost:5001/api/health || true)
RESPONSE=$(curl -s http://localhost:5000/api/health || true)

if [[ "$RESPONSE" == *Healthy* ]]; then
echo "Backend is healthy"
exit 0
fi

echo "Attempt $i/30: backend not ready yet"
echo "Attempt $i/15: backend not ready yet"
sleep 6
done

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Builds and runs ASPNET project Analysim
# Requires running database
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /source

# install Node.js and Python
Expand All @@ -9,7 +9,7 @@ RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -
RUN npm install -g npm

# Install .Net EF Tools
RUN dotnet tool install --global dotnet-ef --version 6.0
RUN dotnet tool install --global dotnet-ef --version 10.0.9
ENV PATH="$PATH:/root/.dotnet/tools"

# then copy sources so previous step is cached
Expand All @@ -25,7 +25,7 @@ WORKDIR /source/Analysim.Web
CMD dotnet ef database update

# run project in new container
FROM mcr.microsoft.com/dotnet/aspnet:6.0 as run
FROM mcr.microsoft.com/dotnet/aspnet:10.0 as run
WORKDIR /app
COPY --from=build /app .

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.run
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Run published project
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
WORKDIR /app
COPY src/Analysim.Web/bin/Release/net6.0/publish/ .
COPY src/Analysim.Web/bin/Release/net10.0/publish/ .

#CMD ASPNETCORE_URLS=http://*:$PORT dotnet Analysim.Web.dll
CMD dotnet Analysim.Web.dll
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ git clone https://github.com/soft-eng-practicum/AnalySim.git

### Required software for development

- [Visual Studio](https://visualstudio.microsoft.com/downloads/) or [ASP.Net 6.0 command-line interface (CLI)](https://dotnet.microsoft.com/en-us/download) (Required)
- [Visual Studio](https://visualstudio.microsoft.com/downloads/) or [ASP.NET 10.0 command-line interface (CLI)](https://dotnet.microsoft.com/en-us/download) (Required)
- [Visual Studio Code](https://code.visualstudio.com/download) or other editor
- [Postman](https://www.postman.com/downloads/) for testing API calls
- [Python](https://www.python.org/downloads/) for building project
Expand Down Expand Up @@ -128,7 +128,7 @@ line by first navigating into the `src\Analysim.Web` folder:
```sh
dotnet run --environment Development
```
(This will also automatically run Angular and a [Swagger](https://learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-8.0&tabs=visual-studio) UI on port 5001)
(This will also automatically run Angular and a [Swagger](https://learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-10.0&tabs=visual-studio) UI on port 5001)

## Deploying

Expand Down
4 changes: 2 additions & 2 deletions deploy/build.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Learn about building .NET container images:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /source

# copy csproj and restore as distinct layers
Expand Down Expand Up @@ -30,7 +30,7 @@ RUN dotnet publish -o /app --configuration Release
#RUN dotnet ef database update

# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Analysim.Web.dll"]
20 changes: 9 additions & 11 deletions src/Analysim.Core/Analysim.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>Analysim.Core</AssemblyName>
<RootNamespace>Analysim.Core</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.13.0" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.29.1" />
<PackageReference Include="MailKit" Version="4.17.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NETCore.MailKit" Version="2.1.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="6.1.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions src/Analysim.Core/Entities/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Core.Entities
{
[Microsoft.EntityFrameworkCore.Index(nameof(Route), IsUnique = true)]
public class Project

{
Expand All @@ -30,7 +31,6 @@ public class Project


[Required(ErrorMessage = "Project Route is a required field.")]
[Index(IsUnique = true)]
public string Route { get; set; }

public List<ProjectTag> ProjectTags { get; set; }
Expand All @@ -50,4 +50,3 @@ public class Project
}
}


2 changes: 1 addition & 1 deletion src/Analysim.Core/Entities/Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

namespace Core.Entities
{
[Microsoft.EntityFrameworkCore.Index(nameof(Name), IsUnique = true)]
public class Tag
{
[KeyAttribute]
public int TagID { get; set; }

[Required(ErrorMessage = "Tag Name is a required field.")]
[Index(IsUnique = true)]
public string Name { get; set; }

public ICollection<ProjectTag> ProjectTags { get; } = new List<ProjectTag>();
Expand Down
10 changes: 5 additions & 5 deletions src/Analysim.Infrastructure/Analysim.Infrastructure.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>Analysim.Infrastructure</AssemblyName>
<RootNamespace>Analysim.Infrastructure</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6">
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.5" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Analysim.Infrastructure/Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.OnDelete(DeleteBehavior.Cascade);

modelBuilder.Entity<IdentityRole<int>>().HasData(
new IdentityRole<int> { Id = 1, Name = "Admin", NormalizedName = "ADMIN" },
new IdentityRole<int> { Id = 2, Name = "Customer", NormalizedName = "CUSTOMER" },
new IdentityRole<int> { Id = 3, Name = "Moderator", NormalizedName = "MODERATOR" }
new IdentityRole<int> { Id = 1, Name = "Admin", NormalizedName = "ADMIN", ConcurrencyStamp = "d7c6278e-3f78-4db6-8832-aa41ea9fd62c" },
new IdentityRole<int> { Id = 2, Name = "Customer", NormalizedName = "CUSTOMER", ConcurrencyStamp = "7383e31e-a884-4cd6-82f7-a6287b4e30a5" },
new IdentityRole<int> { Id = 3, Name = "Moderator", NormalizedName = "MODERATOR", ConcurrencyStamp = "398ef1f2-6b82-45f2-9601-ed2129f197e9" }
);

// Many To One Relationship ( ObservableNotebookDataset -> Notebook)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("ProductVersion", "10.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
Expand Down Expand Up @@ -239,6 +239,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.HasKey("ProjectID");

b.HasIndex("Route")
.IsUnique();

b.ToTable("Projects");
});

Expand Down Expand Up @@ -478,8 +481,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("Volume")
.HasColumnType("text");

b.Property<int?>("Year")
.IsRequired()
b.Property<int>("Year")
.HasColumnType("integer");

b.HasKey("PublicationID");
Expand All @@ -503,6 +505,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.HasKey("TagID");

b.HasIndex("Name")
.IsUnique();

b.ToTable("Tag");
});

Expand Down
Loading
Loading