Compare commits

...

11 Commits

Author SHA1 Message Date
masoodafar-web
663b357d10 fix: Update deployment name case in kub-deploy.yml
Some checks failed
Build and Deploy to Kubernetes / build-and-deploy (push) Has been cancelled
2025-12-06 23:40:45 +03:30
masoodafar-web
b51a24d307 feat: Update CMSMS address in appsettings 2025-12-06 23:32:42 +03:30
masoodafar-web
a47be9f585 feat: Update port, enable console logging, upgrade protobuf version 2025-12-06 23:30:26 +03:30
masoodafar-web
e651e5a292 Merge remote-tracking branch 'kub-stage/kub-stage' into kub-stage
# Conflicts:
#	.gitea/workflows/kub-deploy.yml
#	.github/workflows/kub-deploy.yml
#	src/FrontOffice.BFF.WebApi/Dockerfile
2025-12-06 23:23:55 +03:30
masoodafar-web
ce091044c0 feat: Add CI/CD workflows for stage and Kubernetes deployment 2025-12-06 23:23:24 +03:30
masoodafar-web
6e70031691 Test auto-deploy 2025-12-06 23:21:34 +03:30
masoodafar-web
13037e9533 Merge branch 'main' into kub-stage 2025-12-06 23:10:53 +03:30
masoodafar-web
d7ae666468 Add Dockerfile and NuGet config for containerization 2025-12-06 23:10:07 +03:30
masoud
609f79723f Use CMS workflow pattern with insecure registry config 2025-12-06 17:21:47 +00:00
masoud
07f7819820 Add insecure-registries config for Docker daemon 2025-12-06 17:14:50 +00:00
masoodafar-web
13e33e7b1f feat: Add VAT information to GetUserOrderResponse and OrderVATInfo message 2025-12-05 17:27:45 +03:30
11 changed files with 143 additions and 41 deletions

View File

@@ -0,0 +1,17 @@
name: Push nuget and docker image Actions Workflow
on:
push:
branches:
- stage
jobs:
Deploy:
runs-on: windows
steps:
- name: Checkout
uses: https://git.afrino.co/actions/checkout@v3
- name: Setup dotnet
uses: https://git.afrino.co/actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x

View File

@@ -1,4 +1,4 @@
name: Build and Deploy name: Build and Deploy to Kubernetes
on: on:
push: push:
@@ -6,33 +6,60 @@ on:
- kub-stage - kub-stage
env: env:
REGISTRY: 194.5.195.53:30080 REGISTRY: gitea-svc:3000
IMAGE_NAME: admin/frontoffice-bff IMAGE_NAME: admin/frontoffice-bff
jobs: jobs:
build: build-and-deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: docker:latest image: docker:latest
options: --privileged options: --privileged
env:
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: steps:
- name: Install git - name: Install dependencies
run: | run: |
apk add --no-cache git apk add --no-cache git curl
# Install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
mv kubectl /usr/local/bin/
- name: Checkout code - name: Start Docker daemon with insecure registry
run: |
git clone --depth 1 --branch kub-stage http://194.5.195.53:30080/admin/FrontOffice.BFF.git .
git log -1 --format="%H %s"
- name: Start Docker daemon
run: | 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'
{
"proxies": {
"default": {
"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"
}
}
}
CONF
dockerd & dockerd &
for i in $(seq 1 30); do for i in $(seq 1 30); do
docker info >/dev/null 2>&1 && break || sleep 2 docker info >/dev/null 2>&1 && break || sleep 2
done done
docker info docker info
- name: Checkout code
run: |
git clone --depth 1 --branch kub-stage http://gitea-svc:3000/admin/FrontOffice.BFF.git .
git log -1 --format="%H %s"
- name: Build Docker Image - name: Build Docker Image
run: | run: |
cd src cd src
@@ -43,8 +70,22 @@ jobs:
--build-arg HTTPS_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 - name: Push to Registry
run: | run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Deploy to Kubernetes
run: |
# Setup kubeconfig
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
# Restart deployment to pull new image
kubectl rollout restart deployment/frontoffice-bff || echo "Deployment doesn't exist yet"
# Wait for rollout to complete
kubectl rollout status deployment/frontoffice-bff --timeout=5m || echo "Deployment rollout pending"

