Compare commits

...

10 Commits

Author SHA1 Message Date
masoodafar-web
1c59fe6107 Add proxy configuration for Docker daemon and build
Some checks failed
Build and Deploy / build (push) Has been cancelled
2025-12-06 22:50:35 +03:30
masoud
be7f604651 Test auto-deploy 2025-12-06 19:10:12 +00:00
masoud
34e68197d1 Add auto-deploy to K8s after build 2025-12-06 19:07:59 +00:00
masoodafar-web
52b0df4aa0 Update Kestrel port and add console logging 2025-12-06 22:24:18 +03:30
masoodafar-web
4988950e6b Update CMS address to internal service endpoint 2025-12-06 21:04:58 +03:30
masoud
4db8c8a908 Use CMS workflow pattern with insecure registry config 2025-12-06 17:21:30 +00:00
masoud
81c8d9f2b4 Add insecure-registries config for Docker daemon 2025-12-06 17:11:58 +00:00
masoodafar-web
982589d17c Fix: update NuGet.config path in Dockerfile restore command 2025-12-06 20:37:41 +03:30
masoodafar-web
4d7afc000a Fix: add NuGet.config to Dockerfile restore command 2025-12-06 20:35:21 +03:30
masoodafar-web
f22298ed96 Add GetAllClubMembershipsRequest using alias 2025-12-06 20:29:47 +03:30
5 changed files with 57 additions and 19 deletions

View File

@@ -6,11 +6,8 @@ on:
- kub-stage - kub-stage
env: env:
REGISTRY: 194.5.195.53:30080 REGISTRY: gitea-svc:3000
IMAGE_NAME: admin/backoffice-bff IMAGE_NAME: admin/backoffice-bff
HTTP_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128
HTTPS_PROXY: http://proxyuser:87zH26nbqT2@46.249.98.211:3128
NO_PROXY: 127.0.0.1,localhost,194.5.195.53,.svc,.cluster.local
jobs: jobs:
build: build:
@@ -18,38 +15,76 @@ jobs:
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 config --global http.proxy ""
git config --global https.proxy ""
git clone --depth 1 --branch kub-stage http://194.5.195.53:30080/admin/BackOffice.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/BackOffice.BFF.git .
git log -1 --format="%H %s"
- name: Build Docker Image - name: Build Docker Image
run: | run: |
cd src cd src
docker build -f BackOffice.BFF.WebApi/Dockerfile \ docker build -f BackOffice.BFF.WebApi/Dockerfile \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \ -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
--build-arg HTTP_PROXY=${{ env.HTTP_PROXY }} \ --build-arg HTTP_PROXY=http://proxyuser:87zH26nbqT2@46.249.98.211:3128 \
--build-arg HTTPS_PROXY=${{ env.HTTPS_PROXY }} \ --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/backoffice-bff || echo "Deployment doesn't exist yet"
# Wait for rollout to complete
kubectl rollout status deployment/backoffice-bff --timeout=5m || echo "Deployment rollout pending"

View File

@@ -1,5 +1,6 @@
using Foursat.BackOffice.BFF.ClubMembership.Protobuf; using Foursat.BackOffice.BFF.ClubMembership.Protobuf;
using GetAllClubMembershipsRequest = CMSMicroservice.Protobuf.Protos.ClubMembership.GetAllClubMembershipsRequest;
namespace BackOffice.BFF.Application.ClubMembershipCQ.Queries.GetAllClubMembers; namespace BackOffice.BFF.Application.ClubMembershipCQ.Queries.GetAllClubMembers;

View File

@@ -7,6 +7,7 @@ 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 ARG BUILD_CONFIGURATION=Release
WORKDIR /src WORKDIR /src
COPY ["BackOffice.BFF.WebApi/NuGet.config", "NuGet.config"]
COPY ["BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj", "BackOffice.BFF.WebApi/"] COPY ["BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj", "BackOffice.BFF.WebApi/"]
COPY ["Protobufs/BackOffice.BFF.Commission.Protobuf/BackOffice.BFF.Commission.Protobuf.csproj", "Protobufs/BackOffice.BFF.Commission.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.Commission.Protobuf/BackOffice.BFF.Commission.Protobuf.csproj", "Protobufs/BackOffice.BFF.Commission.Protobuf/"]
COPY ["Protobufs/BackOffice.BFF.Common.Protobuf/BackOffice.BFF.Common.Protobuf.csproj", "Protobufs/BackOffice.BFF.Common.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.Common.Protobuf/BackOffice.BFF.Common.Protobuf.csproj", "Protobufs/BackOffice.BFF.Common.Protobuf/"]
@@ -28,7 +29,7 @@ COPY ["Protobufs/BackOffice.BFF.Role.Protobuf/BackOffice.BFF.Role.Protobuf.cspro
COPY ["Protobufs/BackOffice.BFF.UserRole.Protobuf/BackOffice.BFF.UserRole.Protobuf.csproj", "Protobufs/BackOffice.BFF.UserRole.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.UserRole.Protobuf/BackOffice.BFF.UserRole.Protobuf.csproj", "Protobufs/BackOffice.BFF.UserRole.Protobuf/"]
COPY ["Protobufs/BackOffice.BFF.Category.Protobuf/BackOffice.BFF.Category.Protobuf.csproj", "Protobufs/BackOffice.BFF.Category.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.Category.Protobuf/BackOffice.BFF.Category.Protobuf.csproj", "Protobufs/BackOffice.BFF.Category.Protobuf/"]
COPY ["Protobufs/BackOffice.BFF.ManualPayment.Protobuf/BackOffice.BFF.ManualPayment.Protobuf.csproj", "Protobufs/BackOffice.BFF.ManualPayment.Protobuf/"] COPY ["Protobufs/BackOffice.BFF.ManualPayment.Protobuf/BackOffice.BFF.ManualPayment.Protobuf.csproj", "Protobufs/BackOffice.BFF.ManualPayment.Protobuf/"]
RUN dotnet restore "BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj" RUN dotnet restore "BackOffice.BFF.WebApi/BackOffice.BFF.WebApi.csproj" --configfile NuGet.config
COPY . . COPY . .
WORKDIR "/src/BackOffice.BFF.WebApi" WORKDIR "/src/BackOffice.BFF.WebApi"
RUN dotnet build "./BackOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build RUN dotnet build "./BackOffice.BFF.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build

View File

@@ -14,13 +14,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(5001, 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.Seq(builder.Configuration["Seq:ServerUrl"] ?? "http://seq-svc:5341", .WriteTo.Seq(builder.Configuration["Seq:ServerUrl"] ?? "http://seq-svc:5341",
apiKey: string.IsNullOrEmpty(builder.Configuration["Seq:ApiKey"]) ? null : builder.Configuration["Seq:ApiKey"], apiKey: string.IsNullOrEmpty(builder.Configuration["Seq:ApiKey"]) ? null : builder.Configuration["Seq:ApiKey"],
controlLevelSwitch: levelSwitch) controlLevelSwitch: levelSwitch)

View File

@@ -11,7 +11,7 @@
}, },
"GrpcChannelOptions": { "GrpcChannelOptions": {
"FMSMSAddress": "https://dl.afrino.co", "FMSMSAddress": "https://dl.afrino.co",
"CMSMSAddress": "https://cms.kbs1.ir" "CMSMSAddress": "http://cms-svc"
}, },
"Authentication": { "Authentication": {
"Authority": "https://ids.domain.com/", "Authority": "https://ids.domain.com/",