Skip to content

Commit 7c43519

Browse files
author
steinko
committed
first commit
0 parents  commit 7c43519

File tree

98 files changed

+3242
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+3242
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.classpath

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
4+
<classpathentry kind="src" path="postgressService/src/main/java"/>
5+
<classpathentry kind="src" path="postgressService/src/test/java"/>
6+
<classpathentry kind="src" path="postgressService/src/main/resources"/>
7+
<classpathentry kind="lib" path="agent/elastic-apm-agent-1.24.0.jar"/>
8+
<classpathentry kind="lib" path="postgressService/gradle/wrapper/gradle-wrapper.jar"/>
9+
<classpathentry kind="output" path="bin"/>
10+
</classpath>

.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>ElasticAPMJavaAgent</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>

agent/.DS_Store

6 KB
Binary file not shown.

agent/.gitignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
HELP.md
2+
.gradle
3+
build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
!**/src/main/**/build/
6+
!**/src/test/**/build/
7+
8+
### STS ###
9+
.apt_generated
10+
.classpath
11+
.factorypath
12+
.project
13+
.settings
14+
.springBeans
15+
.sts4-cache
16+
bin/
17+
!**/src/main/**/bin/
18+
!**/src/test/**/bin/
19+
20+
### IntelliJ IDEA ###
21+
.idea
22+
*.iws
23+
*.iml
24+
*.ipr
25+
out/
26+
!**/src/main/**/out/
27+
!**/src/test/**/out/
28+
29+
### NetBeans ###
30+
/nbproject/private/
31+
/nbbuild/
32+
/dist/
33+
/nbdist/
34+
/.nb-gradle/
35+
36+
### VS Code ###
37+
.vscode/

agent/elastic-apm-agent-1.24.0.jar

8.53 MB
Binary file not shown.

bin/.DS_Store

6 KB
Binary file not shown.

bin/application.properties

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
spring.jpa.show-sql=true
2+
spring.jpa.generate-ddl=true
3+
spring.jpa.hibernate.ddl-auto=create
4+
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

bin/org/.DS_Store

6 KB
Binary file not shown.

bin/org/steinko/.DS_Store

6 KB
Binary file not shown.

bin/org/steinko/elastic/.DS_Store

6 KB
Binary file not shown.

bin/org/steinko/elastic/apm/.DS_Store

6 KB
Binary file not shown.
833 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1.31 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

deployment/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/bin/
2+
/node_modules/

deployment/PostgresDeployment.ts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import * as k8s from "@pulumi/kubernetes";
2+
import {clusterProvider } from './cluster'
3+
import {dbUserName, dbPassword } from './config'
4+
5+
export const postgresDeployment = new k8s.apps.v1.Deployment('postgres-deployment', {
6+
metadata:{name: "postgres-depoyment"},
7+
spec: {
8+
template: {
9+
metadata: {labels: { app: 'postgres'}},
10+
spec: {
11+
volumes:
12+
[{name: 'postgres-storage',
13+
persistentVolumeClaim:{
14+
claimName:'postgres-pv-claim'}
15+
}] ,
16+
containers: [{
17+
name: "postgres-container",
18+
image: 'docker.io/postgres',
19+
env: [ {name: 'POSTGRES_PASSWORD', value: dbPassword},
20+
{name: 'POSTGRES_USER', value: dbUserName},
21+
{name: 'PGDATA', value: '/var/lib/postgresql/data/pgdata'}
22+
] ,
23+
ports:[
24+
{containerPort: 5432,
25+
name: 'postgres' }
26+
],
27+
volumeMounts: [{
28+
name: 'postgres-storage',
29+
mountPath: '/var/lib/postgresql/data'
30+
}]
31+
}]
32+
}
33+
34+
},
35+
selector: { matchLabels: { app: 'postgres'}}
36+
}
37+
},{provider: clusterProvider})

deployment/PostgresService.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as k8s from "@pulumi/kubernetes";
2+
import {clusterProvider} from './cluster'
3+
export const postgresService = new k8s.core.v1.Service('postgres-service', {
4+
metadata: {name: 'postgres'},
5+
spec: { type: 'ClusterIP',
6+
ports: [ {port:5432}],
7+
selector: { app:'postgres'},
8+
externalName: 'postgres.steinko.org'
9+
}
10+
},
11+
{ provider: clusterProvider}
12+
)

