diff --git a/src/ClientApp/.dockerignore b/src/ClientApp/.dockerignore new file mode 100644 index 0000000..c5ffd90 --- /dev/null +++ b/src/ClientApp/.dockerignore @@ -0,0 +1,6 @@ +**/.dockerignore +**/.vs +**/.vscode +**/Dockerfile* +**/node_modules +!**/.env \ No newline at end of file diff --git a/src/ClientApp/.env b/src/ClientApp/.env index 8aae9ac..e9a34ea 100644 --- a/src/ClientApp/.env +++ b/src/ClientApp/.env @@ -3,7 +3,7 @@ BROWSER=none REACT_APP_LOCAL_ONLY=Y REACT_APP_FRONTEND=https://localhost:7174 -REACT_APP_API=https://localhost:7174/api +REACT_APP_API=https://reverseproxy:7174/api REACT_APP_SITEID=404c8232-9048-4519-bfba-6e78dc7005ca REACT_APP_LOCALE=en-US diff --git a/src/ClientApp/ClientApp.njsproj b/src/ClientApp/ClientApp.njsproj index 5fc9746..4609479 100644 --- a/src/ClientApp/ClientApp.njsproj +++ b/src/ClientApp/ClientApp.njsproj @@ -32,6 +32,14 @@ true + + Content + Dockerfile + + + + + @@ -116,6 +124,7 @@ + @@ -127,7 +136,6 @@ - @@ -178,6 +186,7 @@ + @@ -186,12 +195,6 @@ - - - - - - @@ -221,7 +224,6 @@ - diff --git a/src/ClientApp/Dockerfile b/src/ClientApp/Dockerfile new file mode 100644 index 0000000..619b3a9 --- /dev/null +++ b/src/ClientApp/Dockerfile @@ -0,0 +1,14 @@ +FROM node:lts as base +WORKDIR /app +ENV CI=true +ENV PORT=3000 + +EXPOSE 3000 + +FROM base as build +COPY ["ClientApp/", "/app"] +RUN npm ci +CMD [ "npm", "start" ] + +#FROM build as final +#COPY ["ClientApp/build", "/app"] diff --git a/src/Extensions/BytesExtensions.cs b/src/Extensions/BytesExtensions.cs index dc49b57..f1406b2 100644 --- a/src/Extensions/BytesExtensions.cs +++ b/src/Extensions/BytesExtensions.cs @@ -82,5 +82,46 @@ namespace Extensions { return false; } + + + + + private static readonly string[] suffixes = { "Bytes", "KB", "MB", "GB", "TB", "PB" }; + + private static decimal FormatSize(int bytes, int index = 1) => (decimal)bytes / 1024 * index; + + public static string ToKB(this int bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes, 1), suffixes[1]); + + public static string ToKB(this byte[] bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes.Length, 1), suffixes[1]); + + + public static string ToMB(this int bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes, 2), suffixes[2]); + + public static string ToMB(this byte[] bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes.Length, 2), suffixes[2]); + + + public static string ToGB(this int bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes, 3), suffixes[3]); + + public static string ToGB(this byte[] bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes.Length, 3), suffixes[3]); + + + public static string ToTB(this int bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes, 4), suffixes[4]); + + public static string ToTB(this byte[] bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes.Length, 4), suffixes[4]); + + + public static string ToPB(this int bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes, 5), suffixes[5]); + + public static string ToPB(this byte[] bytes) => + string.Format("{0:n1}{1}", FormatSize(bytes.Length, 5), suffixes[5]); } } diff --git a/src/ReverseProxy/appsettings.json b/src/ReverseProxy/appsettings.json index 3d65dc6..37678e9 100644 --- a/src/ReverseProxy/appsettings.json +++ b/src/ReverseProxy/appsettings.json @@ -48,7 +48,7 @@ "cluster2": { "Destinations": { "destination1": { - "Address": "http://localhost:3000/" + "Address": "http://clientapp:3000/" } } } diff --git a/src/WeatherForecast/Dockerfile b/src/WeatherForecast/Dockerfile index 97c0d5d..8c8f30c 100644 --- a/src/WeatherForecast/Dockerfile +++ b/src/WeatherForecast/Dockerfile @@ -8,13 +8,11 @@ EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build WORKDIR /src COPY ["WeatherForecast/WeatherForecast.csproj", "WeatherForecast/"] -COPY ["Services/FileSecurityService/FileSecurityService.csproj", "Services/FileSecurityService/"] +COPY ["FileSecurityService/FileSecurityService.csproj", "Services/FileSecurityService/"] COPY ["Extensions/Extensions.csproj", "Extensions/"] COPY ["Core/Core.csproj", "Core/"] -COPY ["Services/ImageProvider/ImageProvider.csproj", "Services/ImageProvider/"] +COPY ["ImageProvider/ImageProvider.csproj", "Services/ImageProvider/"] COPY ["DataProviders/DataProviders.csproj", "DataProviders/"] -COPY ["Services/JWTService/JWTService.csproj", "Services/JWTService/"] -COPY ["Services/HashService/HashService.csproj", "Services/HashService/"] RUN dotnet restore "WeatherForecast/WeatherForecast.csproj" COPY . . WORKDIR "/src/WeatherForecast" diff --git a/src/docker-compose.dcproj b/src/docker-compose.dcproj index 7f80434..be68195 100644 --- a/src/docker-compose.dcproj +++ b/src/docker-compose.dcproj @@ -5,7 +5,7 @@ Linux 7fc6f0ba-2dcb-4b53-a3b3-61ceef42b9d0 LaunchBrowser - {Scheme}://localhost:{ServicePort}/swagger + {Scheme}://localhost:{ServicePort} reverseproxy diff --git a/src/docker-compose.override.yml b/src/docker-compose.override.yml index 3cc723f..e5b9457 100644 --- a/src/docker-compose.override.yml +++ b/src/docker-compose.override.yml @@ -1,10 +1,25 @@ version: '3.4' +# Settings and configurations that are common for all containers +x-env-file-common: &env-file-common + env_file: + - './ClientApp/.env' + - './docker-compose/variables.env' + networks: my-network: driver: "bridge" services: + clientapp: + <<: *env-file-common + #ports: + # - "3000:3000" + depends_on: + - reverseproxy + networks: + - "my-network" + reverseproxy: environment: - ASPNETCORE_ENVIRONMENT=Development @@ -21,12 +36,14 @@ services: - "my-network" weatherforecast: + <<: *env-file-common environment: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=https://+:7151;http://+:5133 - ports: - - "7151:7151" - - "5133:5133" + + #ports: + # - "7151:7151" + # - "5133:5133" volumes: - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 494ba20..68480de 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -1,6 +1,11 @@ version: '3.4' services: + clientapp: + image: ${DOCKER_REGISTRY-}clientapp + build: + context: . + dockerfile: ClientApp/Dockerfile weatherforecast: image: ${DOCKER_REGISTRY-}weatherforecast build: diff --git a/src/docker-compose/mongo/data/db/WiredTiger.turtle b/src/docker-compose/mongo/data/db/WiredTiger.turtle index a45ed45..390104a 100644 --- a/src/docker-compose/mongo/data/db/WiredTiger.turtle +++ b/src/docker-compose/mongo/data/db/WiredTiger.turtle @@ -3,4 +3,4 @@ WiredTiger 10.0.2: (December 21, 2021) WiredTiger version major=10,minor=0,patch=2 file:WiredTiger.wt -access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=,cache_resident=false,checksum=on,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,readonly=false,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,tiered_object=false,tiered_storage=(auth_token=,bucket=,bucket_prefix=,cache_directory=,local_retention=300,name=,object_target_size=0),value_format=S,verbose=[],version=(major=1,minor=1),write_timestamp_usage=none,checkpoint=(WiredTigerCheckpoint.127717=(addr="019681e4fb9f7e379f81e4f489d9b8a081e4070e71ea808080e301ffc0e3010fc0",order=127717,time=1681378661,size=81920,newest_start_durable_ts=0,oldest_start_ts=0,newest_txn=188,newest_stop_durable_ts=0,newest_stop_ts=-1,newest_stop_txn=-11,prepare=0,write_gen=383947,run_write_gen=383679)),checkpoint_backup_info=,checkpoint_lsn=(82,75904) +access_pattern_hint=none,allocation_size=4KB,app_metadata=,assert=(commit_timestamp=none,durable_timestamp=none,read_timestamp=none,write_timestamp=off),block_allocation=best,block_compressor=,cache_resident=false,checksum=on,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,ignore_in_memory_cache_size=false,internal_item_max=0,internal_key_max=0,internal_key_truncate=true,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=true),memory_page_image_max=0,memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=false,prefix_compression_min=4,readonly=false,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=90,tiered_object=false,tiered_storage=(auth_token=,bucket=,bucket_prefix=,cache_directory=,local_retention=300,name=,object_target_size=0),value_format=S,verbose=[],version=(major=1,minor=1),write_timestamp_usage=none,checkpoint=(WiredTigerCheckpoint.127995=(addr="018081e4886024688181e4d73f01df8281e4e69d0e29808080e3021fc0e3010fc0",order=127995,time=1685108131,size=81920,newest_start_durable_ts=0,oldest_start_ts=0,newest_txn=298,newest_stop_durable_ts=0,newest_stop_ts=-1,newest_stop_txn=-11,prepare=0,write_gen=384809,run_write_gen=384387)),checkpoint_backup_info=,checkpoint_lsn=(87,118016) diff --git a/src/docker-compose/mongo/data/db/WiredTiger.wt b/src/docker-compose/mongo/data/db/WiredTiger.wt index 5a702c0..5b806cc 100644 Binary files a/src/docker-compose/mongo/data/db/WiredTiger.wt and b/src/docker-compose/mongo/data/db/WiredTiger.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-2--4715807334585891142.wt b/src/docker-compose/mongo/data/db/collection-2--4715807334585891142.wt index c55ede6..e77271c 100644 Binary files a/src/docker-compose/mongo/data/db/collection-2--4715807334585891142.wt and b/src/docker-compose/mongo/data/db/collection-2--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/collection-4--4715807334585891142.wt b/src/docker-compose/mongo/data/db/collection-4--4715807334585891142.wt index 62c521b..e3824a0 100644 Binary files a/src/docker-compose/mongo/data/db/collection-4--4715807334585891142.wt and b/src/docker-compose/mongo/data/db/collection-4--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-09T12-27-50Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-09T12-27-50Z-00000 new file mode 100644 index 0000000..1714bdc Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-09T12-27-50Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-16T10-11-38Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-16T10-11-38Z-00000 new file mode 100644 index 0000000..8b94dd8 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-16T10-11-38Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T09-33-29Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T09-33-29Z-00000 new file mode 100644 index 0000000..782ca8b Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T09-33-29Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T10-25-24Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T10-25-24Z-00000 new file mode 100644 index 0000000..7426967 Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T10-25-24Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T11-17-03Z-00000 b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T11-17-03Z-00000 new file mode 100644 index 0000000..6f1124e Binary files /dev/null and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.2023-05-26T11-17-03Z-00000 differ diff --git a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.interim b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.interim index 13687d9..9ae2094 100644 Binary files a/src/docker-compose/mongo/data/db/diagnostic.data/metrics.interim and b/src/docker-compose/mongo/data/db/diagnostic.data/metrics.interim differ diff --git a/src/docker-compose/mongo/data/db/index-3--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-3--4715807334585891142.wt index 2c615f0..0b60b41 100644 Binary files a/src/docker-compose/mongo/data/db/index-3--4715807334585891142.wt and b/src/docker-compose/mongo/data/db/index-3--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/index-5--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-5--4715807334585891142.wt index d27499f..5698784 100644 Binary files a/src/docker-compose/mongo/data/db/index-5--4715807334585891142.wt and b/src/docker-compose/mongo/data/db/index-5--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/index-6--4715807334585891142.wt b/src/docker-compose/mongo/data/db/index-6--4715807334585891142.wt index 607f02a..9efb051 100644 Binary files a/src/docker-compose/mongo/data/db/index-6--4715807334585891142.wt and b/src/docker-compose/mongo/data/db/index-6--4715807334585891142.wt differ diff --git a/src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000082 b/src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000087 similarity index 99% rename from src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000082 rename to src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000087 index e47984c..42609b0 100644 Binary files a/src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000082 and b/src/docker-compose/mongo/data/db/journal/WiredTigerLog.0000000087 differ diff --git a/src/docker-compose/mongo/data/db/sizeStorer.wt b/src/docker-compose/mongo/data/db/sizeStorer.wt index ec56698..973becf 100644 Binary files a/src/docker-compose/mongo/data/db/sizeStorer.wt and b/src/docker-compose/mongo/data/db/sizeStorer.wt differ diff --git a/src/docker-compose/variables.env b/src/docker-compose/variables.env new file mode 100644 index 0000000..e69de29