<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: yazn zamel</title>
    <description>The latest articles on DEV Community by yazn zamel (@yaznzamel).</description>
    <link>https://dev.to/yaznzamel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1206604%2F2ccf7471-cab6-4d98-b892-0aceebe894ff.jpg</url>
      <title>DEV Community: yazn zamel</title>
      <link>https://dev.to/yaznzamel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yaznzamel"/>
    <language>en</language>
    <item>
      <title>Rethinking ACID: An Inquiry Into Their Fundamental Properties</title>
      <dc:creator>yazn zamel</dc:creator>
      <pubDate>Sun, 20 Oct 2024 05:43:18 +0000</pubDate>
      <link>https://dev.to/yaznzamel/rethinking-acid-an-inquiry-into-their-fundamental-properties-15nc</link>
      <guid>https://dev.to/yaznzamel/rethinking-acid-an-inquiry-into-their-fundamental-properties-15nc</guid>
      <description>&lt;h1&gt;
  
  
  ACID
&lt;/h1&gt;

&lt;h4&gt;
  
  
  Defining ACID by "THE TRANSACTION" example
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F966fbl1kh76kkudbkq30.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F966fbl1kh76kkudbkq30.png" alt="Image description" width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Banking systems relies on transaction for money going in and out , they rely on a method called "double entry" , which goes as following  : when a user deposit a certain amount of cash a &lt;strong&gt;Transaction&lt;/strong&gt; of addition (++) is made on the liability side indicating the bank owes the customer XX$ amount of money , also another transaction is made on the &lt;strong&gt;Assets&lt;/strong&gt; side which indicate the bank now have more cash. The Assets and Liabilities amounts are stored in a separate account , At the end of the day to ensure accuracy and balance, the bank will subtract the total liabilities from the total assets. In a properly functioning system, this difference must equal zero. This means that every dollar (or other currency) added to the assets has a corresponding entry on the liabilities side, maintaining the balance.&lt;/p&gt;

&lt;p&gt;Now, imagine a scenario where multiple failures occur during the processing of online transactions. Unlike physical transactions, which can be easily traced, a lost online transaction can vanish without a trace, leaving no physical record behind. This creates a critical challenge for the bank, as tracking and resolving these issues becomes difficult, potentially leading to significant financial losses and undermining the trust of customers."&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Transaction : a series of queries written by a developer to execute a certain logic. The transaction ends once "COMMIT" word is present.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flzdcr99rswbn9s275b9h.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flzdcr99rswbn9s275b9h.jpg" alt="Image description" width="800" height="798"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Atomicity
&lt;/h3&gt;

&lt;p&gt;This concept came from the actual atom concept that the atom can not be divided (at least at the past time) , and they applied the same concept on the a database transaction.&lt;br&gt;
Physical atom properties : &lt;/p&gt;

&lt;h5&gt;
  
  
  All-or-Nothing Nature:
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Atom: An atom is the smallest unit of an element that can't be divided without losing its fundamental properties. If an atom is split, it no longer retains the characteristics of the original element.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Transaction: A transaction in a database must be fully completed or not at all. If any part of the transaction fails, the entire transaction is rolled back to ensure nothing partial remains.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Integrity
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Atom: Integrity in an atom means it maintains the specific identity of the element (like the number of protons) that defines it. It remains consistent with its element’s characteristics unless it undergoes a fundamental change.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Transaction: Integrity in a transaction ensures the database remains consistent and correct. All changes are applied together to maintain the database’s accuracy. If a transaction fails, it prevents any partial, inconsistent states by rolling back.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Jack : why atomicity , why don't we just keep things simple ? &lt;/p&gt;