deployment/PostgresVolumClaim.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as k8s from '@pulumi/kubernetes'
2+
import {clusterProvider} from './cluster'
3+
4+
export const claim = new k8s.core.v1.PersistentVolumeClaim("claim", {
5+
metadata: {
6+
name: "postgres-pv-claim",
7+
},
8+
spec: {
9+
accessModes: ["ReadWriteOnce"],
10+
resources: { requests: {storage: "5Gi"}}
11+
},
12+
},
13+
{ provider: clusterProvider})

deployment/Pulumi.dev.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
config:
2+
deployment:cloudLocation: europe-north1-a
3+
deployment:cloudProject: springboot22
4+
deployment:cloudRegion: europe-north1
5+
deployment:dbPassword: RoxyMusic11
6+
deployment:dbUserName: springuser

deployment/Pulumi.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: deployment
2+
runtime: nodejs
3+
description: Deployent of postgres

deployment/cluster.ts

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import * as k8s from "@pulumi/kubernetes"
2+
import * as pulumi from "@pulumi/pulumi"
3+
import * as gcp from "@pulumi/gcp"
4+
import * as config from "./config"
5+
6+
const name = "elastic-apm-cluster";
7+
// Create a GKE cluster
8+
9+
export const cluster = new gcp.container.Cluster(name, { name: name,
10+
project: config.cloudProject,
11+
clusterAutoscaling: {enabled: true, resourceLimits:[ {resourceType: 'cpu', minimum:1 ,maximum:20 },
12+
{resourceType: 'memory', minimum:1 ,maximum:64 }
13+
]
14+
},
15+
initialNodeCount: 1,
16+
nodeConfig: {
17+
machineType: "e2-standard-2",
18+
oauthScopes: [
19+
"https://www.googleapis.com/auth/compute",
20+
"https://www.googleapis.com/auth/devstorage.read_only",
21+
"https://www.googleapis.com/auth/logging.write",
22+
"https://www.googleapis.com/auth/monitoring",
23+
"https://www.googleapis.com/auth/servicecontrol",
24+
"https://www.googleapis.com/auth/trace.append",
25+
"https://www.googleapis.com/auth/ndev.clouddns.readwrite"
26+
],
27+
},
28+
location: config.cloudLocation,
29+
30+
});
31+
32+
33+
// Manufacture a GKE-style kubeconfig. Note that this is slightly "different"
34+
// because of the way GKE requires gcloud to be in the picture for cluster
35+
// authentication (rather than using the client cert/key directly).
36+
export const kubeconfig = pulumi.
37+
all([ cluster.name, cluster.endpoint, cluster.masterAuth ]).
38+
apply(([ name, endpoint, masterAuth ]) => {
39+
const context = `${config.cloudProject}_${config.cloudLocation}_${name}`;
40+
return `apiVersion: v1
41+
clusters:
42+
- cluster:
43+
certificate-authority-data: ${masterAuth.clusterCaCertificate}
44+
server: https://${endpoint}
45+
name: ${context}
46+
contexts:
47+
- context:
48+
cluster: ${context}
49+
user: ${context}
50+
name: ${context}
51+
current-context: ${context}
52+
kind: Config
53+
preferences: {}
54+
users:
55+
- name: ${context}
56+
user:
57+
auth-provider:
58+
config:
59+
cmd-args: config config-helper --format=json
60+
cmd-path: gcloud
61+
expiry-key: '{.credential.token_expiry}'
62+
token-key: '{.credential.access_token}'
63+
name: gcp
64+
`;
65+
});
66+
67+
// Create a Kubernetes provider instance that uses our cluster from above.
68+
export const clusterProvider = new k8s.Provider(name, {
69+
kubeconfig: kubeconfig,
70+
});

deployment/config.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Config } from "@pulumi/pulumi";
2+
3+
const config = new Config();
4+
5+
/// PostgreSQL config
6+
export const dbUserName = config.require("dbUserName");
7+
export const dbPassword = config.require("dbPassword");
8+
9+
// GCP Config
10+
export const cloudLocation = config.require("cloudLocation");
11+
export const cloudRegion = config.require("cloudRegion");
12+
export const cloudProject = config.require('cloudProject')

deployment/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {postgresDeployment} from './PostgresDeployment'
2+
import {postgresService} from './PostgresService'
3+
import {claim} from './PostgresVolumClaim'
4+
5+
claim
6+
postgresDeployment
7+
postgresService

0 commit comments

Comments
 (0)