Compare commits

...

10 Commits

Author SHA1 Message Date
masoodafar-web
e46f54ca5b Merge branch 'test' into kub-stage
All checks were successful
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 2m16s
2025-12-06 00:17:39 +03:30
masoodafar-web
00ba911703 feat: Add archive and schedule fields to PublicMessages 2025-12-06 00:16:30 +03:30
masoud
bfcb0d880f feat: Read Seq logging config from appsettings.json + add Console logging 2025-12-05 19:32:28 +00:00
masoud
ed642947dc Fix: Suppress EF Core 9 PendingModelChangesWarning 2025-12-05 18:55:12 +00:00
masoud
c8db56ab2b Retry 2025-12-05 18:11:53 +00:00
masoud
80f4e124d6 Add insecure registry 2025-12-05 18:11:14 +00:00
masoud
e17b7f4588 Retry with fixed Dockerfile 2025-12-05 18:09:17 +00:00
masoud
4438a4d248 Fix Dockerfile for buildkit 2025-12-05 18:07:39 +00:00
masoud
eb43b084b2 Trigger 2025-12-05 18:06:11 +00:00
masoud
0c054739ba Fix proxy password 2025-12-05 18:05:52 +00:00
9 changed files with 3453 additions and 131 deletions

View File

@@ -16,8 +16,8 @@ jobs:
image: docker:latest
options: --privileged
env:
HTTP_PROXY: http://proxyuser:87zH26nbqT@46.249.98.211:3128
HTTPS_PROXY: http://proxyuser:87zH26nbqT@46.249.98.211:3128
HTTP_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128
HTTPS_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128
NO_PROXY: localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8
steps:
- name: Install git
@@ -27,15 +27,21 @@ jobs:
run: |
git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/CMS.git .
- name: Start Docker daemon with proxy
- name: Start Docker daemon with insecure registry
run: |
mkdir -p /etc/docker
cat > /etc/docker/daemon.json << 'DAEMON'
{
"insecure-registries": ["194.5.195.53:30080", "gitea-svc:3000"]
}
DAEMON
mkdir -p ~/.docker
cat > ~/.docker/config.json << CONF
cat > ~/.docker/config.json << 'CONF'
{
"proxies": {
"default": {
"httpProxy": "http://proxyuser:87zH26nbqT@46.249.98.211:3128",
"httpsProxy": "http://proxyuser:87zH26nbqT@46.249.98.211:3128",
"httpProxy": "http://proxyuser:87zH26nbqT2@46.249.98.211:3128",
"httpsProxy": "http://proxyuser:87zH26nbqT2@46.249.98.211:3128",
"noProxy": "localhost,127.0.0.1,gitea-svc,194.5.195.53,10.0.0.0/8"
}
}
@@ -51,8 +57,8 @@ jobs:
run: |
docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
--build-arg HTTP_PROXY=http://proxyuser:87zH26nbqT@46.249.98.211:3128 \
--build-arg HTTPS_PROXY=http://proxyuser:87zH26nbqT@46.249.98.211:3128 \
--build-arg HTTP_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \
--build-arg HTTPS_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \
.
- name: Push to Registry

View File

@@ -1,11 +1,12 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY src/*.sln ./ 2>/dev/null || true
COPY src/*/*.csproj ./
RUN for file in *.csproj; do mkdir -p "${file%.*}" && mv "$file" "${file%.*}/"; done 2>/dev/null || true
RUN dotnet restore "CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj" || dotnet restore
# Copy solution and project files
COPY src/ ./
RUN dotnet publish "CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj" -c Release -o /app/publish
# Restore and publish
RUN dotnet restore "CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj"
RUN dotnet publish "CMSMicroservice.WebApi/CMSMicroservice.WebApi.csproj" -c Release -o /app/publish --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app

View File

@@ -1,5 +1,6 @@
using System.Reflection;
using CMSMicroservice.Application.Common.Interfaces;
using Microsoft.EntityFrameworkCore.Diagnostics;
using CMSMicroservice.Domain.Entities;
using CMSMicroservice.Domain.Entities.Payment;
@@ -39,6 +40,9 @@ public class ApplicationDbContext : DbContext, IApplicationDbContext
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.AddInterceptors(_auditableEntitySaveChangesInterceptor);
// Suppress PendingModelChangesWarning in EF Core 9
optionsBuilder.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning));
}
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)

