Reputation: 109
I've currently got an ASP.NET Core web application with EF that I am deploying to GearHost (a non-Azure cloud platform that was recommended by a user here) using a web deploy publish profile directly from Visual Studio. I'm looking to get CI/CD set up via VSTS so that the publish ability isn't restricted to one machine.
So far I've got the build stage set up, as the .NET Core template is all that's really needed. It's the deploy part that has got me stuck - all the templates (and indeed articles) that I can find relating specifically to .NET Core are focused on Azure or an IIS deployment, neither of which are really applicable here, and indeed Azure uses deploy tasks that are created specifically for it.
If it's relevant, GearHost provides FTP credentials which could potentially be used for a manual copy. Alternatively, is there any way I could use the VS2017 publish profile to create a release definition including appsettings.json transforms and EF migrations?
Upvotes: 1
Views: 223
Reputation: 33728
There are many ways to deploy app to GearHost server, such as FTP, Publish Profile.
So, you can upload the published files (e.g. Create a publish profile with file system publish method) to GearHost server by using FTP Upload task.
You also could download the publish profile with Web Deploy method and import to VS, then deploy app by using this publish profile. (MSBuild Arguments: /p:DeployOnBuild=true /p:PublishProfile=[publish profile file name]
)
Regarding appsettings.json transforms, you don’t need to transform appsettings.json file, the .net core project can retrieve the values from appsettings.[environment].json
file per to the value of ASPNETCORE_ENVIRONMENT system environment variable. Working with multiple environments
Regarding EF migrations, you can configure it in publish profile and publish/deploy app with that publish profile.
Update:
Steps to call GearHost cloudsite:
Simple code:
$url="https://api.gearhost.com/v1/cloudsites/[could site id]/stop"
$APIID="[step 2]"
$result=Invoke-RestMethod -Method POST -Uri $url -Headers @{Authorization=("bearer {0}" -f $APIID)} -ContentType "application/json"
Upvotes: 2