Tuesday, August 3, 2021

AEM local Set up

 

Setting up a local development environment is the very first step when establishing an Adobe Experience Manager or AEM. Below is the prerequisite list to setup AEM on local.


Prerequisites:

Following softwares are required for installation on one’s local environment:

AEM jar file- connect with Adobe to get jar file and license properties. You can get temporary license. If you working in an organization then you can coordinate with organization teams to get jar files.

Java( 8+) for AEM-6.5

java-11 for AEM sdk

Maven- 3.5+


 Java Setup

Ø      Download jdk-11 from official site. You can set up via zip extraction or directly with exe file.




For Java JDK 11- Path variables that need to be set:

  • Create the system or user variables for the following:
  • Open Advance system settings
  • Click Environment Variables

 

Click New in System Variable and add JAVA_HOME to set jdk. Click Ok.



 

Ø      Maven setup

o   Download maven from official site.

o   Extract and set up on your machine. Please follow link to set up on windows:

o   Setting up maven in system variable. Refer above’s screenshot.

Same environment steps for maven.

 Now click path in system variables.

Add below entries for java and maven:

Click New and add below bin path for “Java”

 %JAVA_HOME%\bin

 Click New and add below bin path for “Maven”

 %MAVEN_HOME%\bin

 Click ok and close environment variables.







Ø         AEM Setup

 

o   Copy aem jar file in any folder.

o   Extract the file in a folder.

o   Rename the aem-sdk jar file inside to cq-author-p-4502

    Paste license.properties files in his folder for aem 6.5 or below versions.







o   There is one more dispatcher zip if you are installing aem-sdk. Please ignore at this moment. It would be used for dispatcher setup.




o   Open command prompt here

o   Run below command to create author instance on local machine:

 

 java -jar cq-author-p4502.jar in command prompt.

 

when prompted to enter a password use “admin” as password.



o   Server will be up in 4-5 minutes and the AEM console will open on port 4502.

o   It means author instance is running on 4502 port.

o   Following screen comes up when the server is up:


o   You need to login with the userId/password as admin/admin

and following screen opens and you are good to go! 😊

 


Similarly, setup publish environment by renaming jar file to “cq-publish-p-4503”. It means your publish instance will run on 4503 port.


To start server manually- use below command:


Go to crx-quickstart /bin folder


double click start.bat file for windows

or

run ./start in terminal for mac/linux






Monday, May 17, 2021

Venia Code with AEM SDK and Magento

 

In last blog we have setup AEM SDK with CIF add-on in AEM author instance. Now its time to deploy Venia ecommerce project.

Prerequisites:

1. AEM as a Cloud Service SDK

2. Java 11

3. Node.js

4. npm

5. Magento Instance URL 

Follow below steps to deploy existing project on AEM author:

1. Clone aem-cif-guides-venia project

git clone https://github.com/adobe/aem-cif-guides-venia.git

2. Comment dispatcher profile from root pom.xml ( not required as of now)

3. Go to Project directory and run below command to deploy code on AEM author:



4. Once the project is installed in AEM , traverse to http://localhost:4502/commerce.html or go to

http://localhost:4502/aem/start.html > Commerce>

5. Below is the error that shows up when you open the console.







This is because our AEM instance can’t access the Cross origin graphQL proxy endpoint of Magento.

6. To setup proxy, run below command:

npx local-cors-proxy --proxyUrl http://localhost/magento2 --port 3000 --proxyPartial ""

If you have already run this command as part of previous blog then skip this step.

7. Now go to http://localhost:4502/aem/start.html 

Tools > Cloud services > CIF Configuration


Click Properties

Add below configuration:

  • GraphQL point: default( by default selected)
  • Store view: default
  • GraphQL query path : http://localhost:3000/graphql
  • language: English
  • Root category Id: 2




Click Save & Close.

8. Go to http://localhost:4502/aem/start.html > commerce>

or directly http://localhost:4502/commerce.html/browse

you can see Viena Code is coming in commerce 




Click on viena, all products gets loaded





And graphQL query is



Happy Coding!!!









AEM Commerce As Cloud Service with CIF Add-On


 