View File

@@ -10,33 +10,13 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
// اضافه کردن تنظیمات Club.MembershipGiftValue
migrationBuilder.Sql(@"
INSERT INTO ""SystemConfigurations""
(""Key"", ""Value"", ""Description"", ""Scope"", ""IsActive"", ""Created"", ""CreatedBy"")
SELECT
'Club.MembershipGiftValue',
'25200000',
'مبلغ هدیه حق عضویت باشگاه (ریال) - این مبلغ از کیف پول کم نمی‌شود',
1, -- ConfigurationScope.Club = 1
true,
NOW(),
'System'
WHERE NOT EXISTS (
SELECT 1 FROM ""SystemConfigurations""
WHERE ""Key"" = 'Club.MembershipGiftValue'
);
");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
// حذف تنظیمات Club.MembershipGiftValue
migrationBuilder.Sql(@"
DELETE FROM ""SystemConfigurations""
WHERE ""Key"" = 'Club.MembershipGiftValue';
");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CMSMicroservice.Infrastructure.Persistence.Migrations
{
/// <inheritdoc />
public partial class u13 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "ArchivedAt",
schema: "CMS",
table: "PublicMessages",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "EndDate",
schema: "CMS",
table: "PublicMessages",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<bool>(
name: "IsArchived",
schema: "CMS",
table: "PublicMessages",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "PublishedAt",
schema: "CMS",
table: "PublicMessages",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "StartDate",
schema: "CMS",
table: "PublicMessages",
type: "datetime2",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ArchivedAt",
schema: "CMS",
table: "PublicMessages");
migrationBuilder.DropColumn(
name: "EndDate",
schema: "CMS",
table: "PublicMessages");
migrationBuilder.DropColumn(
name: "IsArchived",
schema: "CMS",
table: "PublicMessages");
migrationBuilder.DropColumn(
name: "PublishedAt",
schema: "CMS",
table: "PublicMessages");
migrationBuilder.DropColumn(
name: "StartDate",
schema: "CMS",
table: "PublicMessages");
}
}
}

View File