2
.gitignore vendored
View File

@@ -492,5 +492,5 @@ fabric.properties
.idea/caches/build_file_checksums.ser .idea/caches/build_file_checksums.ser
/src/.idea /src/.idea
/.gitea
src/.dockerignore src/.dockerignore

View File

@@ -16,7 +16,6 @@
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserOrder.Protobuf\FrontOffice.BFF.UserOrder.Protobuf.csproj" /> <ProjectReference Include="..\Protobufs\FrontOffice.BFF.UserOrder.Protobuf\FrontOffice.BFF.UserOrder.Protobuf.csproj" />
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.Category.Protobuf\FrontOffice.BFF.Category.Protobuf.csproj" /> <ProjectReference Include="..\Protobufs\FrontOffice.BFF.Category.Protobuf\FrontOffice.BFF.Category.Protobuf.csproj" />
<!-- CMS Protobuf for Commission, ClubMembership, NetworkMembership, Configuration --> <!-- CMS Protobuf for Commission, ClubMembership, NetworkMembership, Configuration -->
<ProjectReference Include="..\..\..\CMS\src\CMSMicroservice.Protobuf\CMSMicroservice.Protobuf.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -25,8 +25,38 @@ public class GetUserOrderResponseDto
public string? UserAddressText { get; set; } public string? UserAddressText { get; set; }
// //
public List<GetUserOrderResponseFactorDetail>? FactorDetails { get; set; } public List<GetUserOrderResponseFactorDetail>? FactorDetails { get; set; }
// اطلاعات مالیات بر ارزش افزوده
public OrderVATInfoDto? VatInfo { get; set; }
}
}public class GetUserOrderResponseFactorDetail /// <summary>
/// اطلاعات مالیات بر ارزش افزوده
/// </summary>
public class OrderVATInfoDto
{
/// <summary>
/// نرخ مالیات (مثلاً 0.09 = 9%)
/// </summary>
public double VatRate { get; set; }
/// <summary>
/// مبلغ پایه (قبل از مالیات)
/// </summary>
public long BaseAmount { get; set; }
/// <summary>
/// مبلغ مالیات
/// </summary>
public long VatAmount { get; set; }
/// <summary>
/// مبلغ کل (پایه + مالیات)
/// </summary>
public long TotalAmount { get; set; }
/// <summary>
/// آیا پرداخت شده
/// </summary>
public bool IsPaid { get; set; }
}
public class GetUserOrderResponseFactorDetail
{ {
//شناسه //شناسه
public long ProductId { get; set; } public long ProductId { get; set; }

View File

@@ -7,7 +7,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Afrino.PYMSMicroservice.Protobuf" Version="0.0.11" /> <PackageReference Include="Afrino.PYMSMicroservice.Protobuf" Version="0.0.11" />
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.139" /> <PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.144" />
<PackageReference Include="Google.Protobuf" Version="3.33.0" /> <PackageReference Include="Google.Protobuf" Version="3.33.0" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" /> <PackageReference Include="Grpc.Net.ClientFactory" Version="2.54.0" />
<PackageReference Include="Grpc.Tools" Version="2.76.0"> <PackageReference Include="Grpc.Tools" Version="2.76.0">

View File

@@ -1,44 +1,40 @@
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app WORKDIR /app
EXPOSE 8080 EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src WORKDIR /src
COPY ["FrontOffice.BFF.WebApi/NuGet.config", "NuGet.config"]
# Copy main projects
COPY ["FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj", "FrontOffice.BFF.WebApi/"] COPY ["FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj", "FrontOffice.BFF.WebApi/"]
COPY ["FrontOffice.BFF.WebApi/NuGet.config", "FrontOffice.BFF.WebApi/"]
COPY ["FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj", "FrontOffice.BFF.Application/"]
COPY ["FrontOffice.BFF.Infrastructure/FrontOffice.BFF.Infrastructure.csproj", "FrontOffice.BFF.Infrastructure/"]
COPY ["FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj", "FrontOffice.BFF.Domain/"]
# Copy all Protobuf projects
COPY ["Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Category.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Commission.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/FrontOffice.BFF.DiscountShop.Protobuf.csproj", "Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/"] COPY ["Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/FrontOffice.BFF.DiscountShop.Protobuf.csproj", "Protobufs/FrontOffice.BFF.DiscountShop.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/"] COPY ["FrontOffice.BFF.Application/FrontOffice.BFF.Application.csproj", "FrontOffice.BFF.Application/"]
COPY ["Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Package.Protobuf/"] COPY ["FrontOffice.BFF.Domain/FrontOffice.BFF.Domain.csproj", "FrontOffice.BFF.Domain/"]
COPY ["Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserOrder.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.Category.Protobuf/FrontOffice.BFF.Category.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Category.Protobuf/"]
COPY ["FrontOffice.BFF.Infrastructure/FrontOffice.BFF.Infrastructure.csproj", "FrontOffice.BFF.Infrastructure/"]
COPY ["Protobufs/FrontOffice.BFF.Products.Protobuf/FrontOffice.BFF.Products.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Products.Protobuf/"] COPY ["Protobufs/FrontOffice.BFF.Products.Protobuf/FrontOffice.BFF.Products.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Products.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/FrontOffice.BFF.ShopingCart.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/"] COPY ["Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/FrontOffice.BFF.ShopingCart.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ShopingCart.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.Transaction.Protobuf/FrontOffice.BFF.Transaction.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Transaction.Protobuf/"] COPY ["Protobufs/FrontOffice.BFF.Transaction.Protobuf/FrontOffice.BFF.Transaction.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Transaction.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserWallet.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.User.Protobuf/FrontOffice.BFF.User.Protobuf.csproj", "Protobufs/FrontOffice.BFF.User.Protobuf/"] COPY ["Protobufs/FrontOffice.BFF.User.Protobuf/FrontOffice.BFF.User.Protobuf.csproj", "Protobufs/FrontOffice.BFF.User.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.UserAddress.Protobuf/FrontOffice.BFF.UserAddress.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserAddress.Protobuf/"] COPY ["Protobufs/FrontOffice.BFF.UserAddress.Protobuf/FrontOffice.BFF.UserAddress.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserAddress.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.UserOrder.Protobuf/FrontOffice.BFF.UserOrder.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserOrder.Protobuf/"] COPY ["Protobufs/FrontOffice.BFF.Package.Protobuf/FrontOffice.BFF.Package.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Package.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.UserWallet.Protobuf/FrontOffice.BFF.UserWallet.Protobuf.csproj", "Protobufs/FrontOffice.BFF.UserWallet.Protobuf/"] COPY ["Protobufs/FrontOffice.BFF.Commission.Protobuf/FrontOffice.BFF.Commission.Protobuf.csproj", "Protobufs/FrontOffice.BFF.Commission.Protobuf/"]
COPY ["Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/FrontOffice.BFF.ClubMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.ClubMembership.Protobuf/"]
RUN dotnet restore "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" --configfile "FrontOffice.BFF.WebApi/NuGet.config" COPY ["Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/FrontOffice.BFF.NetworkMembership.Protobuf.csproj", "Protobufs/FrontOffice.BFF.NetworkMembership.Protobuf/"]
RUN dotnet restore "FrontOffice.BFF.WebApi/FrontOffice.BFF.WebApi.csproj" --configfile NuGet.config
COPY . . COPY . .
WORKDIR "/src/FrontOffice.BFF.WebApi" WORKDIR "/src/FrontOffice.BFF.WebApi"
RUN dotnet build "FrontOffice.BFF.WebApi.csproj" -c Release -o /app/build RUN dotnet build "./FrontOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish FROM build AS publish
RUN dotnet publish "FrontOffice.BFF.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./FrontOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final FROM base AS final
WORKDIR /app WORKDIR /app
COPY --from=publish /app/publish . COPY --from=publish /app/publish .
ENV ASPNETCORE_URLS=http://+:8080
ENTRYPOINT ["dotnet", "FrontOffice.BFF.WebApi.dll"] ENTRYPOINT ["dotnet", "FrontOffice.BFF.WebApi.dll"]

View File

@@ -36,4 +36,9 @@
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.ClubMembership.Protobuf\FrontOffice.BFF.ClubMembership.Protobuf.csproj" /> <ProjectReference Include="..\Protobufs\FrontOffice.BFF.ClubMembership.Protobuf\FrontOffice.BFF.ClubMembership.Protobuf.csproj" />
<ProjectReference Include="..\Protobufs\FrontOffice.BFF.NetworkMembership.Protobuf\FrontOffice.BFF.NetworkMembership.Protobuf.csproj" /> <ProjectReference Include="..\Protobufs\FrontOffice.BFF.NetworkMembership.Protobuf\FrontOffice.BFF.NetworkMembership.Protobuf.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>
</Project> </Project>

View File

@@ -13,14 +13,14 @@ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
builder.WebHost.ConfigureKestrel(options => builder.WebHost.ConfigureKestrel(options =>
{ {
// Setup a HTTP/2 endpoint without TLS. // Setup a HTTP/2 endpoint without TLS.
options.ListenLocalhost(5000, o => o.Protocols = options.ListenLocalhost(5002, o => o.Protocols =
HttpProtocols.Http2); HttpProtocols.Http2);
}); });
} }
var levelSwitch = new LoggingLevelSwitch(); var levelSwitch = new LoggingLevelSwitch();
var logger = new LoggerConfiguration() var logger = new LoggerConfiguration()
//.WriteTo.Console() .WriteTo.Console()
//.WriteTo.MSSqlServer(builder.Configuration.GetConnectionString("LogConnection"), //.WriteTo.MSSqlServer(builder.Configuration.GetConnectionString("LogConnection"),
// sinkOptions: new MSSqlServerSinkOptions // sinkOptions: new MSSqlServerSinkOptions
// { // {