&lt;p&gt;Author : Since you asked, let's consider a straightforward scenario. Imagine that at the end of the month, your company sends your expected salary to your bank account. Now, suppose the bank, responding to your complaint about things being too complex, decides to simplify by hosting everything on a single database but fails to apply the &lt;strong&gt;Atomic&lt;/strong&gt; property. During the transaction from the company's account to yours, the system crashes and needs to be restarted. Unfortunately, the first part of the transaction—where the money is withdrawn from the company's account—completes successfully, but just as the system is about to deposit the money into your account, it crashes!! &lt;/p&gt;

&lt;p&gt;Author : So now what ? do you want to keep it simple ? does it sound simple now to you when you have bills , family , loan ? &lt;/p&gt;

&lt;p&gt;yeah man , that's why we &lt;strong&gt;&lt;em&gt;care&lt;/em&gt;&lt;/strong&gt; about every detail and not make things complex. &lt;/p&gt;

&lt;p&gt;How we as software engineers , Developers or people who care manage such kind of issues ? &lt;/p&gt;

&lt;p&gt;When such failure happens , we will have to rollback the partial successfully executed queries (which is the withdrawn from company account) to ensure the atomic property. &lt;/p&gt;

&lt;p&gt;what if the transaction was very long that consist of 10s or 100 of queries ? well it's better that we stay safe in such situation.  &lt;strong&gt;However&lt;/strong&gt; there is a method in postgresql called 2PC (Two Phase Commit) that can be used in distributed transactions. With 2PC, a transaction is prepared and partially committed in a way that it can be safely completed or rolled back later. This process involves:&lt;/p&gt;

&lt;h3&gt;
  
  
  Consistency (The sacrificed property)
&lt;/h3&gt;

&lt;p&gt;Jack : now what is this &lt;em&gt;&lt;strong&gt;consistency&lt;/strong&gt;&lt;/em&gt; ? we already solved everything with the Atomicity ....&lt;/p&gt;

&lt;p&gt;Author : you wish , lemme ask you this : if a transaction is committed with a new change , will another transaction running at the &lt;strong&gt;same&lt;/strong&gt; time or after it in a &lt;strong&gt;few&lt;/strong&gt; see that change ? &lt;/p&gt;

&lt;p&gt;Jack : huh ! , just go ahead with your example man. &lt;/p&gt;

&lt;p&gt;Alright , following up on the company salary transfer , imagine it's the end of the month and you have promised your son you will get him the new PS5 , once your salary is transferred. Now probably your son is waiting for your salary more than you do. You opened the bank application and still can't find it there , you open it again and there it is !!!. Now you went with him to buy him the ps5 and while you are at the cashier you get the following message "your transaction is declined , due to insufficient balance" , huh ??? &lt;/p&gt;

&lt;p&gt;Look what happened : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4frwd9i664fwaxaykjw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4frwd9i664fwaxaykjw2.png" alt="Image description" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A lot of databases gave up on consistency as a trade-off for performance.&lt;/p&gt;

&lt;p&gt;When looking at Consistency , you should consider two points : &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;consistency of read operation&lt;/li&gt;
&lt;li&gt;consistency of referential relationship
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;consistency of read operation&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;This type of consistency is usually tied to type of synchronization between databases in Leader-Follower architecture .  &lt;/p&gt;

&lt;p&gt;The inconsistency arise due to the type of synchronization between follower - leader database , options comes as follow : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4endifqaet18v2msx9kq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4endifqaet18v2msx9kq.png" alt="Image description" width="800" height="479"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolation
&lt;/h3&gt;

&lt;p&gt;Isolation : &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The capability of a database system to enable multiple transactions to access the same data simultaneously without causing interference with one another.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Isolation is like whether a database want to be social , but it will be vulnerable (not security wise though) and it's somehow something we can configure , it can very social , moderately social , not social. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Very Social (Lower isolation)&lt;/strong&gt; : Increases the ability of many users to access the same data at the same time &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Moderately Social&lt;/strong&gt; : Somehow in between , wait till your read the third point....&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not Social (Lower Isolation)&lt;/strong&gt; : Decrease the ability of many users to access the same data (lower concurrency) --&amp;gt; needs more system resources (some stakeholders are fine with it though).&lt;/p&gt;

