Started with docker compose config. Switched to new config system. Upgraded mooncore packages
This commit is contained in:
@@ -21,5 +21,6 @@
|
|||||||
**/obj
|
**/obj
|
||||||
**/secrets.dev.yaml
|
**/secrets.dev.yaml
|
||||||
**/values.dev.yaml
|
**/values.dev.yaml
|
||||||
|
**/storage
|
||||||
LICENSE
|
LICENSE
|
||||||
README.md
|
README.md
|
||||||
27
Moonlight.ApiServer/Dockerfile
Normal file
27
Moonlight.ApiServer/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
USER $APP_UID
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["Moonlight.ApiServer/Moonlight.ApiServer.csproj", "Moonlight.ApiServer/"]
|
||||||
|
COPY ["Moonlight.Client/Moonlight.Client.csproj", "Moonlight.Client/"]
|
||||||
|
COPY ["Moonlight.Shared/Moonlight.Shared.csproj", "Moonlight.Shared/"]
|
||||||
|
RUN dotnet restore "Moonlight.ApiServer/Moonlight.ApiServer.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/Moonlight.ApiServer"
|
||||||
|
RUN dotnet build "Moonlight.ApiServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "Moonlight.ApiServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
|
||||||
|
# Create storage directory a volume can bind to
|
||||||
|
RUN mkdir -p /app/storage
|
||||||
|
|
||||||
|
ENTRYPOINT ["dotnet", "Moonlight.ApiServer.dll"]
|
||||||
@@ -5,7 +5,7 @@ namespace Moonlight.ApiServer.Helpers;
|
|||||||
|
|
||||||
public class ApplicationStateHelper
|
public class ApplicationStateHelper
|
||||||
{
|
{
|
||||||
public static ConfigService<AppConfiguration>? Configuration { get; private set; }
|
public static AppConfiguration Configuration { get; private set; }
|
||||||
|
|
||||||
public static void SetConfiguration(ConfigService<AppConfiguration>? configuration) => Configuration = configuration;
|
public static void SetConfiguration(AppConfiguration configuration) => Configuration = configuration;
|
||||||
}
|
}
|
||||||
@@ -8,12 +8,12 @@ namespace Moonlight.ApiServer.Helpers;
|
|||||||
|
|
||||||
public abstract class DatabaseContext : DbContext
|
public abstract class DatabaseContext : DbContext
|
||||||
{
|
{
|
||||||
private ConfigService<AppConfiguration>? ConfigService;
|
private AppConfiguration? Configuration;
|
||||||
public abstract string Prefix { get; }
|
public abstract string Prefix { get; }
|
||||||
|
|
||||||
public DatabaseContext()
|
public DatabaseContext()
|
||||||
{
|
{
|
||||||
ConfigService = ApplicationStateHelper.Configuration;
|
Configuration = ApplicationStateHelper.Configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
@@ -23,14 +23,14 @@ public abstract class DatabaseContext : DbContext
|
|||||||
|
|
||||||
// If no config service has been configured, we are probably
|
// If no config service has been configured, we are probably
|
||||||
// in a EF Core migration, so we need to construct the config manually
|
// in a EF Core migration, so we need to construct the config manually
|
||||||
if (ConfigService == null)
|
if (Configuration == null)
|
||||||
{
|
{
|
||||||
ConfigService = new ConfigService<AppConfiguration>(
|
Configuration = new ConfigService<AppConfiguration>(
|
||||||
PathBuilder.File("storage", "config.json")
|
PathBuilder.File("storage", "app.json")
|
||||||
);
|
).Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = ConfigService.Get().Database;
|
var config = Configuration.Database;
|
||||||
|
|
||||||
var connectionString = $"host={config.Host};" +
|
var connectionString = $"host={config.Host};" +
|
||||||
$"port={config.Port};" +
|
$"port={config.Port};" +
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ public class AuthController : Controller
|
|||||||
{
|
{
|
||||||
private readonly OAuth2Service OAuth2Service;
|
private readonly OAuth2Service OAuth2Service;
|
||||||
private readonly TokenHelper TokenHelper;
|
private readonly TokenHelper TokenHelper;
|
||||||
private readonly ConfigService<AppConfiguration> ConfigService;
|
|
||||||
private readonly DatabaseRepository<User> UserRepository;
|
private readonly DatabaseRepository<User> UserRepository;
|
||||||
private readonly ILogger<AuthController> Logger;
|
private readonly ILogger<AuthController> Logger;
|
||||||
|
private readonly AppConfiguration Configuration;
|
||||||
private readonly IOAuth2Provider[] OAuth2Providers;
|
private readonly IOAuth2Provider[] OAuth2Providers;
|
||||||
private readonly IAuthInterceptor[] AuthInterceptors;
|
private readonly IAuthInterceptor[] AuthInterceptors;
|
||||||
|
|
||||||
@@ -34,18 +34,18 @@ public class AuthController : Controller
|
|||||||
OAuth2Service oAuth2Service,
|
OAuth2Service oAuth2Service,
|
||||||
TokenHelper tokenHelper,
|
TokenHelper tokenHelper,
|
||||||
DatabaseRepository<User> userRepository,
|
DatabaseRepository<User> userRepository,
|
||||||
ConfigService<AppConfiguration> configService,
|
|
||||||
ILogger<AuthController> logger,
|
ILogger<AuthController> logger,
|
||||||
IOAuth2Provider[] oAuth2Providers,
|
IOAuth2Provider[] oAuth2Providers,
|
||||||
IAuthInterceptor[] authInterceptors)
|
IAuthInterceptor[] authInterceptors,
|
||||||
|
AppConfiguration configuration)
|
||||||
{
|
{
|
||||||
OAuth2Service = oAuth2Service;
|
OAuth2Service = oAuth2Service;
|
||||||
TokenHelper = tokenHelper;
|
TokenHelper = tokenHelper;
|
||||||
UserRepository = userRepository;
|
UserRepository = userRepository;
|
||||||
ConfigService = configService;
|
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
OAuth2Providers = oAuth2Providers;
|
OAuth2Providers = oAuth2Providers;
|
||||||
AuthInterceptors = authInterceptors;
|
AuthInterceptors = authInterceptors;
|
||||||
|
Configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -94,7 +94,7 @@ public class AuthController : Controller
|
|||||||
// Generate local token-pair for the authentication
|
// Generate local token-pair for the authentication
|
||||||
// between client and the api server
|
// between client and the api server
|
||||||
|
|
||||||
var authConfig = ConfigService.Get().Authentication;
|
var authConfig = Configuration.Authentication;
|
||||||
|
|
||||||
var tokenPair = TokenHelper.GeneratePair(
|
var tokenPair = TokenHelper.GeneratePair(
|
||||||
authConfig.AccessSecret,
|
authConfig.AccessSecret,
|
||||||
@@ -117,7 +117,7 @@ public class AuthController : Controller
|
|||||||
[HttpPost("refresh")]
|
[HttpPost("refresh")]
|
||||||
public async Task<RefreshResponse> Refresh([FromBody] RefreshRequest request)
|
public async Task<RefreshResponse> Refresh([FromBody] RefreshRequest request)
|
||||||
{
|
{
|
||||||
var authConfig = ConfigService.Get().Authentication;
|
var authConfig = Configuration.Authentication;
|
||||||
|
|
||||||
var tokenPair = TokenHelper.RefreshPair(
|
var tokenPair = TokenHelper.RefreshPair(
|
||||||
request.RefreshToken,
|
request.RefreshToken,
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ namespace Moonlight.ApiServer.Http.Controllers.Swagger;
|
|||||||
[Route("api/swagger")]
|
[Route("api/swagger")]
|
||||||
public class SwaggerController : Controller
|
public class SwaggerController : Controller
|
||||||
{
|
{
|
||||||
private readonly ConfigService<AppConfiguration> ConfigService;
|
private readonly AppConfiguration Configuration;
|
||||||
|
|
||||||
public SwaggerController(ConfigService<AppConfiguration> configService)
|
public SwaggerController(AppConfiguration configuration)
|
||||||
{
|
{
|
||||||
ConfigService = configService;
|
Configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult> Get()
|
public async Task<ActionResult> Get()
|
||||||
{
|
{
|
||||||
if (!ConfigService.Get().Development.EnableApiDocs)
|
if (!Configuration.Development.EnableApiDocs)
|
||||||
return BadRequest("Api docs are disabled");
|
return BadRequest("Api docs are disabled");
|
||||||
|
|
||||||
var options = new ApiDocsOptions();
|
var options = new ApiDocsOptions();
|
||||||
|
|||||||
@@ -16,14 +16,13 @@ public class LocalOAuth2Provider : IOAuth2Provider
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var configService = provider.GetRequiredService<ConfigService<AppConfiguration>>();
|
var configuration = provider.GetRequiredService<AppConfiguration>();
|
||||||
var config = configService.Get();
|
|
||||||
|
|
||||||
using var httpClient = new HttpClient();
|
using var httpClient = new HttpClient();
|
||||||
|
|
||||||
httpClient.DefaultRequestHeaders.Add("Authorization", accessToken);
|
httpClient.DefaultRequestHeaders.Add("Authorization", accessToken);
|
||||||
|
|
||||||
var response = await httpClient.GetAsync($"{config.PublicUrl}/oauth2/info");
|
var response = await httpClient.GetAsync($"{configuration.PublicUrl}/oauth2/info");
|
||||||
await response.HandlePossibleApiError();
|
await response.HandlePossibleApiError();
|
||||||
var info = await response.ParseAsJson<InfoResponse>();
|
var info = await response.ParseAsJson<InfoResponse>();
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,18 @@ namespace Moonlight.ApiServer.Implementations.Startup;
|
|||||||
|
|
||||||
public class ApiDocsStartup : IAppStartup, IEndpointStartup
|
public class ApiDocsStartup : IAppStartup, IEndpointStartup
|
||||||
{
|
{
|
||||||
private readonly ConfigService<AppConfiguration> ConfigService;
|
|
||||||
private readonly ILogger<ApiDocsStartup> Logger;
|
private readonly ILogger<ApiDocsStartup> Logger;
|
||||||
|
private readonly AppConfiguration AppConfiguration;
|
||||||
|
|
||||||
public ApiDocsStartup(ConfigService<AppConfiguration> configService, ILogger<ApiDocsStartup> logger)
|
public ApiDocsStartup(ILogger<ApiDocsStartup> logger, AppConfiguration appConfiguration)
|
||||||
{
|
{
|
||||||
ConfigService = configService;
|
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
|
AppConfiguration = appConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task BuildApp(IHostApplicationBuilder builder)
|
public Task BuildApp(IHostApplicationBuilder builder)
|
||||||
{
|
{
|
||||||
if(!ConfigService.Get().Development.EnableApiDocs)
|
if(!AppConfiguration.Development.EnableApiDocs)
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
@@ -36,7 +36,7 @@ public class ApiDocsStartup : IAppStartup, IEndpointStartup
|
|||||||
|
|
||||||
public Task ConfigureEndpoints(IEndpointRouteBuilder routeBuilder)
|
public Task ConfigureEndpoints(IEndpointRouteBuilder routeBuilder)
|
||||||
{
|
{
|
||||||
if(!ConfigService.Get().Development.EnableApiDocs)
|
if(!AppConfiguration.Development.EnableApiDocs)
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
routeBuilder.MapSwagger("/api/swagger/{documentName}");
|
routeBuilder.MapSwagger("/api/swagger/{documentName}");
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -12,9 +13,9 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MoonCore" Version="1.6.8" />
|
<PackageReference Include="MoonCore" Version="1.7.1" />
|
||||||
<PackageReference Include="MoonCore.Extended" Version="1.1.3" />
|
<PackageReference Include="MoonCore.Extended" Version="1.1.3" />
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.2" />
|
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.4" />
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
|
||||||
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
|
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
|
||||||
@@ -27,7 +28,12 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Database\Migrations\" />
|
<Folder Include="Database\Migrations\" />
|
||||||
<Folder Include="storage\" />
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\.dockerignore">
|
||||||
|
<Link>.dockerignore</Link>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using MoonCore.Extended.Helpers;
|
using MoonCore.Extended.Helpers;
|
||||||
using MoonCore.Extensions;
|
using MoonCore.Extensions;
|
||||||
@@ -32,15 +33,6 @@ Console.WriteLine();
|
|||||||
// Storage i guess
|
// Storage i guess
|
||||||
Directory.CreateDirectory(PathBuilder.Dir("storage"));
|
Directory.CreateDirectory(PathBuilder.Dir("storage"));
|
||||||
|
|
||||||
// Configuration
|
|
||||||
var configService = new ConfigService<AppConfiguration>(
|
|
||||||
PathBuilder.File("storage", "config.json")
|
|
||||||
);
|
|
||||||
|
|
||||||
var config = configService.Get();
|
|
||||||
|
|
||||||
ApplicationStateHelper.SetConfiguration(configService);
|
|
||||||
|
|
||||||
// TODO: Load plugin/module assemblies
|
// TODO: Load plugin/module assemblies
|
||||||
|
|
||||||
// Configure startup logger
|
// Configure startup logger
|
||||||
@@ -60,7 +52,14 @@ var startupLogger = startupLoggerFactory.CreateLogger("Startup");
|
|||||||
|
|
||||||
// Configure startup interfaces
|
// Configure startup interfaces
|
||||||
var startupServiceCollection = new ServiceCollection();
|
var startupServiceCollection = new ServiceCollection();
|
||||||
startupServiceCollection.AddSingleton(configService);
|
|
||||||
|
startupServiceCollection.AddConfiguration(options =>
|
||||||
|
{
|
||||||
|
options.UsePath(PathBuilder.Dir("storage"));
|
||||||
|
options.UseEnvironmentPrefix("MOONLIGHT");
|
||||||
|
|
||||||
|
options.AddConfiguration<AppConfiguration>("app");
|
||||||
|
});
|
||||||
|
|
||||||
startupServiceCollection.AddLogging(loggingBuilder => { loggingBuilder.AddProviders(providers); });
|
startupServiceCollection.AddLogging(loggingBuilder => { loggingBuilder.AddProviders(providers); });
|
||||||
|
|
||||||
@@ -73,12 +72,15 @@ startupServiceCollection.AddPlugins(configuration =>
|
|||||||
|
|
||||||
// Configure assemblies to scan
|
// Configure assemblies to scan
|
||||||
configuration.AddAssembly(Assembly.GetEntryAssembly()!);
|
configuration.AddAssembly(Assembly.GetEntryAssembly()!);
|
||||||
}, startupLogger);
|
});
|
||||||
|
|
||||||
|
|
||||||
var startupServiceProvider = startupServiceCollection.BuildServiceProvider();
|
var startupServiceProvider = startupServiceCollection.BuildServiceProvider();
|
||||||
var appStartupInterfaces = startupServiceProvider.GetRequiredService<IAppStartup[]>();
|
var appStartupInterfaces = startupServiceProvider.GetRequiredService<IAppStartup[]>();
|
||||||
|
|
||||||
|
var config = startupServiceProvider.GetRequiredService<AppConfiguration>();
|
||||||
|
ApplicationStateHelper.SetConfiguration(config);
|
||||||
|
|
||||||
// Start the actual app
|
// Start the actual app
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@@ -108,7 +110,7 @@ foreach (var startupInterface in appStartupInterfaces)
|
|||||||
}
|
}
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
builder.Services.AddSingleton(configService);
|
builder.Services.AddSingleton(config);
|
||||||
builder.Services.AutoAddServices<Program>();
|
builder.Services.AutoAddServices<Program>();
|
||||||
builder.Services.AddSingleton<TokenHelper>();
|
builder.Services.AddSingleton<TokenHelper>();
|
||||||
builder.Services.AddHttpClient();
|
builder.Services.AddHttpClient();
|
||||||
@@ -123,7 +125,7 @@ builder.Services.AddPlugins(configuration =>
|
|||||||
configuration.AddInterface<IAuthInterceptor>();
|
configuration.AddInterface<IAuthInterceptor>();
|
||||||
|
|
||||||
configuration.AddAssembly(Assembly.GetEntryAssembly()!);
|
configuration.AddAssembly(Assembly.GetEntryAssembly()!);
|
||||||
}, startupLogger);
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -12,14 +12,12 @@ namespace Moonlight.ApiServer.Services;
|
|||||||
public class AuthService
|
public class AuthService
|
||||||
{
|
{
|
||||||
private readonly DatabaseRepository<User> UserRepository;
|
private readonly DatabaseRepository<User> UserRepository;
|
||||||
private readonly ConfigService<AppConfiguration> ConfigService;
|
private readonly AppConfiguration Configuration;
|
||||||
|
|
||||||
public AuthService(
|
public AuthService(DatabaseRepository<User> userRepository, AppConfiguration configuration)
|
||||||
DatabaseRepository<User> userRepository,
|
|
||||||
ConfigService<AppConfiguration> configService)
|
|
||||||
{
|
{
|
||||||
UserRepository = userRepository;
|
UserRepository = userRepository;
|
||||||
ConfigService = configService;
|
Configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<User> Register(string username, string email, string password)
|
public Task<User> Register(string username, string email, string password)
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public static class Startup
|
|||||||
|
|
||||||
public static async Task ConfigureLogging(IHostApplicationBuilder builder)
|
public static async Task ConfigureLogging(IHostApplicationBuilder builder)
|
||||||
{
|
{
|
||||||
|
// Create logging path
|
||||||
|
Directory.CreateDirectory(PathBuilder.Dir("storage", "logs"));
|
||||||
|
|
||||||
// Configure application logging
|
// Configure application logging
|
||||||
builder.Logging.ClearProviders();
|
builder.Logging.ClearProviders();
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
<PackageReference Include="Blazor-ApexCharts" Version="3.5.0" />
|
<PackageReference Include="Blazor-ApexCharts" Version="3.5.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6"/>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.6" PrivateAssets="all"/>
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.6" PrivateAssets="all"/>
|
||||||
<PackageReference Include="MoonCore" Version="1.6.8" />
|
<PackageReference Include="MoonCore" Version="1.7.1" />
|
||||||
<PackageReference Include="MoonCore.Blazor" Version="1.2.5" />
|
<PackageReference Include="MoonCore.Blazor" Version="1.2.5" />
|
||||||
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.2" />
|
<PackageReference Include="MoonCore.PluginFramework" Version="1.0.4" />
|
||||||
<PackageReference Include="MoonCore.Blazor.Tailwind" Version="1.1.0" />
|
<PackageReference Include="MoonCore.Blazor.Tailwind" Version="1.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ builder.Services.AddPlugins(configuration =>
|
|||||||
configuration.AddInterface<IAppScreen>();
|
configuration.AddInterface<IAppScreen>();
|
||||||
|
|
||||||
configuration.AddInterface<ISidebarItemProvider>();
|
configuration.AddInterface<ISidebarItemProvider>();
|
||||||
}, logger);
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|||||||
41
compose.yml
Normal file
41
compose.yml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
services:
|
||||||
|
api-server:
|
||||||
|
image: moonlightpanel/panel:custom
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./Moonlight.ApiServer/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "9069:8080"
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
- MOONLIGHT_APP_DATABASE_HOST=db
|
||||||
|
- MOONLIGHT_APP_DATABASE_PORT=3306
|
||||||
|
- MOONLIGHT_APP_DATABASE_USERNAME=moonlight
|
||||||
|
- MOONLIGHT_APP_DATABASE_PASSWORD=s3cret
|
||||||
|
- MOONLIGHT_APP_DATABASE_DATABASE=moonlight
|
||||||
|
- MOONLIGHT_APP_PUBLICURL=http://localhost:9069
|
||||||
|
volumes:
|
||||||
|
- api_data:/app/storage
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
pull_policy: build
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mysql:latest
|
||||||
|
environment:
|
||||||
|
- MYSQL_ROOT_PASSWORD=s3cret
|
||||||
|
- MYSQL_PASSWORD=s3cret
|
||||||
|
- MYSQL_DATABASE=moonlight
|
||||||
|
- MYSQL_USER=moonlight
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/mysql
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
|
timeout: 1s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
api_data:
|
||||||
|
db_data:
|
||||||
Reference in New Issue
Block a user