In this post we will discuss how to setup the AEM commerce as a cloud service with CIF add-on.

 

Setup of AEM commerce as a cloud service :

 A local development environment is recommended to work with CIF projects and how to setup one is explained below:

 

Prerequisites:

Some of the prerequisites for the setup are :

1. AEM as a Cloud Service SDK

2. Java 11

3. Node.js

4. npm

5. Magento Instance URL

 

First of all , the latest CIF add-on should be downloaded from the Software Distribution portal. It is a zip file which contains the respective far file as add-ons for author and publish instance.

Now follow the steps below :

 

1. Make sure you have the latest AEM as a cloud service SDK.

2. Unpack the jar by running java -jar <jar_name> -unpack in the command line to create a quickstart folder.

3. Once the quickstart folder has been created , go inside it and create a folder named install.



4. Unzip the CIF add-on package file and copy the correct .far file in the install folder of the relative instance you are planning to run i.e. author .far file for author-4502 instance and publish .far for publish-4503 .


5. Create a local environment variable named COMMERCE_ENDPOINT holding the Magento GraphQL endpoint.

I have installed my Magento instance on my local machine and it is running on:

http://localhost/magento2/admin





In Windows : set COMMERCE_ENDPOINT=<magento_endpoint_url>/graphql

In MAC : export COMMERCE_ENDPOINT=<magento_endpoint_url>/graphql

Using echo, you can check your COMMERCE_ENDPOINT value



6. Now run the jar by running java -jar <jar_name> in the command line.

7. You will also need to setup the proxy server for Magento endpoint so that the endpoint is available locally for CIF add-on and the CIF core components and to get the products binded in the Commerce console. 

Run the following command to do that :

In Windows:

npx local-cors-proxy --proxyUrl http://localhost/magento2 --port 3000 --proxyPartial ""

Note: While setting up the proxy server , pass your Magento endpoint without /graphQL.

Your proxy server will be started stating Proxy Active and you can check the same by replacing proxied part with the http://localhost:3000/





Login to the AEM SDK and verify the CIF add-on related bundles at http://localhost:4502/system/console/osgi-installer

You will also be able to see the additional Commerce tab in http://localhost:4502/aem/start.html



Setup of the local AEM Commerce as a Cloud Service is completed now.

To deploy Viena project Follow Venia project with AEM

Happy Coding!!!


Thursday, August 20, 2020

Terraform - IAC

 


Lot of tools available if you search for infrastructure as code: 

But Cloudformation and Terraform are provisioning tools. Here we will discuss about Terraform.

Terraform is the infrastructure as code offering from HashiCorp. It is a tool for

  • building, 
  • changing, 
  • managing infrastructure

 in a safe, repeatable way. 

Infrastructure as Code

It is the process of managing infrastructure in a file(s) rather than manually configuring resources in a user interface. A resource in this instance is any piece of infrastructure in a given environment, such as a virtual machine, security group, network interface, etc.

Terraform

  • Terraform allows operators to use HCL to author files containing definitions of their desired resources.
  • Almost any provider (AWS, GCP, GitHub, Docker, etc)

Workflows

A simple workflow for deployment will follow closely to the steps below.
  • Scope - Confirm what resources need to be created for a given project.
  • Author - Create the configuration file in HCL based on the scoped parameters
  • Initialize - Run terraform init in the project directory with the configuration files. This will download the correct provider plug-ins for the project.
  • Plan & Apply - Run terraform plan to verify creation process and then terraform apply to create real resources as well as state file that compares future changes in your configuration files to what actually exists in your deployment environment.

Advantages

  • Platform Agnostic
  • State Management
  • Operator Confidence

Install Terraform

Follow Install terraform to install.

Install Terraform

 coming soon

Tuesday, August 18, 2020

ADOBE Sites Developer Preparation Questions

 

´Adobe Experience Sites Developer Exam Guide Exam- AD0-E103

´Get Official Exam guide for AEM developer sites here:

https://spark.adobe.com/page/pszIHVOp7KKuR/


