diff --git a/.gitignore b/.gitignore index baf42d3..1972b1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ -.vs +.config +.vs .vscode bin -obj \ No newline at end of file +obj + +*.csproj.user +*.pubxml.user \ No newline at end of file diff --git a/LK.Server/Program.cs b/LK.Server/Program.cs index 48d25d9..1c779d8 100644 --- a/LK.Server/Program.cs +++ b/LK.Server/Program.cs @@ -15,7 +15,7 @@ app.UseStaticFiles(); // Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) +if (app.Environment.IsDevelopment() || app.Environment.IsStaging()) { app.UseSwagger(); app.UseSwaggerUI(); diff --git a/LK.Server/Properties/PublishProfiles/FolderProfile.pubxml b/LK.Server/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..483c222 --- /dev/null +++ b/LK.Server/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,23 @@ + + + + + true + false + true + Release + Any CPU + FileSystem + C:\inetpub\lamkhai.com-folder + FileSystem + <_TargetId>Folder + + net8.0 + 0976582b-cba9-49ee-80f6-eeee9396a25b + false + win-x86 + Staging + + \ No newline at end of file diff --git a/LK.Server/Properties/PublishProfiles/IISProfile.pubxml b/LK.Server/Properties/PublishProfiles/IISProfile.pubxml new file mode 100644 index 0000000..cbd1b1e --- /dev/null +++ b/LK.Server/Properties/PublishProfiles/IISProfile.pubxml @@ -0,0 +1,28 @@ + + + + + MSDeploy + true + Release + Any CPU + lamkhai.iis + false + 0976582b-cba9-49ee-80f6-eeee9396a25b + false + LAPTOP-58OFGEE5 + lamkhai.com-iis-site + + false + InProc + false + true + lamkhai.lk208@gmail.com + <_SavePWD>true + <_TargetId>IISWebDeploy + net8.0 + Staging + + \ No newline at end of file diff --git a/LK.Server/appsettings.Development.json b/LK.Server/appsettings.Development.json index 0c208ae..3da0a8c 100644 --- a/LK.Server/appsettings.Development.json +++ b/LK.Server/appsettings.Development.json @@ -1,8 +1,11 @@ { + "ConnectionStrings": { + "LamKhaiDBConnection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=LamKhaiDB;Integrated Security=True" + }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } } -} +} \ No newline at end of file diff --git a/LK.Server/appsettings.Staging.json b/LK.Server/appsettings.Staging.json new file mode 100644 index 0000000..593f1e6 --- /dev/null +++ b/LK.Server/appsettings.Staging.json @@ -0,0 +1,11 @@ +{ + "ConnectionStrings": { + "LamKhaiDBConnection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=LamKhaiDBStaging;Integrated Security=True" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} \ No newline at end of file diff --git a/LK.Server/appsettings.json b/LK.Server/appsettings.json index 10f68b8..a1247c1 100644 --- a/LK.Server/appsettings.json +++ b/LK.Server/appsettings.json @@ -1,9 +1,12 @@ { + "AllowedHosts": "*", + "ConnectionStrings": { + "LamKhaiDBConnection": "${{ secrets.LAMKHAIDBCONNECTION }}" + }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } - }, - "AllowedHosts": "*" -} + } +} \ No newline at end of file diff --git a/README.md b/README.md index 1203655..39992f9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,18 @@ # LK + +## Environments: +- Development: + - http + - https + - IIS Express + - Container (Dockerfile) +- Staging: + - Refer to [Publish to Docker](#publish-up-docker) + - Refer to [Publish to IIS](#publish-up-iis) +- Production: + - https://lamkhai.azurewebsites.net/ + +## Publish to Docker: - OS: Linux - Docker hub: https://hub.docker.com/r/lamkhai/lamkhai.com - Docker client: @@ -10,5 +24,10 @@ - Development (Without using compose): - Run via Container (Dockerfile) or via the following command: ``` - docker run --name=LK-Cli -p 8080 -e ASPNETCORE_ENVIRONMENT=Development lamkhai/lamkhai.com - ``` \ No newline at end of file + docker run --name=LK-Cli -p 8080 -e ASPNETCORE_ENVIRONMENT=Staging lamkhai/lamkhai.com + ``` + +## Publish to IIS: +Use: +- FolderProfile +- IISProfile \ No newline at end of file