&lt;p&gt;Let's go back to jack , he makes us explain it better.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwyvtnzgzgkziphv6ij2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwyvtnzgzgkziphv6ij2d.png" alt="Image description" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jack : i will be chill with this one , let's see what you got now . How can this property save my bank account ? &lt;/p&gt;

&lt;p&gt;Author : thanks man , this time i want us to blend to the real world scenarios , in a bank account you have a credit card with certain balance if this credit card goes in negative under 10000$ you either lose some credit card score or you get charged some fee. &lt;/p&gt;

&lt;h5&gt;
  
  
  How isolation could saves you from unnecessary fees :
&lt;/h5&gt;

&lt;p&gt;&lt;strong&gt;Dirty Read&lt;/strong&gt; : when two transactions (t1 , t2) are accessing the same data , however one of those transaction reads something that is not really written to the database , but &lt;u&gt;promised&lt;/u&gt; to be there . &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Dirty read : because it read a dirty record&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwi5zf2mdlhthf3ydopm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwi5zf2mdlhthf3ydopm.png" alt="Image description" width="449" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nonrepeatable read&lt;/strong&gt; : when two transactions (t1 , t2) are happening the same time , one of the transactions read a value twice (or more) in the same transaction but one or more reads produces different values.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fijvbcr96c8d1tiph6q04.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fijvbcr96c8d1tiph6q04.png" alt="Image description" width="468" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phantom read&lt;/strong&gt; : when two transactions (t1 , t2) are happening the same time , one of the transactions insert a row which will be found in the second transaction as it is a value from the void.&lt;/p&gt;

&lt;p&gt;You may ask what is the problem with phantom read , the issue resides that while i am doing a transaction the data should be consistent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmr59l9n4vsvtk6w201h6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmr59l9n4vsvtk6w201h6.png" alt="Image description" width="479" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Durability
&lt;/h2&gt;

&lt;p&gt;Empower a &lt;strong&gt;&lt;u&gt;&lt;em&gt;Commited&lt;/em&gt;&lt;/u&gt;&lt;/strong&gt; transaction to survive a system failure. means , i commit - you write to disk. &lt;/p&gt;

&lt;p&gt;The question is "isn't this how databases operate ? Once i commit it writes to the disk ?"&lt;/p&gt;

&lt;p&gt;The answer to this question could vary depending on the database engine you are using , since some database have been implemented to be highly performing and reduce latency which in fact makes it write to your backend server cache or to the cache of the database server and then writing the data in batches to the disk. This doesn't only make writing to the database fast but in fact makes reading from the database fast as well since the recent written data is still cached.&lt;/p&gt;

&lt;p&gt;So the key takeaways from this property is to always check the configurations available for the database and tune it based on your needs and application requirements.&lt;/p&gt;

&lt;p&gt;Critical applications where data loss tolerance is near zero requires you to flush committed transactions from the database engine to the disk often.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Keycloak 22.0.5 on ubuntu with Postgresql</title>
      <dc:creator>yazn zamel</dc:creator>
      <pubDate>Sat, 11 Nov 2023 10:26:59 +0000</pubDate>
      <link>https://dev.to/yaznzamel/keycloak-2205-on-ubuntu-with-postgresql-4h0n</link>
      <guid>https://dev.to/yaznzamel/keycloak-2205-on-ubuntu-with-postgresql-4h0n</guid>
      <description>&lt;p&gt;Keycloak is an open-source identity and access management (IAM) service that provides robust authentication, authorization, and security features for applications and services. It allows organizations to easily manage user identities, secure access to resources, and implement single sign-on (SSO) capabilities, enhancing both user experience and security. Keycloak supports various authentication methods and can be integrated seamlessly with a wide range of applications, making it a valuable tool for identity and access control in modern software development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keycloak installation on ubuntu 20.04
&lt;/h2&gt;

