KeyCloak, dbcontext
This commit is contained in:
parent
329cedc660
commit
7e60a2b514
@ -1,7 +1,22 @@
|
|||||||
version: "3.8"
|
version: "3.8"
|
||||||
name: "keroosha-pechka-template"
|
name: "keroosha-pechka-template"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
keycloak:
|
||||||
|
image: quay.io/keycloak/keycloak:21.1.2
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
command:
|
||||||
|
# - "start-dev --import-realm"
|
||||||
|
- "start-dev"
|
||||||
|
# volumes:
|
||||||
|
# - ./realm-export.json:/opt/keycloak/data/import/main-realm.json:ro
|
||||||
|
environment:
|
||||||
|
- "KEYCLOAK_ADMIN=admin"
|
||||||
|
- "KEYCLOAK_ADMIN_PASSWORD=admin"
|
||||||
|
networks:
|
||||||
|
resources:
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:15-alpine
|
image: postgres:15-alpine
|
||||||
environment:
|
environment:
|
||||||
@ -9,6 +24,9 @@ services:
|
|||||||
POSTGRES_INITDB: 'pechka'
|
POSTGRES_INITDB: 'pechka'
|
||||||
ports:
|
ports:
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
|
networks:
|
||||||
|
resources:
|
||||||
|
|
||||||
minio:
|
minio:
|
||||||
image: quay.io/minio/minio
|
image: quay.io/minio/minio
|
||||||
command: server /data --console-address ":19001"
|
command: server /data --console-address ":19001"
|
||||||
@ -18,4 +36,10 @@ services:
|
|||||||
MINIO_ROOT_PASSWORD: 'pechka'
|
MINIO_ROOT_PASSWORD: 'pechka'
|
||||||
ports:
|
ports:
|
||||||
- "19000:9000" # S3 interface
|
- "19000:9000" # S3 interface
|
||||||
- "19001:19001" # Minio console
|
- "19001:19001" # Minio console
|
||||||
|
networks:
|
||||||
|
resources:
|
||||||
|
|
||||||
|
|
||||||
|
networks:
|
||||||
|
resources:
|
21
Keroosha.Pechka.Web/Database/AppDbContext.cs
Normal file
21
Keroosha.Pechka.Web/Database/AppDbContext.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using LinqToDB.Data;
|
||||||
|
using LinqToDB.DataProvider;
|
||||||
|
using Pechka.AspNet.Database;
|
||||||
|
|
||||||
|
namespace Keroosha.Pechka.Web.Database;
|
||||||
|
|
||||||
|
public class AppDbContext : DataConnection
|
||||||
|
{
|
||||||
|
public AppDbContext(string connectionString, IDataProvider provider) : base(provider, connectionString)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AppDbContextManager : DbContextManagerBase<AppDbContext>
|
||||||
|
{
|
||||||
|
public AppDbContextManager(IDataProvider provider, string connectionString):
|
||||||
|
base(() => new AppDbContext(connectionString, provider))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Database\Migrations\" />
|
||||||
|
<Folder Include="Database\Models\" />
|
||||||
<Folder Include="Frontend\src\" />
|
<Folder Include="Frontend\src\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// See https://aka.ms/new-console-template for more information
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
|
||||||
|
using Keroosha.Pechka.Web.Database;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
@ -19,6 +20,7 @@ void ConfigureOptions(IConfiguration configuration, IServiceCollection services)
|
|||||||
|
|
||||||
void ConfigureManagers(IServiceCollection services)
|
void ConfigureManagers(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
services.AddDbContextManager((z, x) => new AppDbContextManager(z, x));
|
||||||
services.AddHttpClient();
|
services.AddHttpClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user