I'm using a local dev version of xbyk and a local database. Then I push edits to GitHub and use GitHub Actions to push everything to staging on Azure. I followed the instructions and created a CD repository. But when I create a new pagetype, nothing is written to this repository. What could be the problem?
CD Repository
Answers
The CD repository, unlike the CI repository, is not automatically kept up to date. It has to be re-generated (somewhere) and deployed with the application code.
You can generate it locally and commit the entire repository to source control or you can generate it externally, like in a CI/CD pipeline, so that it doesn't create a lot of noise in your Git history. The Kentico Community Portal generates the CD repository in a GitHub workflow using a backup of the database and the CI repository (which is committed to the Git repo).
Check out the blog post Xperience by Kentico CI/CD developer scenarios for more details.
If you are interested in what that repository.config file might look like for the CD repository, take a look at the Kentico Community Portal source code for an example.
Then, you deploy the application (along with the CD repository) to your target environment and update the database with the schema and content changes described by the CD repository.
To do this you use the --kxp-cd-restore command. It's described in our documentation.
Run dotnet run --project ./src/Kickstart.Web/Kickstart.Web.csproj --kxp-ci-restore
Using launch settings from .\src\Kickstart.Web\Properties\launchSettings.json...
fail: Kentico.Web.Mvc.IStartupConfigureAction[0]
Startup action 'Kentico.Web.Mvc.CIRestoreService'.
CMS.DataEngine.ApplicationInitException: Cannot access the database specified by the 'CMSConnectionString' connection string. Please install the database externally and set a correct connection string.
at CMS.DataEngine.CMSApplication.ReportApplicationInitError(String message)
at CMS.DataEngine.CMSApplication.Init()
at Kentico.Web.Mvc.StartupConfigureActionBase.InitCmsApplication()
at Kentico.Web.Mvc.StartupConfigureActionBase.Initialize()
at Kentico.Web.Mvc.ExitCodeService.Initialize()
Error: Process completed with exit code 1.
I understand GitHub doesn't have access to the Azure SQL server. Is there any material on this? Is there an example of using GitHub actions + Azure SQL?
When doing deployments you don't usually use dotnet run, which is a command for local dev environments.
Instead you create a deployment build of your application and use dotnet MyApp.dll.
The error Cannot access the database specified by the 'CMSConnectionString' connection string. means your appsettings.json does not have a connection string that points to an accessible database.
I understand GitHub doesn't have access to the Azure SQL server. Is there any material on this? Is there an example of using GitHub actions + Azure SQL?
I assume you mean GitHub workflows. Workflows are simply automated processes - a series of jobs and tasks which could be pre-built or simple shell scripts - that let you accomplish some goal with your repository. You can see an example use of workflows with the Kentico Community Portal project.
There is nothing that restricts a workflow from having access to an Azure SQL database, except for your Azure SQL database configuration - like IP or firewall restrictions.
I don't think the issue is with GitHub workflows or Azure SQL database - I think you are having issues with Xperience's CI/CD features, which is why I recommended reading Xperience by Kentico CI/CD developer scenarios.
Specific to your error, --kxp-ci-restore is not used for deployments or to update non-local environments with content type changes, however --kxp-cd-restore is designed for this use case.
I also recommend taking a look at this discussion which details the roles of CI and CD with Xperience by Kentico and gives an example deployment process.
To response this discussion, you have to login first.