&lt;p&gt;Since keycloak is built with java , we need to install java in our machine and make sure that java version is compatible with our keycloak version , we are using &lt;strong&gt;version 22.0.5&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;you can switch to the root user to avoid typing &lt;em&gt;sudo&lt;/em&gt; each time you run command by "sudo -i" , however i will continue the tutorial using sudo&lt;/p&gt;

&lt;p&gt;installing java-17&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update 
sudo apt install openjdk-17-jdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Installing keycloak&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# any external software should be in the /opt
cd /opt
sudo wget https://github.com/keycloak/keycloak/releases/download/22.0.5/keycloak-22.0.5.tar.gz

sudo tar -xvf keycloak-22.0.5.tar.gz

# create a keycloak user and group
groupadd keycloak
useradd -r -g keycloak -d /opt/keycloak -s /sbin/nologin keycloak

# set the directory ownership 
chown -R keycloak: keycloak 
chmod o+x /opt/keycloak/bin

# now we have given the keycloak user the permission to 
# execute it's binaries 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will move the .conf files from the current directory to the /etc  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;/etc folder is used to save the configuration files&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /etc
mkdir keycloak

cp /opt/keycloak/conf/keycloak.conf /etc/keycloak/keycloak.conf

# give the keycloak service the ownership to be able to run 
#the kc.sh file
chown keycloak: /opt/keycloak/bin/kc.sh

# create a service in the system 
cd /etc/systemd/system
nano keycloak.service 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the keycloak.service file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Unit]
Description=Keycloak Authorization Server
After=network.target
 
[Service]
User=keycloak
Group=keycloak
ExecStart=/opt/keycloak/bin/kc.sh start
ExecStop=/opt/keycloak/bin/kc.sh stop
Restart=always
RestartSec=3
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;start the keycloak service&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl daemon-reload # any change you do on the keycloak.service file run this command after it
systemctl start keycloak.service 
systemctl status keycloak.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;before moving the postgresql part , make sure to install the postgresql client on the keycloak vm&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt install postgresql-client-common
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install Postgresql and connect it with our keycloak
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install postgresql postgresql-contrib -y

# now switch to the postgresql user to create the keycloak table
sudo -i -u postgres

psql
CREATE DATABASE keycloak;
CREATE USER keycloak WITH PASSWORD 'admin';
GRANT ALL PRIVILEGES ON DATABASE keycloak TO keycloak;

\q

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will configure the postgresql to allow connection from keycloak&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#navigate to the postgresql conf file 
cd /etc/postgresql/12/main/
sudo nano pg_hba.conf

# scroll down to the IPv4 local connection and add a new line below the existing one 

host    all             all            &amp;lt;VM-IP&amp;gt;/32          md5

# we will modify the postgresql.conf file to allow the db to listen from other hosts

sudo nano postgresql.conf 
# find the line that have listen_addresses and change it to
listen_addresses = '*'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now test the connection locally from the db using this command &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;psql -h localhost -U keycloak -d keycloak&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Configuring the keycloak.service to communicate with the postgresql database&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# ssh into your keycloak vm 
cd /etc/systemd/system
nano keycloak.service
# add the following lines
Environment="DB_VENDOR=postgres"
Environment="DB_ADDR=Postgresql_IP"
Environment="DB_DATABASE=keycloak"
Environment="DB_USER=keycloak"
Environment="DB_PASSWORD=yourpassword"

# make sure to change the Environments based on your config

sudo systemctl daemon-realod
sudo systemctl restart keycloak
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: this way we are running keycloak in production mode&lt;/p&gt;

&lt;p&gt;Note: i am assuming you have opened the port for both postgresql 5432 and keycloak 8080 (this might differ)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Hope this helped you set up your environment , for any help feel free and don't hesitate to contact me. &lt;/p&gt;

</description>
      <category>programming</category>
      <category>keycloak</category>
      <category>sso</category>
    </item>
  </channel>
</rss>