View File

@@ -10,7 +10,7 @@
} }
}, },
"GrpcChannelOptions": { "GrpcChannelOptions": {
"CMSMSAddress": "https://cms.kbs1.ir", "CMSMSAddress": "http://cms-svd",
"PYMSMSAddress": "https://ipg.afrino.co" "PYMSMSAddress": "https://ipg.afrino.co"
}, },
"Authentication": { "Authentication": {

View File

@@ -94,6 +94,18 @@ message GetUserOrderResponse
} }
google.protobuf.StringValue user_address_text = 10; google.protobuf.StringValue user_address_text = 10;
repeated GetUserOrderResponseFactorDetail factor_details = 11; repeated GetUserOrderResponseFactorDetail factor_details = 11;
// VAT information
OrderVATInfo vat_info = 12;
}
// اطلاعات مالیات بر ارزش افزوده
message OrderVATInfo
{
double vat_rate = 1; // نرخ مالیات (مثلاً 0.09)
int64 base_amount = 2; // مبلغ پایه (قبل از مالیات)
int64 vat_amount = 3; // مبلغ مالیات
int64 total_amount = 4; // مبلغ کل (پایه + مالیات)
bool is_paid = 5; // آیا پرداخت شده
} }
enum PaymentStatus enum PaymentStatus
{ {
@@ -173,6 +185,8 @@ message SubmitShopBuyOrderRequest
message SubmitShopBuyOrderResponse message SubmitShopBuyOrderResponse
{ {
int64 id = 1; int64 id = 1;
// VAT information for checkout confirmation
OrderVATInfo vat_info = 2;
} }
message PaginationState message PaginationState