Skip to content

Commit

Permalink
Initial Staging and IIS profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
lamkhai committed Jun 25, 2024
1 parent 7bc63f9 commit 8c2fd59
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.vs
.config
.vs
.vscode
bin
obj
obj

*.csproj.user
*.pubxml.user
2 changes: 1 addition & 1 deletion LK.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
23 changes: 23 additions & 0 deletions LK.Server/Properties/PublishProfiles/FolderProfile.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>C:\inetpub\lamkhai.com-folder</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net8.0</TargetFramework>
<ProjectGuid>0976582b-cba9-49ee-80f6-eeee9396a25b</ProjectGuid>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<EnvironmentName>Staging</EnvironmentName>
</PropertyGroup>
</Project>
28 changes: 28 additions & 0 deletions LK.Server/Properties/PublishProfiles/IISProfile.pubxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>lamkhai.iis</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>0976582b-cba9-49ee-80f6-eeee9396a25b</ProjectGuid>
<SelfContained>false</SelfContained>
<MSDeployServiceURL>LAPTOP-58OFGEE5</MSDeployServiceURL>
<DeployIisAppPath>lamkhai.com-iis-site</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>false</SkipExtraFilesOnServer>
<MSDeployPublishMethod>InProc</MSDeployPublishMethod>
<EnableMSDeployBackup>false</EnableMSDeployBackup>
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
<UserName>[email protected]</UserName>
<_SavePWD>true</_SavePWD>
<_TargetId>IISWebDeploy</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<EnvironmentName>Staging</EnvironmentName>
</PropertyGroup>
</Project>
5 changes: 4 additions & 1 deletion LK.Server/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"ConnectionStrings": {
"LamKhaiDBConnection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=LamKhaiDB;Integrated Security=True"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
}
11 changes: 11 additions & 0 deletions LK.Server/appsettings.Staging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ConnectionStrings": {
"LamKhaiDBConnection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=LamKhaiDBStaging;Integrated Security=True"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 6 additions & 3 deletions LK.Server/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"AllowedHosts": "*",
"ConnectionStrings": {
"LamKhaiDBConnection": "${{ secrets.LAMKHAIDBCONNECTION }}"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
}
}
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
```
docker run --name=LK-Cli -p 8080 -e ASPNETCORE_ENVIRONMENT=Staging lamkhai/lamkhai.com
```

## Publish to IIS:
Use:
- FolderProfile
- IISProfile

0 comments on commit 8c2fd59

Please sign in to comment.