Skip to content

Instantly share code, notes, and snippets.

View nanpingxiang's full-sized avatar
🎯
Focusing

nanpingxiang nanpingxiang

🎯
Focusing
  • 中国北京
View GitHub Profile
@nanpingxiang
nanpingxiang / _keycloak-cluster-config.md
Created November 3, 2023 02:37 — forked from dasniko/_keycloak-cluster-config.md
How to configure a Keycloak cluster properly (Quarkus edition)

Keycloak Cluster Configuration (How to)

This is a short and simple example on how to build a proper Keycloak cluster, using DNS_PING as discovery protocol and an NGINX server as reverse proxy.

To get it working properly, just enable Docker Swarm mode with docker swarm init and just run it as it were a regular Docker Compose deployment. So, just docker compose up is enough, don't deploy a swarm stack! (This would cause trouble and extra complexity with networking)
Afterwards, you can disable Swarm again with docker swarm leave -f, if needed.


@nanpingxiang
nanpingxiang / _keycloak-cluster-config.md
Created November 3, 2023 02:36 — forked from dasniko/_keycloak-cluster-config.md
How to configure a keycloak cluster properly (legacy Wildfly edition)

Keycloak Cluster Configuration (How to) - Legacy Wildfly Distribution!!!

This is a short and simple example on how to build a proper Keycloak cluster, using JDBC_PING as discovery protocol and an NGINX server as reverse proxy.

Please see also my video about Keycloak Clustering: http://www.youtube.com/watch?v=P96VQkBBNxU

@nanpingxiang
nanpingxiang / create_x509_certs.md
Created November 3, 2023 02:36 — forked from dasniko/create_x509_certs.md
Creating self signed tls certificates with self-signed root CA

Because of Arjuna timeout / closing the connection after 5 mins, setting following additional JAVA_OPTS might help:

-Dquarkus.transaction-manager.default-transaction-timeout=3600
-Dkeycloak.migration.batch-enabled=true
-Dkeycloak.migration.batch-size=1000
@nanpingxiang
nanpingxiang / README.md
Created June 14, 2021 12:28 — forked from NiceGuyIT/README.md
nginx JSON to Filebeat to Logstash to Elasticsearch

Intro

This is an example configuration to have nginx output JSON logs to make it easier for Logstash processing. I was trying to get nginx > Filebeat > Logstash > ES working and it wasn't until I connected Filebeat directly to Elasticsearch that I saw the expected data. Google led me to ingest-convert.sh and I realized filebeat setup works for Filebeat > ES but not Filebeat > Logstash > ES. This is because Logstash does not use ingest pipelines by default. You have to enable them in the elasticsearch output block.

Having nginx log JSON in the format required for Elasticsearch means there's very little processing (i.e. grok) to be done in Logstash. nginx can only output JSON for access logs; the error_log format cannot be changed.

Extra fields are output and not used by the Kibana dashboards. I included them in case they might be useful. Since they are not declared in the filebeat setup, their default is "string" when yo

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
prometheus: system
role: alert-rules
name: prometheus-system-rules
namespace: monitoring
spec:
groups:
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
prometheus: others
role: alert-rules
name: prometheus-others-rules
namespace: monitoring
spec:
groups:
@nanpingxiang
nanpingxiang / rules.yml
Created January 14, 2021 08:46 — forked from hagen1778/rules.yml
Migrating data from Prometheus to VM. Prometheus rules config
groups:
- name: CPU rules
interval: 10s
rules:
# The count of CPUs per node, useful for getting CPU time as a percent of total.
- record: instance:node_cpus:count
expr: >
count without (cpu, mode) (
node_cpu_seconds_total{mode="idle"}
)
@nanpingxiang
nanpingxiang / List_of_ENV_in_Windows.md
Created January 10, 2021 02:34 — forked from pkfrom/List_of_ENV_in_Windows.md
List of Environment Variables in Windows Operating System.

List of Environment Variables in Windows Operating System

Windows XP Environment Variables

Environment Variable Path
%ALLUSERSPROFILE% C:\Documents and Settings\All Users
%APPDATA% C:\Documents and Settings{username}\Application Data
%COMMONPROGRAMFILES% C:\Program Files\Common Files
%COMMONPROGRAMFILES(x86)% C:\Program Files (x86)\Common Files
@nanpingxiang
nanpingxiang / crlf.py
Created December 24, 2020 05:24 — forked from jonlabelle/crlf.py
Replace CRLF (windows) line endings with LF (unix) line endings in files.
#!/usr/bin/env python
"""Replace line breaks, from one format to another."""
from __future__ import print_function
import argparse
import glob
import os
import sys