Compare commits
3 Commits
stage
...
feature/Do
Author | SHA1 | Date | |
---|---|---|---|
4e50aa4e74 | |||
86d3cb9937 | |||
09a1c516a4 |
1
AAIntegration.SimmonsBank.API/.gitignore
vendored
1
AAIntegration.SimmonsBank.API/.gitignore
vendored
@ -23,6 +23,7 @@ bin/
|
||||
Bin/
|
||||
obj/
|
||||
Obj/
|
||||
screenshots/
|
||||
|
||||
# Sample Data
|
||||
/SampleData
|
||||
|
@ -8,12 +8,12 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!--<PropertyGroup>
|
||||
<ContainerImageName>ActiveAllocator-Integration-SimmonsBank</ContainerImageName>
|
||||
<PublishProfile>DefaultContainer</PublishProfile>
|
||||
<ContainerImageTags>1.0.0;latest</ContainerImageTags>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
</PropertyGroup>-->
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
||||
|
33
AAIntegration.SimmonsBank.API/Dockerfile
Normal file
33
AAIntegration.SimmonsBank.API/Dockerfile
Normal file
@ -0,0 +1,33 @@
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||
|
||||
#####################
|
||||
#PUPPETEER RECIPE
|
||||
#####################
|
||||
RUN apt-get update && apt-get -f install && apt-get -y install wget gnupg2 apt-utils
|
||||
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
|
||||
RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y google-chrome-stable --no-install-recommends --allow-downgrades fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf
|
||||
######################
|
||||
#END PUPPETEER RECIPE
|
||||
######################
|
||||
ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/google-chrome-stable"
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy everything
|
||||
COPY . ./
|
||||
# Restore as distinct layers
|
||||
RUN dotnet restore
|
||||
# Build and publish a release
|
||||
RUN dotnet publish -c Release -o out
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/out .
|
||||
ENTRYPOINT ["dotnet", "AAIntegration.SimmonsBank.API.dll"]
|
@ -46,6 +46,7 @@ public class CacheService : ICacheService
|
||||
if (!internalKeys.TryGetValue(apiKey, out var clientId))
|
||||
{
|
||||
_logger.LogInformation("Could not find API key. Returning -1.");
|
||||
PrintInternalKeys(internalKeys);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,8 @@ using Microsoft.Extensions.Logging;
|
||||
using NuGet.Protocol.Core.Types;
|
||||
using AAIntegration.SimmonsBank.API.Models.Accounts;
|
||||
using AAIntegration.SimmonsBank.API.Models.Transactions;
|
||||
using System.Runtime.Serialization;
|
||||
using Microsoft.Extensions.Logging.Console;
|
||||
|
||||
public interface IPuppeteerService
|
||||
{
|
||||
@ -175,6 +177,13 @@ public class PuppeteerService : IPuppeteerService
|
||||
{
|
||||
//_logger.LogWarning($"Login Task timed out for user '{user.Id}' after {timeout} seconds");
|
||||
_logger.LogError(0, ex, prefix + $"Login Task timed out after {timeout} seconds");
|
||||
await page.ScreenshotAsync(GenerateScreenshotPath());
|
||||
|
||||
string selector = @"document.querySelector('body > banno-web > bannoweb-login').shadowRoot.querySelector('div > jha-card > jha-error-message').innerHTML";
|
||||
string errorMessage = await page.EvaluateExpressionAsync<string>(selector)
|
||||
.WaitAsync(timeout, cancellationToken);
|
||||
_logger.LogError(errorMessage);
|
||||
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
@ -185,6 +194,11 @@ public class PuppeteerService : IPuppeteerService
|
||||
return false;
|
||||
}
|
||||
|
||||
private string GenerateScreenshotPath()
|
||||
{
|
||||
return "screenshots/" + DateTime.UtcNow.ToString("yyyy-MM-dd_HHmmss.ffffzzz") + ".png";
|
||||
}
|
||||
|
||||
public async Task<bool> IsLoggedIn(User user, CancellationToken cancellationToken)
|
||||
{
|
||||
string prefix = $"Task::IsLoggedIn - {user.Id} - ";
|
||||
@ -333,6 +347,7 @@ public class PuppeteerService : IPuppeteerService
|
||||
var options = new LaunchOptions {
|
||||
Headless = _config.Headless,
|
||||
IgnoreHTTPSErrors = true,
|
||||
Args = new [] { "--no-sandbox" }
|
||||
};
|
||||
|
||||
IBrowser browser = await Puppeteer.LaunchAsync(options).WaitAsync(TimeSpan.FromSeconds(_config.BrowserOperationTimeoutSeconds), cancellationToken);
|
||||
|
@ -63,6 +63,9 @@ public class PuppeteerWorker : BackgroundService
|
||||
|
||||
lastExecutedOn = DateTime.UtcNow;
|
||||
_logger.LogInformation("PuppeteerWorker executed at: {time}", DateTimeOffset.Now);
|
||||
|
||||
// TEMPORARY DON'T COMMIT!!!!
|
||||
await Task.Delay(TimeSpan.FromMinutes(120), stoppingToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6
DockerBuild.sh
Normal file
6
DockerBuild.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd AAIntegration.SimmonsBank.API/
|
||||
name="activeallocator-integration-simmonsbank"
|
||||
docker build -t $name:latest -t $name:1.0.0 -f Dockerfile .
|
||||
cd ../
|
Loading…
x
Reference in New Issue
Block a user