Skip to content

Instantly share code, notes, and snippets.

View amoAHCP's full-sized avatar

Andy Moncsek amoAHCP

View GitHub Profile
@amoAHCP
amoAHCP / profiling-jvm-kubernetes-visualvm.md
Created November 2, 2023 09:55 — forked from anderson-custodio/profiling-jvm-kubernetes-visualvm.md
Profiling JVM on Kubernetes using VisualVM

Profiling JVM on Kubernetes using VisualVM

Enable JMX server

Edit Dockerfile to enable JMX server and change the hostname with the IP where the container will run:

FROM openjdk:8-jre-alpine
ADD ./target/app.jar app.jar
EXPOSE 8080
ENTRYPOINT java -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=192.168.1.2 -jar app.jar
@amoAHCP
amoAHCP / Dockerfile
Created June 20, 2018 07:01 — forked from brendan-rius/Dockerfile
DeamonSet for setting inotify config in each nodein k8s
FROM alpine
COPY configure-node.sh configure-node.sh
CMD ["/bin/sh", "configure-node.sh"]
@amoAHCP
amoAHCP / Dockerfile
Created May 18, 2018 12:39
modular runtime Image
FROM openjdk:9-jdk-sid AS builder
WORKDIR /app
COPY target/vxms-core-demo-1.2-SNAPSHOT.jar .
COPY target/mod/ .
RUN jlink --module-path vxms-core-demo-1.2-SNAPSHOT.jar:mod:$JAVA_HOME/jmods \
@amoAHCP
amoAHCP / pom.xml
Created May 18, 2018 12:35
moditec modular build
<!--
~ Copyright [2018] [Andy Moncsek]
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
@amoAHCP
amoAHCP / SimpleREST.java
Created February 1, 2017 12:54
Fabric8-Kubernetes-usage
package org.jacpfx;
import io.fabric8.kubernetes.api.model.EndpointSubset;
import io.fabric8.kubernetes.api.model.EndpointsList;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.ConfigBuilder;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Future;
/**
* Discovers the nodes. It queries all endpoints (services) with a label `label` set to `labelValue`. By default,
* it's `vertx-cluster=true`. When no endpoints were found, all endpoints in namespace without specific label are queried.
*
* @return the list of discovery nodes
*/
@Override
public Iterable<DiscoveryNode> discoverNodes() {
EndpointsList list = client.endpoints().inNamespace(namespace).withLabel(label, labelValue).list();
apiVersion: v1
kind: Service
metadata:
name: etcd-client
spec:
ports:
- name: etcd-client-port
port: 2379
protocol: TCP
targetPort: 2379
@amoAHCP
amoAHCP / DnsEndpointResolver.java
Created May 28, 2016 20:47
fallback port number for hazelcast
/*
* Copyright (c) 2015, Christoph Engelbert (aka noctarius) and
* contributors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@amoAHCP
amoAHCP / ServiceEndpointResolver.java
Created May 28, 2016 20:43
endpoint resolver with endpoint discovery in kubernetes namespace
/*
* Copyright (c) 2015, Christoph Engelbert (aka noctarius) and
* contributors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@amoAHCP
amoAHCP / CustomEndpointConfig.java
Created May 2, 2016 19:30
anauthorized acces when call http://localhost:8080/callback?redirect_uri=/private/somepage/test
OAuth2Auth authProvider = OAuth2Auth.create(vertx, OAuth2FlowType.AUTH_CODE, new JsonObject()
.put("clientID", "xxxx")
.put("clientSecret", "xxxx")
.put("site", "https://github.com/login")
.put("tokenPath", "/oauth/access_token")
.put("authorizationPath", "/oauth/authorize"));
// create a oauth2 handler on our domain: "http://localhost:8080"
OAuth2AuthHandler oauth2 = OAuth2AuthHandler.create(authProvider, "http://localhost:8080");