Skip to content

Instantly share code, notes, and snippets.

View MahdiKarimipour's full-sized avatar
🎯
Focusing

MK MahdiKarimipour

🎯
Focusing
  • TechnologyLeads
  • Sydney, Australia
View GitHub Profile
apiVersion: v1
kind: Secret
metadata:
name: technologyleads-identity-api
type: Opaque
stringData:
JwtSecret: M%......R*r
DbConnectionString: Server = host.docker.internal, 1433\\MSSQLServer01; Database=EcosystemIdentityDb; Trusted_Connection=False; MultipleActiveResultSets=True;User Id=sa; Password=<password>;
GoogleCaptchaVerificationSecret: 6LcN......kxqB
GoogleAuthClientId: 61......k56.apps.googleusercontent.com
@MahdiKarimipour
MahdiKarimipour / kubernetes-secret-management-aspnet.cs
Created September 22, 2021 11:18
Handle Secrets in Asp.NET API
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
}).ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
@MahdiKarimipour
MahdiKarimipour / kubernetes-healthchecks-result.json
Created September 22, 2021 08:39
Asp.NET API Healthcheck Payload
{
"status": "Healthy",
"totalDuration": "00:00:00.0087070",
"entries": {
"Check API Health": {
"data": {},
"duration": "00:00:00.0008568",
"status": "Healthy",
"tags": []
}
@MahdiKarimipour
MahdiKarimipour / kubernetes-healthcheck-injection.cs
Last active September 22, 2021 08:36
Creating healthchecks for Kubernetes
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddCheck<ApiHealthCheck>("Check API Health");
}
public void Configure(
IApplicationBuilder app,
IWebHostEnvironment env,
IApiVersionDescriptionProvider provider,
@MahdiKarimipour
MahdiKarimipour / kubernetes-asp-net-healthchecks.cs
Created September 22, 2021 08:33
ApiHealthChecks for Asp.NET APIs
public class ApiHealthCheck : IHealthCheck
{
public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
{
var result = HealthCheckResult.Healthy();
return Task.FromResult(result);
}
}
@MahdiKarimipour
MahdiKarimipour / kubernetes-helm-charts-react-aspnet-api-values.yaml
Created September 22, 2021 05:02
kubernetes-helm-charts-aspnet-api-values.yaml
replicaCount: 1
image:
repository: technologyleads/ecosystem-identity-api
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: ""
env:
- name: "ASPNETCORE_ENVIRONMENT"
@MahdiKarimipour
MahdiKarimipour / kubernetes-helm-charts-react-web-app-values.yaml
Last active September 22, 2021 05:01
Specify values for Kubernetes Helm Charts for React Web Apps
replicaCount: 1
image:
repository: technologyleads/ecosystem-web-app
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: ""
env:
- name: "ASPNETCORE_ENVIRONMENT"
@MahdiKarimipour
MahdiKarimipour / kubernetes-helm-charts-deployment-template.yaml
Created September 22, 2021 03:11
Deployment Template for Kubernetes Helm Charts
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ecosystem-identity-api.fullname" . }}
labels:
{{- include "ecosystem-identity-api.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
@MahdiKarimipour
MahdiKarimipour / docker-compose.yaml
Last active July 21, 2022 00:17
Docker-Compose to Orchestrate Multi App Containers
version: "3.8"
services:
webapp:
image: technologyleads/ecosystem-web-app:v1.0.0
build:
context: ../Ecosystem.Web
args:
- PAT=limrbr6tk5......tinggp7vq
ports:
- 8500:443
@MahdiKarimipour
MahdiKarimipour / docker-ignore-file-for-react-apps
Created September 5, 2021 20:47
Docker Ignore file to Build React Images
**/.classpath
**/.dockerignore
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user