´Exam Questions


  •  Get 200+ Questions for preparation of AEM Sites developer certification.
  •  Questions available in word/pdf format.
  •  Questions with answers are available.
  •  Helpful for AEM learning at both developer and lead developer level.


´Contact to Purchase

 Refer Blogs: https://codingwithtea.blogspot.com/



Friday, August 14, 2020

ACID - DBMS

 

Atomicity Consistency Isolation Durability (ACID)



ACID refers to a database system’s four transaction properties: atomicity, consistency, isolation and durability.




Transactions: A transaction is a single logical unit of work which accesses and possibly modifies the contents of a database. Transactions access data using read and write operations.

In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties. It is a sequence of operations that satisfies these properties.


Let's go ACID properties in detail:

Atomicity: Nothing or All

Atomicity is a property that ensures that a database follows the all or nothing rule. In other words, the database considers all transaction operations as one whole unit or atom. There is no midway i.e. transactions do not occur partially.

It involves the following two operations.

Abort: If a transaction aborts, changes made to database are not visible.
Commit: If a transaction commits, changes made are visible.

Thus, when a database processes a transaction, it is either fully completed or not executed at all. If a single portion of the transaction fails, the whole transaction will fail.

For example, user X wants to withdraw $50 from his account and then transfer it to the account of user Y. Each transaction (withdrawing $50 from account X and transferring $50 to account Y) is counted as separate. If the first transaction (withdrawing $50) fails because (say) the server crashes during the transaction, user X cannot transfer the money to user Y.

Consider the following transaction T consisting of T1 and T2: Transfer of 50 from account X to account Y.

Initial Balance: X=100 , Y=200


T1 Transaction:


Read(X)
X= X-50
Write(X)

T2 Transaction:

Read(Y)
Y=Y+50
Write(Y)

If the transaction fails after completion of T1 but before completion of T2.( say, after write(X) but before write(Y)), then amount has been deducted from X but not added to Y. This results in an inconsistent database state. X has left $50 in his account as $50 has been deducted but Y has $200(same as before). Transaction got failed. What if Y doesn't get $50 and X's reaction would be😱

Hence, Atomicity is particularly important to mitigate damage in case of database server crashes. If a non-volatile database crashes in the middle of a transaction, all changes done will be discarded or rolled back to avoid sending partial results to the production database.

Hence we can say Atomicity is required. Transaction (T1+T2) takes place at once.

Consistency:

Consistency is key to maintain data integrity. Consistency is a property ensuring that only valid data following all rules and constraints is written in the database. When a transaction results in invalid data, the database reverts to its previous state, which abides by all customary rules and constraints.

For example, if user X wants to withdraw $1,000 from his account, but only has a balance of $500, consistency will prevent him from withdrawing money and the transaction will be aborted.

Current Balance: $500
Wants to withdraw: $1000
How?😳

"User X hasn't sufficient balance!"

atm balance


Isolation:

Isolation ensures that multiple transactions can occur concurrently without leading to the inconsistency of database state. It is a property that guarantees the individuality of each transaction, and prevents them from being affected from other transactions.

For example, user X withdraws $100 and user Y withdraws $150 from user Z’s account, which has a balance of $1,000. Since both A and B draw from Z’s account, one of the users is required to wait until the other user transaction is completed, avoiding inconsistent data.

User Z Balance: $1000
User X wants to withdraw: $100
User Y wants to withdraw: $150

One user has to wait till other's transaction is being completed. For e.g. Y has to wait till X's transaction is in progress.  

Durability

Durability is a property that enforces completed transactions, guaranteeing that once each one of them has been committed, it will remain in the system even in case of subsequent failures.

If a transaction is successful, all changes generated by it are stored permanently.

Let's say in above example, user Y may withdraw $100 only after user X’s transaction is completed and is updated in the database. If the system fails before X’s transaction is logged in the database, X cannot withdraw any money, and Z’s account returns to its previous consistent state.


So, once the transaction has completed execution, the updates and modifications to the database are stored in and written to disk and they persist even if a system failure occurs.









ElasticSearch vs Apache SolrCloud

  Elasticsearch and Apache SolrCloud are both powerful, distributed search engines built on top of Apache Lucene. Both Elasticsearch and S...