Skip to content

Commit c8fbe62

Browse files
authored
Merge branch 'develop' into members-list-functionality
2 parents a1dea67 + 8f141a1 commit c8fbe62

File tree

46 files changed

+1933
-738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1933
-738
lines changed

Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1+
# Builds and runs ASPNET project Analysim
12
# Requires running database
23
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
34
WORKDIR /source
4-
COPY src .
55

6-
# install NPM
7-
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -yq curl git nano
6+
# install Node.js and Python
7+
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -yq curl git nano python3 python3-venv python3-pip
88
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -yq nodejs build-essential
99
RUN npm install -g npm
1010

11+
# Install .Net EF Tools
12+
RUN dotnet tool install --global dotnet-ef --version 6.0
13+
ENV PATH="$PATH:/root/.dotnet/tools"
14+
15+
# then copy sources so previous step is cached
16+
COPY src .
17+
1118
# build project
1219
WORKDIR Analysim.Web
1320
RUN dotnet publish --configuration Release -o /app
1421

1522
# run database migrations
1623
FROM build as database-update
1724
WORKDIR /source/Analysim.Web
18-
RUN dotnet tool install --global dotnet-ef --version 6.0
19-
ENV PATH="$PATH:/root/.dotnet/tools"
2025
CMD dotnet ef database update
2126

