Reorganize backend to mirror Musify.slnx folder structure
Moves the six backend projects on disk into Core/ and Hosts/ subfolders, matching the solution folders already defined in Musify.slnx, so the file explorer reflects the same layout as the solution: backend/Core/Musify.Domain backend/Core/Musify.Application backend/Core/Musify.Infrastructure backend/Hosts/Musify.Api backend/Hosts/Musify.Worker backend/Hosts/Musify.StreamingGateway Updates every reference to the old paths: ProjectReference entries in Musify.Api.csproj and Musify.Worker.csproj, the three Dockerfiles, deploy/scripts/migrate.ps1|sh, deploy/zitadel/provision.ps1, deploy/up.ps1, deploy/README.md and docs/development.md. Also fixes a stale Dockerfile comment pointing at a compose file that no longer exists. Verified with `dotnet build Musify.slnx` against the new layout.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"Database": {
|
||||
"ConnectionString": "Host=localhost;Port=59000;Database=musify_db;Username=postgres;Password=postgres"
|
||||
},
|
||||
"MassTransit": {
|
||||
"Address": "rabbitmq://localhost:5672",
|
||||
"Username": "guest",
|
||||
"Password": "guest"
|
||||
},
|
||||
"OpenTelemetry": {
|
||||
"OtlpEndpoint": "http://localhost:4317"
|
||||
},
|
||||
"YouTube": {
|
||||
"GeographicalLocation": "ES"
|
||||
},
|
||||
"InfrastructureStorage": {
|
||||
"Address": "http://localhost:8333",
|
||||
"AccessKey": "admin_access_key",
|
||||
"SecretAccessKey": "admin_secret_key",
|
||||
"ForcePathStyle": true,
|
||||
"UseHttp": true
|
||||
},
|
||||
"ApplicationStorage": {
|
||||
"Bucket": "webapi-storage"
|
||||
},
|
||||
"AudioTranscoder": {
|
||||
"Routes": {
|
||||
"WorkingDirectory": "../../deploy/.tmp"
|
||||
}
|
||||
},
|
||||
"Workers": {
|
||||
"Routes": {
|
||||
"TemporaryFilesDirectory": "../../deploy/.tmp"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"Database": {
|
||||
"ConnectionString": ""
|
||||
},
|
||||
"MassTransit": {
|
||||
"Address": "",
|
||||
"Username": "",
|
||||
"Password": ""
|
||||
},
|
||||
"OpenTelemetry": {
|
||||
"OtlpEndpoint": ""
|
||||
},
|
||||
"InfrastructureStorage": {
|
||||
"Address": "",
|
||||
"AccessKey": "",
|
||||
"SecretAccessKey": "",
|
||||
"ForcePathStyle": false,
|
||||
"UseHttp": false
|
||||
},
|
||||
"ApplicationStorage": {
|
||||
"Bucket": ""
|
||||
},
|
||||
"Mix": {
|
||||
"ArtistMixCount": 3,
|
||||
"ItemsPerMix": 12,
|
||||
"SeedArtistCount": 3,
|
||||
"YouTubeResultsPerSeed": 12
|
||||
},
|
||||
"PlayList": {
|
||||
"Routes": {
|
||||
"ParentFolders": "PlayLists",
|
||||
"OriginalPicturesFolder": "OriginalPictures",
|
||||
"SmallPicturesFolder": "SmallPictures",
|
||||
"MediumPicturesFolder": "MediumPictures",
|
||||
"LargePicturesFolder": "LargePictures"
|
||||
},
|
||||
"PicturesSizes": {
|
||||
"SmallPictureWidth": 128,
|
||||
"SmallPictureHeight": 128,
|
||||
"MediumPictureWidth": 256,
|
||||
"MediumPictureHeight": 256,
|
||||
"LargePictureWidth": 512,
|
||||
"LargePictureHeight": 512
|
||||
},
|
||||
"SeedPresetPictures": true,
|
||||
"OverwritePresetPictures": false
|
||||
},
|
||||
"Track": {
|
||||
"Routes": {
|
||||
"ParentFolder": "Tracks",
|
||||
"OriginalPicturesFolder": "OriginalPictures",
|
||||
"SmallPicturesFolder": "SmallPictures",
|
||||
"MediumPicturesFolder": "MediumPictures",
|
||||
"LargePicturesFolder": "LargePictures",
|
||||
"PresetOriginalPicture": "PresetOriginalPicture.webp",
|
||||
"PresetSmallPicture": "PresetSmallPicture.webp",
|
||||
"PresetMediumPicture": "PresetMediumPicture.webp",
|
||||
"PresetLargePicture": "PresetLargePicture.webp",
|
||||
"OriginalAudiosFolder": "OriginalAudios",
|
||||
"ProcessedAudioFolder": "ProcessedAudios"
|
||||
},
|
||||
"PicturesSizes": {
|
||||
"SmallPictureWidth": 128,
|
||||
"SmallPictureHeight": 128,
|
||||
"MediumPictureWidth": 256,
|
||||
"MediumPictureHeight": 256,
|
||||
"LargePictureWidth": 512,
|
||||
"LargePictureHeight": 512
|
||||
}
|
||||
},
|
||||
"AudioTranscoder": {
|
||||
"Routes": {
|
||||
"WorkingDirectory": ""
|
||||
},
|
||||
"TranscodingTimeout": "00:05:00"
|
||||
},
|
||||
"YtDlp": {
|
||||
"ExecutableName": "yt-dlp",
|
||||
"Format": "bestaudio",
|
||||
"AdditionalArguments": "",
|
||||
"DownloadTimeout": "00:05:00"
|
||||
},
|
||||
"Workers": {
|
||||
"Routes": {
|
||||
"TemporaryFilesDirectory": ""
|
||||
}
|
||||
},
|
||||
"UploadIntent": {
|
||||
"UploadUrlExpiresInSeconds": 120,
|
||||
"MaxActiveUploadIntentsPerUser": 5,
|
||||
"MaxActiveUploadBytesPerUser": 209715200,
|
||||
"MaxUploadBytes": 104857600,
|
||||
"DefaultExpectedPictureSizeBytes": 10485760,
|
||||
"DefaultExpectedAudioSizeBytes": 104857600,
|
||||
"ExpirationJobIntervalSeconds": 300,
|
||||
"ExpiredIntentsRetentionDays": 7,
|
||||
"TempRootPrefix": "temp",
|
||||
"TempUploadsRetentionDays": 3,
|
||||
"TempCleanupJobIntervalSeconds": 3600
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Worker">
|
||||
|
||||
<PropertyGroup>
|
||||
<UserSecretsId>dotnet-PictureWorker-1dfff89f-0602-41b7-8eaf-4da2c3358789</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.S3" />
|
||||
<PackageReference Include="MassTransit" />
|
||||
<PackageReference Include="MassTransit.RabbitMQ" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" />
|
||||
<PackageReference Include="MimeMapping" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Core\Musify.Application\Musify.Application.csproj" />
|
||||
<ProjectReference Include="..\..\Core\Musify.Domain\Musify.Domain.csproj" />
|
||||
<ProjectReference Include="..\..\Core\Musify.Infrastructure\Musify.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,58 @@
|
||||
using Hangfire;
|
||||
using Mediator;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Musify.Application.Configuration;
|
||||
using Musify.Application.Services;
|
||||
using Musify.Infrastructure.Jobs;
|
||||
using Musify.Infrastructure.MassTransit;
|
||||
using Musify.Infrastructure.Persistence;
|
||||
using Musify.Infrastructure.Services;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder();
|
||||
|
||||
// Registering Mediator pulls in every handler in Musify.Application, including ones
|
||||
// (e.g. CreatePlayList, CreateTrack) that depend on IEventBus, which the Worker never
|
||||
// registers because it only consumes events, it never publishes them. Only the handlers
|
||||
// this process actually dispatches (GenerateMixesForUserCommand) are ever constructed,
|
||||
// so the default eager validate-on-build check is too strict for this host.
|
||||
builder.ConfigureContainer(new DefaultServiceProviderFactory(new ServiceProviderOptions
|
||||
{
|
||||
ValidateOnBuild = false,
|
||||
ValidateScopes = true
|
||||
}));
|
||||
|
||||
var configuration = builder.Configuration;
|
||||
|
||||
var services = builder.Services;
|
||||
|
||||
services.AddValidatedOptions<ApplicationStorageConfiguration>(configuration, ApplicationStorageConfiguration.SectionName);
|
||||
services.AddValidatedOptions<PlayListConfiguration>(configuration, PlayListConfiguration.SectionName);
|
||||
services.AddValidatedOptions<TrackConfiguration>(configuration, TrackConfiguration.SectionName);
|
||||
services.AddValidatedOptions<MixConfiguration>(configuration, MixConfiguration.SectionName);
|
||||
services.AddStorageService(configuration);
|
||||
services.AddAudioTranscoder(configuration);
|
||||
services.AddYouTubeDownloader(configuration);
|
||||
services.AddHttpClient();
|
||||
services.AddPictureService(configuration);
|
||||
services.AddPlayListPresetSeeder(configuration);
|
||||
services.AddDatabase(configuration);
|
||||
services.AddMassTransitConsumers(configuration);
|
||||
services.AddUploadIntentJobs(configuration);
|
||||
services.AddMediator();
|
||||
services.AddScoped<YouTubeTrackProvisioner>();
|
||||
services.AddYouTubeMusicService(configuration);
|
||||
services.AddDailyMixGenerationJob(configuration);
|
||||
|
||||
var host = builder.Build();
|
||||
|
||||
using (var scope = host.Services.CreateScope())
|
||||
{
|
||||
var recurringJobManager = scope.ServiceProvider.GetRequiredService<IRecurringJobManager>();
|
||||
recurringJobManager.AddOrUpdate<DailyMixGenerationJob>(
|
||||
"daily-mix-generation",
|
||||
job => job.RunAsync(CancellationToken.None),
|
||||
Cron.Daily(),
|
||||
new RecurringJobOptions { TimeZone = TimeZoneInfo.Utc });
|
||||
}
|
||||
|
||||
host.Run();
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"Worker": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"environmentVariables": {
|
||||
"DOTNET_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user