From 6ddb59d3afa6fb83f8e03c68f61407b95a9cb983 Mon Sep 17 00:00:00 2001 From: Lee Swainsbury Date: Thu, 1 May 2025 09:36:50 +0100 Subject: [PATCH] Updated and resolved merge conflicts from March --- .../pre-development/sprint-zero/devops.md | 62 +++++++++++++------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/data/markdown/pages/learn/accelerate/xm-cloud/pre-development/sprint-zero/devops.md b/data/markdown/pages/learn/accelerate/xm-cloud/pre-development/sprint-zero/devops.md index 03396bebb..0a50a1d04 100644 --- a/data/markdown/pages/learn/accelerate/xm-cloud/pre-development/sprint-zero/devops.md +++ b/data/markdown/pages/learn/accelerate/xm-cloud/pre-development/sprint-zero/devops.md @@ -4,14 +4,14 @@ description: 'Configuring your DevOps with XM Cloud' area: ['accelerate'] hasSubPageNav: true hasInPageNav: true -lastUpdated: '2025-03-31' +lastUpdated: '2025-04-24' created: '2023-12-22' audience: ['Architect','Technical Implementer', 'System Administrator'] --- ## Context -In XM Cloud, customers need to deploy their application to both production and non-production environments. Non production environments are used for development and testing before deploying to the live (production) environment. This will include any assets required to be deployed to the XMC infrastructure, as well as deploying their “head” application. This recipe will go through the different options available to customers to achieve this. +In XM Cloud, customers need to deploy their application to both production and non-production environments. Non production environments are used for development and testing before deploying to the live (production) environment. This will include any assets required to be deployed to the XMC infrastructure, as well as [deploying their “head” application](https://doc.sitecore.com/xmc/en/developers/xm-cloud/front-end-hosting-applications.html). This recipe will go through the different options available to customers to achieve this. ## Execution @@ -31,15 +31,25 @@ However, there are some scenarios where that might not be possible, some example - If you have made an investment in CI/CD tooling for other elements of your infrastructure, and want to continue to manage all deployments from a single location then you might choose to use the CLI to provision your own deployments - If your development team uses a poly-repo approach (multiple repositories for the CM and web application code), you will need to use the CLI to deploy your code. The Deploy app requires all the code to be in the same repository. + + + Vercel does not natively support Azure DevOps as a Git provider. To use Azure DevOps with Vercel, you need to use the [Vercel Deployment Extension and set up an Azure Pipeline](https://vercel.com/docs/deployments/git/vercel-for-azure-pipelines) + + ### XM Cloud Deploy Application GitOps The Sitecore XM Cloud Deploy Application is used to provision XM Cloud Projects/Environments & Deployments. When a new project is created you can either use your own existing repository, or you can allow the Application to provision one for you based on one of the templates available. You can read more about how to create a new project using the Deploy Application in the [XM Cloud Deploy app](https://doc.sitecore.com/xmc/en/developers/xm-cloud/xm-cloud-deploy-app.html) documentation. - Whether you let the XM Cloud Deploy application create the repository, or you use your own, ALL XM Cloud implementations must start with the [XM Cloud Foundation Head](https://github.com/sitecorelabs/xmcloud-foundation-head) repository. + + + Whether you let the XM Cloud Deploy application create the repository, or you use your own, ALL XM Cloud implementations must start with the [XM Cloud Foundation Head](https://github.com/sitecorelabs/xmcloud-foundation-head) repository. + + +Using the XM Cloud Foundation head repository is crucial for getting started with a project, as it provides a pre-configured, best-practice foundation that accelerates development, ensures consistency, and simplifies integration with XM Cloud services. If a project doesn’t use it, you may need to manually configure the environment, set up dependencies, and align with best practices to ensure compatibility and smooth deployment. -Once you have created your project, you will then provision an environment. These can be used to represent the different Production and Non-Production environments that you require. When creating them through the deploy application you can also choose to tie each environment to a different branch in your repository should that be a requirement for you. You can also choose to have the environment automatically deployed when changes are committed to the chosen branch. +You can read more about how to create a new project using the Deploy Application on our Documentation Site: or follow the recipe: [Sprint Zero - Project Solution Setup](/learn/accelerate/xm-cloud/pre-development/sprint-zero/project-solution-setup). -This process is discussed in detail in the [Project Solution Setup](/learn/accelerate/xm-cloud/pre-development/sprint-zero/project-solution-setup) recipe and you can read more about Environments on the [Manage an environment](https://doc.sitecore.com/xmc/en/developers/xm-cloud/manage-an-environment.html) documentation. +Once the project is created, you will then [provision an environment](http://doc.sitecore.com/xmc/en/developers/xm-cloud/manage-an-environment.html). These can be used to represent the different Production and Non-Production environments that you require. When creating them through the deploy application you can also choose to tie each environment to a different branch in your repository should that be a requirement for you. You can also choose to have the environment automatically deployed when changes are committed to the chosen branch. After you have entered all the details and chosen to proceed a Deployment will commence that will push the required code and configuration to the newly created environment. @@ -54,47 +64,55 @@ To log in to a Sitecore instance using sitecore login, the CLI allows two flows - An [interactive user login](https://doc.sitecore.com/xmc/en/developers/xm-cloud/log-in-to-a-sitecore-instance-with-sitecore-command-line-interface.html#use-an-interactive-user-login-device-code-flow), using a device code flow (This command would open a browser window allowing you to authenticate your CLI with the XM Cloud Deploy application.) - A [non-interactive client login](https://doc.sitecore.com/xmc/en/developers/xm-cloud/log-in-to-a-sitecore-instance-with-sitecore-command-line-interface.html#use-a-non-interactive-client-login-client-credentials-flow), using a client credentials flow. This is used by clients such as Continuous Integration servers. -For this recipe we are looking at utilizing a non-interactive client login, follow the [The cloud login command](https://doc.sitecore.com/xmc/en/developers/xm-cloud/the-cloud-login-command.html) documentation for further detail. +For this DevOps recipe we are looking at utlizing a non-interactive client login. To use a non-interactive login flow with a Sitecore XM Cloud instance, you must have the following: + +- An authentication/automation client for your organization or environment. It provides a client ID and a client secret. +- The authority URL. The default authority URL is . +- The audience URL . +- The URL of the Sitecore instance. ```typescript -dotnet sitecore cloud login --authority https:// --cm http:// --audience https:// --allow-write true --client-credentials true --client-id --client-secret +dotnet sitecore login --authority https:// --cm http:// --audience https:// --allow-write true --client-credentials true --client-id --client-secret ``` + This command will open a browser window allowing you to authenticate your CLI with the XM Cloud Deploy application. +After logging in with the client credentials flow, you can switch to the [device flow](https://doc.sitecore.com/xmc/en/developers/xm-cloud/log-in-to-a-sitecore-instance-with-sitecore-command-line-interface.html#use-a-non-interactive-client-login-client-credentials-flow:~:text=After%20logging%20in%20with%20the%20client%20credentials%20flow%2C%20you%20can%20switch%20to%20the%20device%20flow%20by%20running%20the%20following%20command%3A) (if needed) + ```typescript dotnet sitecore project create -n <> ``` + This command will create a new project with the name provided as the value for the -n parameter. This command will return the ID of the created project which we will use in subsequent commands. ```typescript dotnet sitecore cloud environment create --project-id <> -n << ENVIRONMENT_NAME>> ``` + This command will create a new environment with the name passed into the -n parameter. It will return the ID of the created environment which we will use in subsequent commands. ```typescript dotnet sitecore cloud deployment create --environment-id << ENVIRONMENT_NAME >> --upload ``` + This command will create a new deployment for the previously created environment. The --Upload flag is optional, when not provided you will get a clean XM Cloud installation, none of your code will be deployed. When running the command within a DevOps pipeline, you can use it to upload your custom codebase to the platform. - - ### Deploying your head -Sitecore XM Cloud is based on a Headless architecture pattern. This means that your site is served by a separate application (or head), to your main XM Cloud Infrastructure. The customer will need to provision this application as well. Currently, XM Cloud has a connector for Vercel & Netlify allowing you to provision your head directly from within the XM Cloud Deploy Application. It is recommended to use this connector to deploy your site to Vercel where possible, however there are some scenarios where that won’t be possible and you will have to manage the deployment of this separately, for example +Sitecore XM Cloud is based on a Headless architecture pattern. This means that your site is served by a separate application (or head), to your main XM Cloud Infrastructure. You will need to provision this application as well. Currently, XM Cloud has a connector for Vercel & Netlify allowing you to provision your head directly from within the XM Cloud Deploy Application. It is recommended to use this connector to deploy your site to Vercel where possible, however there are some scenarios where that won’t be possible and you will have to manage the deployment of this separately, for example -- You’re not using Vercel orNetlify to host your head. +- You’re not using Vercel or Netlify to host your head. - You’re not using a Monorepo and your head and XM Cloud application elements are stored in separate repositories. - You’re using the CLI to deploy XM Cloud as described above, and want to manage your head deployments using the CI/CD tooling. ### Deploy using the Vercel or Netlify Connector -Once you have provisioned your XM Cloud Infrastructure and created a Site return to the Sites tab in the Deploy application for your Environment. Then, click the button on the right and choose “Set up hosting”. Complete the sections and follow the prompts to deploy your site to a new installation. +Once you have provisioned your XM Cloud Infrastructure and created a Site return to the Sites tab in the Deploy application for your Environment. Then, click the button on the right and choose “Set up hosting”. Complete the sections and follow the prompts to deploy your site to a new installation. More documentation can be found on the [Vercel Connector](https://doc.sitecore.com/xmc/en/developers/xm-cloud/deploy-your-front-end-application-to-vercel.html) and [Netlify Connector](https://doc.sitecore.com/xmc/en/developers/xm-cloud/deploy-your-front-end-application-to-netlify.html) documentation. - ### Deploy a custom head deployment If you need to create a custom deployment for your head, then the approach you take will vary for each project, depending on the Hosting Platform and CI/CD tooling that you choose to use. You can see some getting started guides for some of the more common hosting providers below: @@ -108,18 +126,26 @@ Note that each of the above platforms have different pros/cons, and each support Further information on the best approaches can be found in the [Hosting Head Applications](/learn/accelerate/xm-cloud/pre-development/hosting-applications) recipes. + + + Currently, Sitecore strongly recommends Vercel or Netlify for Next.js hosting. These hosts give the most complete feature set for Next.js. + +Azure App Services and Azure Static WebApps have a lot of limitations so these options are not recommended at this time. Please see this blog post for the reasons why: [Sitecore and Azure Static Web Apps](https://exdst.com/posts/20240121-sitecore-azure-static-web-apps) + + ## Insights + Sitecore’s Developer Relations team maintain an [open-source example](https://github.com/Sitecore/XM-Cloud-Introduction ) showing how to pull a lot of what is discussed above together. This is designed to showcase how you can build out your own custom deployments for XM Cloud. -This repository is a multi-site XM Cloud instance with five real-world live sites contained, they are each built with either NextJS or the http://ASP.NET Rendering SDK. The deployments are all handed via the Sitecore CLI for the XM Cloud infrastructure pieces and we use Vercel provisioned via the Vercel CLI to host the different heads. The CI/CD tool used to pull all of this together is GitHub Actions, and you can see the workflow definitions used to achieve this, included in the repository. +This repository is a multi-site XM Cloud instance with five real-world live sites contained, they are each built with either NextJS or the Rendering SDK. The deployments are all handed via the Sitecore CLI for the XM Cloud infrastructure pieces and we use Vercel provisioned via the Vercel CLI to host the different heads. The CI/CD tool used to pull all of this together is GitHub Actions, and you can see the workflow definitions used to achieve this, included in the repository. -## Related Recipes +### Related Recipes -## Related Documentation +### Related Documentation @@ -131,7 +157,7 @@ This repository is a multi-site XM Cloud instance with five real-world live site ### Related Links - - + +