2227
# run project in new container

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ git clone https://github.com/soft-eng-practicum/AnalySim.git
1818
- [Visual Studio](https://visualstudio.microsoft.com/downloads/) or [ASP.Net 6.0 command-line interface (CLI)](https://dotnet.microsoft.com/en-us/download) (Required)
1919
- [Visual Studio Code](https://code.visualstudio.com/download) or other editor
2020
- [Postman](https://www.postman.com/downloads/) for testing API calls
21+
- [Python](https://www.python.org/downloads/) for building project
2122
- [Docker](https://www.docker.com/products/docker-desktop) for testing deployment
2223
- [Azure Data Studio](https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver15) or use online [Azure Portal](https://portal.azure.com) for browsing Azure Blob Storage
2324

@@ -32,6 +33,13 @@ command.
3233
npm install
3334
```
3435

36+
Then navigate to `AnalySim\src\Analysim.Web\ClientApp\src\assets\jupyter` folder and run the following commands.
37+
38+
```sh
39+
python -m pip install -r requirements.txt
40+
jupyter-lite build --output-dir dist
41+
```
42+
3543
### Connecting to databases and other services
3644

3745
Analysim requires two databases to operate: one SQL database (PostgreSQL) for relational data and one Azure BlobStorage database for keeping uploaded user files. In addition, an Outlook account is needed for the email functionality. All of these services are accessed via authentication information stored in the `appsettings.json` and `appsettings.Development.json` files under the `src/Analysim.Web` folder. The structure of the files are as follows (`XXX` means redacted):
@@ -138,7 +146,7 @@ You can run Analysim and the PostGreSQL in containers using Docker Compose. You
138146
```
139147
1. Create the Docker image by running the following in the base project folder (e.g. `Analysim/`) :
140148
```bash
141-
docker build -t analysim-dev -f deploy/Dockerfile .
149+
docker build -t analysim-dev -f Dockerfile-run .
142150
```
143151
1. Test image locally, by running it:
144152
```bash

docker-compose-db.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.1'
2-
31
services:
42

53
db-update:

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Use postgres/example user/password credentials
2-
version: '3.1'
3-
42
services:
53

64
db:

src/Analysim.Core/Services/BlobService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public async Task<BlobDownloadInfo> GetNotebookAsync(Notebook notebook)
6868
var containerClient = _blobServiceClient.GetBlobContainerClient(notebook.Container.ToLower());
6969

7070
// Get File Reference
71-
var blobClient = containerClient.GetBlobClient(notebook.Directory+notebook.Name + notebook.Extension);
71+
var blobClient = containerClient.GetBlobClient(notebook.Directory + notebook.Name + notebook.Extension);
7272

7373
// Download File
7474
BlobDownloadInfo blobDownloadInfo = await blobClient.DownloadAsync();
@@ -167,7 +167,7 @@ public async Task<BlobClient> CreateFolder(string container, string filePath)
167167
public async Task<BlobClient> CreateNotebookFolder(string container, string filePath)
168168
{
169169
// Get Storage Container
170-
var containerClient = _blobServiceClient.GetBlobContainerClient("notebook-"+container.ToLower());
170+
var containerClient = _blobServiceClient.GetBlobContainerClient("notebook-" + container.ToLower());
171171

172172
bool isExist = containerClient.Exists();
173173
if (!isExist)
@@ -288,7 +288,7 @@ public async Task<BlobClient> DeleteNotebookAsync(Notebook notebook)
288288
// Get Storage Container
289289
var containerClient = _blobServiceClient.GetBlobContainerClient(notebook.Container.ToLower());
290290

291-
if(notebook.type== "new" || notebook.type== "collab" || notebook.type=="folder")
291+
if (notebook.type == "new" || notebook.type == "colab" || notebook.type == "folder")
292292
{
293293
var blobClient = containerClient.GetBlobClient(notebook.Directory + notebook.Name + notebook.Extension);
294294
await blobClient.DeleteIfExistsAsync();

src/Analysim.Infrastructure/Data/ApplicationDbContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
9999
public DbSet<UserUser> UserUsers { get; set; }
100100

101101
public DbSet<Notebook> Notebook {get;set;}
102+
public DbSet<ObservableNotebookDataset> ObservableNotebookDataset { get;set;}
102103

103104

104105

src/Analysim.Web/Analysim.Web.csproj

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,41 @@
6262
</Exec>
6363
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
6464
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
65-
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
65+
<Exec WorkingDirectory="$(SpaRoot)" Command="npm --legacy-peer-deps install" />
66+
</Target>
67+
68+
<Target Name="BuildJupyterLite" BeforeTargets="Build" Condition=" !Exists('$(SpaRoot)src\assets\jupyter\dist') ">
69+
<Message Importance="high" Text="Installing dependencies and building JupyterLite on '$(OS)'" />
70+
71+
<!-- Commands for Linux -->
72+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command="python3 -m venv .env" Condition="'$(OS)' == 'Unix'" />
73+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command=".env/bin/python3 -m pip install -r requirements.txt" Condition="'$(OS)' == 'Unix'" />
74+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command=".env/bin/jupyter lite build --output-dir dist" Condition="'$(OS)' == 'Unix'" />
75+
76+
<!-- Commands for Windows -->
77+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command="python -m pip install -r requirements.txt" Condition="'$(OS)' == 'Windows_NT'" />
78+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command="jupyter-lite build --output-dir dist" Condition="'$(OS)' == 'Windows_NT'" />
79+
<ItemGroup>
80+
<JupyterIndex Include="$(SpaRoot)src\assets\jupyter\index.html"/>
81+
</ItemGroup>
82+
<Copy SourceFiles="@(JupyterIndex)" DestinationFolder="$(SpaRoot)src\assets\jupyter\dist\lab\" />
6683
</Target>
6784

6885
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
6986
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
70-
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
87+
<Exec WorkingDirectory="$(SpaRoot)" Command="npm --legacy-peer-deps install" />
88+
<!-- Commands for Linux -->
89+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command="python3 -m venv .env" Condition="'$(OS)' == 'Unix'" />
90+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command=".env/bin/python3 -m pip install -r requirements.txt" Condition="'$(OS)' == 'Unix'" />
91+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command=".env/bin/jupyter lite build --output-dir dist" Condition="'$(OS)' == 'Unix'" />
92+
93+
<!-- Commands for Windows -->
94+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command="python -m pip install -r requirements.txt" Condition="'$(OS)' == 'Windows_NT'" />
95+
<Exec WorkingDirectory="$(SpaRoot)src\assets\jupyter" Command="jupyter-lite build --output-dir dist" Condition="'$(OS)' == 'Windows_NT'" />
96+
<ItemGroup>
97+
<JupyterIndex Include="$(SpaRoot)src\assets\jupyter\index.html"/>
98+
</ItemGroup>
99+
<Copy SourceFiles="@(JupyterIndex)" DestinationFolder="$(SpaRoot)src\assets\jupyter\dist\lab\" />
71100
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --configuration production" />
72101
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --configuration production" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
73102

0 commit comments

Comments
 (0)