<commit_before>// Module included in the following assemblies:
//
// assembly-auth-services.adoc

[id='proc-deploying-standard-auth-service-ha-{context}']
= Deploying the `standard` authentication service for high availability (HA)

For production deployment, the authentication services should be setup for high availability in order to reduce downtime during {KubePlatform} updates or in the event of a node failure. To implement the `standard` authentication service in HA mode, you deploy it using a PostgreSQL database as the backend.

.Prerequisites
* A PostgreSQL database.

.Procedure

ifeval::["{cmdcli}" == "oc"]
. Log in as a service admin:
+
[subs="attributes",options="nowrap"]
----
{cmdcli} login -u admin
----
endif::[]
. Create a secret with the database credentials:
+
[source,yaml,options="nowrap"]
----
{cmdcli} create secret generic db-creds -n _{ProductNamespace} --from-literal=database-user=_admin_ --from-literal=database-password=_securepassword_
----

. Create an `AuthenticationService` definition:
+
[source,yaml,options="nowrap"]
----
apiVersion: admin.enmasse.io/v1beta1
kind: AuthenticationService
metadata:
  name: standard-authservice
spec:
  type: standard
  standard:
    replicas: 2
    datasource:
      type: postgresql
      host: database.example.com
      port: 5431
      database: auth
      credentialsSecret:
        name: db-creds
----

. Deploy the authentication service:
+
[options="nowrap",subs="attributes"]
----
{cmdcli} create -f standard-authservice.yaml -n _{ProductNamespace}_
----<commit_msg>Docs: Fix code block formatting HA auth service (#4541)<commit_after>// Module included in the following assemblies:
//
// assembly-auth-services.adoc

[id='proc-deploying-standard-auth-service-ha-{context}']
= Deploying the `standard` authentication service for high availability (HA)

For production deployment, the authentication services should be setup for high availability in order to reduce downtime during {KubePlatform} updates or in the event of a node failure. To implement the `standard` authentication service in HA mode, you deploy it using a PostgreSQL database as the backend.

.Prerequisites
* A PostgreSQL database.

.Procedure

ifeval::["{cmdcli}" == "oc"]
. Log in as a service admin:
+
[subs="attributes",options="nowrap"]
----
{cmdcli} login -u admin
----
endif::[]
. Create a secret with the database credentials:
+
[source,yaml,options="nowrap",subs="+quotes,attributes"]
----
{cmdcli} create secret generic db-creds -n _{ProductNamespace}_ --from-literal=database-user=_admin_ --from-literal=database-password=_secure-password_
----

. Create an `AuthenticationService` definition:
+
[source,yaml,options="nowrap"]
----
apiVersion: admin.enmasse.io/v1beta1
kind: AuthenticationService
metadata:
  name: standard-authservice
spec:
  type: standard
  standard:
    replicas: 2
    datasource:
      type: postgresql
      host: database.example.com
      port: 5431
      database: auth
      credentialsSecret:
        name: db-creds
----

. Deploy the authentication service:
+
[options="nowrap",subs="+quotes,attributes"]
----
{cmdcli} create -f standard-authservice.yaml -n _{ProductNamespace}_
----
{'fraction_non_alphanumeric': 0.12248110831234257, 'fraction_numerical': 0.005667506297229219, 'mean_word_length': 4.225328947368421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6983945', 'n_tokens_mistral': 932, 'n_tokens_neox': 912, 'n_words': 292}