@@ -1272,98 +1272,6 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("SystemConfigurationHistories", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Message.PublicMessage", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<long>("CreatedByUserId")
.HasColumnType("bigint");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("datetime2");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("LinkText")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("LinkUrl")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int>("Priority")
.HasColumnType("int");
b.Property<DateTime>("StartsAt")
.HasColumnType("datetime2");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<int>("ViewCount")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.HasKey("Id");
b.HasIndex("CreatedByUserId")
.HasDatabaseName("IX_PublicMessages_CreatedByUserId");
b.HasIndex("ExpiresAt")
.HasDatabaseName("IX_PublicMessages_ExpiresAt");
b.HasIndex("IsActive")
.HasDatabaseName("IX_PublicMessages_IsActive");
b.HasIndex("Priority")
.HasDatabaseName("IX_PublicMessages_Priority");
b.HasIndex("StartsAt")
.HasDatabaseName("IX_PublicMessages_StartsAt");
b.HasIndex("Type")
.HasDatabaseName("IX_PublicMessages_Type");
b.HasIndex("IsActive", "ExpiresAt")
.HasDatabaseName("IX_PublicMessages_IsActive_ExpiresAt");
b.ToTable("PublicMessages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Network.NetworkWeeklyBalance", b =>
{
b.Property<long>("Id")
@@ -1921,6 +1829,113 @@ namespace CMSMicroservice.Infrastructure.Persistence.Migrations
b.ToTable("ProductTags", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.PublicMessage", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime?>("ArchivedAt")
.HasColumnType("datetime2");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)");
b.Property<long>("CreatedByUserId")
.HasColumnType("bigint");
b.Property<DateTime?>("EndDate")
.HasColumnType("datetime2");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("datetime2");
b.Property<bool>("IsActive")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<bool>("IsArchived")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime?>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("LastModifiedBy")
.HasColumnType("nvarchar(max)");
b.Property<string>("LinkText")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("LinkUrl")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int>("Priority")
.HasColumnType("int");
b.Property<DateTime?>("PublishedAt")
.HasColumnType("datetime2");
b.Property<DateTime?>("StartDate")
.HasColumnType("datetime2");
b.Property<DateTime>("StartsAt")
.HasColumnType("datetime2");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<int>("ViewCount")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(0);
b.HasKey("Id");
b.HasIndex("CreatedByUserId")
.HasDatabaseName("IX_PublicMessages_CreatedByUserId");
b.HasIndex("ExpiresAt")
.HasDatabaseName("IX_PublicMessages_ExpiresAt");
b.HasIndex("IsActive")
.HasDatabaseName("IX_PublicMessages_IsActive");
b.HasIndex("Priority")
.HasDatabaseName("IX_PublicMessages_Priority");
b.HasIndex("StartsAt")
.HasDatabaseName("IX_PublicMessages_StartsAt");
b.HasIndex("Type")
.HasDatabaseName("IX_PublicMessages_Type");
b.HasIndex("IsActive", "ExpiresAt")
.HasDatabaseName("IX_PublicMessages_IsActive_ExpiresAt");
b.ToTable("PublicMessages", "CMS");
});
modelBuilder.Entity("CMSMicroservice.Domain.Entities.Role", b =>
{
b.Property<long>("Id")

View File

@@ -15,8 +15,13 @@ using Hangfire.SqlServer;
var builder = WebApplication.CreateBuilder(args);
var levelSwitch = new LoggingLevelSwitch();
// Read Seq configuration from appsettings.json
var seqServerUrl = builder.Configuration["Seq:ServerUrl"] ?? "http://seq-svc:5341";
var seqApiKey = builder.Configuration["Seq:ApiKey"];
var logger = new LoggerConfiguration()
//.WriteTo.Console()
.WriteTo.Console()
//.WriteTo.MSSqlServer(builder.Configuration.GetConnectionString("LogConnection"),
// sinkOptions: new MSSqlServerSinkOptions
// {
@@ -24,8 +29,8 @@ var logger = new LoggerConfiguration()
// SchemaName = "Log",
// AutoCreateSqlTable = true
// })
.WriteTo.Seq("https://seq.afrino.co",
apiKey: "oxpvpUzU1pZxMS4s3Fqq",
.WriteTo.Seq(seqServerUrl,
apiKey: string.IsNullOrEmpty(seqApiKey) ? null : seqApiKey,
controlLevelSwitch: levelSwitch)
.CreateLogger();
builder.Logging.AddSerilog(logger);

View File

@@ -5,7 +5,7 @@
"JwtAudience": "https://localhost",
"JwtExpiryInDays": 5,
"ConnectionStrings": {
"DefaultConnection": "Data Source=185.252.31.42,2019; Initial Catalog=Foursat;User ID=afrino;Password=87zH26nbqT%;Connection Timeout=300000;MultipleActiveResultSets=True;Encrypt=False",
"DefaultConnection": "Data Source=194.5.195.53,31433; Initial Catalog=Foursat;User ID=sa;Password=YourStrong@Passw0rd;Connection Timeout=300000;MultipleActiveResultSets=True;Encrypt=False",
"providerName": "System.Data.SqlClient"
},
"Otp": {
@@ -53,5 +53,9 @@
"Authentication": {
"Authority": "https://ids.domain.com/",
"Audience": "domain_api"
},
"Seq": {
"ServerUrl": "http://seq-svc:5341",
"ApiKey": ""
}
}