Welcome! This is my personal blog about Web technologies, software development, open source and other related topics
The ideas and opinions expressed here are solely mine and don't represent those of others, either individuals or companies.The code snippets or references to software products or analogous are to be used without any warranty of any kind. If you enjoy the content, feel free to share it and re-use it as long as you provide a link to the original post.
By default Bitcoin Core builds a database containing only the transactions for the user’s wallet.
Wallet transactions can be retireved using JSON RPC API gettransaction command.
But if you want to retrieve any transaction within the node use command getrawtransaction. This command will search transactions in the index.
bitcoin.conf fileset txindex–
Bitcoin daemon or GUI uses conf file to load settings. On the first bitcoind run it will ask to create a config file.
Set txindex=1 in the config file before running the daemon. If the indexing is enabled the bitcoin daemon then should start synching the blocks and index.
bitcond -reindex option
If the txindex is not set in config before the first run and if later you want to index the database use -reindex option.
Re-index should take a while. To improve perfromance disable -printtoconsole option
In this blog blost lets create Project and Environment to deploy the sxastarter site to XM Cloud. The deployment is based on the existing repository in GitHub and have solution ready to deploy. Please see this blog posts on how to fork Foundation Head Template and setup your local instance along with creating Headless SXA Site(sxastarter) also configure the serliazation of Sitecore items.
To create project and environment you need to have access to XM Cloud either Admin or Contributor.
An organization is business unit either company or brand and contains team members and Sitecore Products you are subscribed and can have more than one Sitecore Product as seen in the below screen.
XM Cloud Deploy
As highlighted quick links container XM Cloud Deploy
Deploy contanis list of projects and deployments done for each project and environments. It also container connections to GitHub or Vercel if site is hosted their.
The highlighted shows Organization name at the top and list of projects.
Connect to GitHub (Source Control Connections)
Ensure the changes (Sitecore Items) are pushed to GitHub repo.
Recommended – create separate branch for each environment. I have created dev, staging and main(prod)
Connections – should show list of all connections for projects mainly Github and Azure Devop for Source Control, while hosting connections can be mafe to Vercel. In this section we will configure GitHub provider.
Create a new GitHub connection
Should ask to login and provide access to a repository, you may choose all or specific repository-
Since I already had connection you will be shown a different option to Install and Authorize
Create Project
Click on Create project option
This should show the type of project to be created. We want to start from our own Source Code(GitHub) based on the connection made.
Since we configured only GitHub connection defaults to this Source Control-
Your connection name will be displayed here. Choose the connection. This will also show any other connections available.
You may also create a new connection from here.
Provide the project name and the repository where Foundation Head code resides along with any other changes you might have done sa a part of development.
Environment name – provide name – should be able to relate which branch is this pulled from.
Production environment – if this is then choose yes, I have selected this as no since I ma setting dev environment
Linked branch- Select the appropriate branch ensure yuo have all the changes available in this branch which you want to deploy
Trigger deployment on commit to branch – Set if this has to be auto deployed if changes are pushed to selected branch.
Deploy. This should start the deployment. This should take 10 -15 mins. Wait for the post actions.
You should now see the newly created project with dev environment-
New Project Created
New Environment Created
New Site Created (sxastarter)
Select environment and goto Sites tab-
Will see in the next blog hot to setup the Hosting
Select environment and Details tab- You should be able to see hostname, url’s and tokens along with Environment details.
Click on the Dashboard link –> Tools to see if the items are synched-
We now have templates, content and relevant items in layouts and image created
Content Editor with Site Collection, Site and Content
Templates Created
Experience Editor
Lets check the home page in experience editor
In the next bog will configure the Site hosting to Vercel.
Errors-
In connections select Create Connection –> GitHub
Click on Uninstall “Sitecore Deploy Prod”
Follow the process of creating a Connection again and this time you will see option to Install & Authorize
Once this is done an confirmed try creating a project –
The browser ID is a universally unique identifier (UUID) that Sitecore CDP assigns to every user of your application. It associates sessions, events, and orders with the respective user.
To generate browser id at server side in this case using postman use following URL-
{{apiEndpoint}} – API target endpoint depends on the region client key is available in. Following are the regions and url available at the point of writing this blog and as per this document –
Europe – https://api.boxever.com
Asia Pacific – https://api-ap-southeast-2-production.boxever.com
Top right click the clog icon. Select API Access option
Get teh client key from this page-
Request/Response-
Status- OK. The request was served successfuly
Anantmous(Guest) should be created. Browser ID is in “ref” field in the response
Check the guest details in portal with the Browser ID-
Goto the Guests page –
Search guests with browser id. (bid: <<browser id>>)
This should the Guest Type as Visitor which means its Anonymous and not yet known or uniquely identified.
CURL code snippet-
curl --location -g --request GET 'https://api.boxever.com/v1.2/browser/create.json?client_key=<<client key>>&message={}'
C# code snippet-
var client = new RestClient("https://api.boxever.com/v1.2/browser/create.json?client_key=<<client key>>&message={}");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Synchronizing items between environments with Sitecore Serialization. The repository already contains the necessary setup for enabling serialization if you are using an official Sitecore XM Cloud foundation template.
Pre-requisite- Setup Sitecore local instance for XM Cloud development. See this blog << Blog to setup Sitecoer instance>>
You may already see the rendering host module setup in the forked repository.
This should be available in the src folder.
Lets sync the sxastarter site created earlier whilst setting up the SXA Headless Site. << Blog post to setuop SXA headless site>>.
Please note this might not be the method you want to sync the items. Ideally you should create project in XM Cloud and site created in XM Cloud environment. I am doing the other way just to demo.
Create various modules to sync your locally created site to serialize the items
This should help to push the config and items to repository and deploy to XM Cloud later.
Sync templates-
Create a scxmcloud.templates.module.json in src folder.
We are trying to serialise templates to local. These items will be searlised-
scope by default is ItemAndDescendants. Hence not defined. Any new templates added here will be auto serialised. allowedPushOperations is set to CreateUpdateAndDelete. Like wise define the same for Feature and Foundation folders.
Define the same for Content (if required) or specific items, Media Library and Layout but this may be site specific.
For media I have configured following – Where scope id Single item and allowedPushOperations is CreateOnly, so these items are created only once.
Finally you should have following modules depending upon the youe site requirements and configuration.
Connect the local environment
After SCS configuration you should connect to local environment. To do so use the following command
This will add the endpoint in user.json file located in .sitecore folder. Alrthough there is a default endpoint which should suffice. Provide your Sitecore instnace host name as appropriate.
Local environment should be connected and now can perform sync operations.
An entry will be added in user.json file.
Next pull the items from local Sitecore instance-
dotnet sitecore ser pull -n "local"
If you see this error – ensure the names should be unique. I did a mistake by providing same name in templates module
If you see this error ensure the items to be searialised should be repeated in any other module or any other name. You may also exclude the paths for Feature and Foundation folders – /sitecore/layout/Renderings/Feature/Experience Accelerator
Assuming Sitecore local instnace is setup, lets look how to work on Graphql in local machine. See this blog post to setup the local machine for XM Cloud development.
<<Blog post url to setup local instance>>
The GraphQL playground (also called the GraphQL IDE) helps you test GraphQL queries before you use them in your application.
For local instance use the following to open the GraphQL IDE- Assuming local host name is – xmcloudcm.localhost
In this blog post we wil setup nextjs application i.e. sxastarter assuming your local Sitecore instance is up and running.
We will create a Headless SXA site in Sitecore local instance and then setup the FE application. This is can also moved outside the Foundation Head repo so that FE devs can work on this spearately.
Setup JSS app to work with local Sitecore instance
Ensure you have Sitecore instance up and running see this blog << 2. XM CLoud for local env>> or you can also see this blog
1. Setup your JSS app
Ensure you execute this commands on FE folder i.e. /src/sxastarter
Ensure you have Sitecore JSS CLI installed on local machine
Once this is installed Setup the JSS app-
jss setup
Following is required to setup-
jss setup
Is your Sitecore instance on this machine or accessible via network share? [y/n]: n
Sitecore hostname (e.g. http://myapp.local.siteco.re; see /sitecore/config; ensure added to hosts): https://xmcloudcm.localhost
Sitecore import service URL [https://xmcloudcm.localhost/sitecore/api/jss/import]:
Sitecore API Key (ID of API key item): {5797FECE-6C74-4535-88AC-5303752CCC99}
Please enter your deployment secret (32+ random chars; or press enter to generate one):
Provide the Sitecore hostname and the api secret, in this case xmcloudpreview item id at following location /sitecore/system/Settings/Services/API Keys/xmcloudpreview
Note the deployment secret. This is required to setup Headless Site, in this case it is bz39czqkd47o0n7nvfm11kaoexuouk5dq2z4fhsrl3
Also note the sscjssconfig.json file updated.
2 . Create a Healdess Tenant and Site
In your Sitecore instance create a Healdess Site Collection, you may create a folder Site Collection Folder if required-
Next provide the Site collection name, in this case scxmcloud and select the required modules-
You should see the Site collection created along with the required templates in Project/scxmcloud folder.
Setup should create folders and required items in following location. Note this as this is required whilst setting the item sync using Sitecore SCS (Sitecore Content Serialization)
Media Library – /sitecore/media library/Project/scxmcloud
Templates – /sitecore/templates/Project/scxmcloud
Create a Headless SXA Site
Create headless site under site collection-
Provide the name of the site- sxastarter
Select the modules- Note I selected the basic site module. This should add sample items to home page along with About page. You may choose not to select the basic site module.
Enter the deployment secret created whilst setting up the JSS app
Site should now be created-
Site without Basic Site module-
Open the experience editor and you should see the blank page-
Lets add the Title component to see if the changes are reflecting in Experience Editor and FE.
We now have site ready to start developing components.
Run the FE site
On your root folder /src/sxastarter folder run following-
npm install
npm run start:connected
npm install – should download all the required dependencies
You may fix any vulnerabilities by running-
npm audit fix
OR
npm audit fix --force
Before starting the jss app ensure the app name in Sitecore matches the app name in package.json file.
If you wish to change the app name you to make changes in Sitecore and package.json file.
To start the sxastarter jss app run-
npm run start:connected
If no errors the app should be available on http://localhost:3000
The newly added title in header should also be displayed-
Managed to add inbuilt components to page-
This conculdes setting up the local environment with having Sitecore CM instance and the jss app (FE) running on localhost. Note JSS app is not runing on containers as we should not force FE devs to work on containers. This scenario is good for Sitecore developers for bulding and testing the components locally.
You may pull out the sxastarter folder outside this repo and FE devs should be good to develop on theri own. Although there is a dependency to have Sitecore instance hosted on local environment.
In next blog post we will how to setup the FE without having Sitecore local instance and connect to XM Cloud.
But before that we need to setup the XM Cloud project and environments, for that we will configure the Sietcore Content Serilization to push the changes made in local to XM Cloud. Coming in next blog.
Connect your local FE app to XM Cloud.
Although not recommended but if you want ot connect the XM Cloud instance to local FE app. Follow these steps.
I need to make changes in 2 places to get this working.
In this blog we will create a Headless SXA Site in local instance, setup and resolve any errors while running the rendering app (sxastarter)
We will create a Headless SXA site in Sitecore local instance and then setup the FE application.
With the local Sitecore instance(CM) you should also see the rendering host is configured i.e. https://www.sxastarter.localhost/
While seting up the local instance we haven’t made any changes to docker compose or override files nor to the .env files manually, although while initalizing the app certian key values were updated in .env file.
Check the sxastarter rendering host- https://www.sxastarter.localhost/
At this point you might see the error since we haven;t created a sxastarter app in Sitecore.
This is because the no Site Collection or Headless Site exists in Sitecore. Lets create a Headless Tenant and Site.
2 . Create a Healdess Tenant and Site
In your Sitecore instance create a Healdess Site Collection, you may create a folder Site Collection Folder if required-
Next provide the Site collection name, in this case scxmcloud and select the required modules-
You should see the Site collection created along with the required templates in Project/scxmcloud folder.
Setup should create folders and required items in following location. Note this as this is required whilst setting the item sync using Sitecore SCS (Sitecore Content Serialization)
Media Library – /sitecore/media library/Project/scxmcloud
Templates – /sitecore/templates/Project/scxmcloud
Create a Headless SXA Site
Create headless site under site collection-
Provide the name of the site- sxastarter.
You may choose another name but ensure the package.json file is updated accordingly.
Select the modules- Note I selected the basic site module. This should add sample items to home page along with About page. You may choose not to select the basic site module.
Enter the deployment secret created whilst setting up the JSS app
Site should now be created-
Site without Basic Site module-
Keep the Site Settings as is-
sxastarter site is created along with this the choosen mdoules are installed.
Once this is done ensure the app name in Settings is same as in package.config-
Open the experience editor and you should see the blank page-
Lets add the Title component and images to see if the changes are reflecting in Experience Editor and FE.
We now have site ready to start developing components.
The newly added title in header, images should also be displayed-
This conculdes setting up the local environment with having Sitecore CM instance and the jss app (FE) running in docker. JSS app is runing in container.
In next blog post we will how to setup the FE without having Sitecore local instance and connect to XM Cloud.
But before that we need to setup the XM Cloud project and environments, for that we will configure the Sietcore Content Serilization to push the changes made in local to XM Cloud. Coming in next blog.
Errors-
sxastarter site hosted in docker throws below error.