Skip to content

Commit a610b95

Browse files
authored
Lab 8022 - EventMesh - TEQ / KAFKA : Repo Migration (#306)
* On branch pasimoes/lab-8022/repo-migration Changes to be committed: migrating all project from oracle-db-examples repo to dcms repo. Target: /microservices-datadriven/workshops/eventmesh-teq-kafka * add workshop spefic reqs in root .gitignore and remove prj .gitignore
1 parent db75814 commit a610b95

File tree

390 files changed

+49842
-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.

390 files changed

+49842
-0
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,3 +481,23 @@ $RECYCLE.BIN/
481481
#!.vscode/tasks.json
482482
#!.vscode/launch.json
483483
#!.vscode/extensions.json
484+
485+
##
486+
## Gradle
487+
##
488+
.gradle/
489+
.gradle/*
490+
491+
## Workshops / Event Mesh - TEQ - Kafka
492+
##
493+
## Local JVM
494+
##
495+
workshops/eventmesh-teq-kafka/.java-version
496+
497+
## Remove Deploy Dir -- K8s Deployment artifacts
498+
workshops/eventmesh-teq-kafka/**/deploy/
499+
500+
## Remove Other Local project stuffs
501+
workshops/eventmesh-teq-kafka/cloud-setup/database/
502+
workshops/eventmesh-teq-kafka/cloud-setup/terraform_dbsystem/
503+
workshops/eventmesh-teq-kafka/wallet/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2021 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
version: '3'
3+
services:
4+
zookeeper:
5+
image: confluentinc/cp-zookeeper:7.0.1
6+
container_name: zookeeper
7+
environment:
8+
ZOOKEEPER_CLIENT_PORT: 2181
9+
ZOOKEEPER_TICK_TIME: 2000
10+
11+
broker:
12+
image: confluentinc/cp-kafka:7.0.1
13+
container_name: broker
14+
ports:
15+
# To learn about configuring Kafka for access across networks see
16+
# https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc/
17+
- "9092:9092"
18+
depends_on:
19+
- zookeeper
20+
environment:
21+
KAFKA_BROKER_ID: 1
22+
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
23+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_INTERNAL:PLAINTEXT
24+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092,PLAINTEXT_INTERNAL://broker:29092
25+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
26+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
27+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
28+
29+
## Update from 6.2.0 to 7.0.1
30+
## December 2021 Log4j Vulnerabilities Advisory
31+
## https://support.confluent.io/hc/en-us/articles/4412615410580-December-2021-Log4j-Vulnerabilities-Advisory
32+
## Security Release Notes for CP 7.0.1
33+
## https://support.confluent.io/hc/en-us/articles/4412607023124-Security-Release-Notes-for-CP-7-0-1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Make sure this is run via source or .
6+
if ! (return 0 2>/dev/null); then
7+
echo "ERROR: Usage 'source destroy.sh'"
8+
exit
9+
fi
10+
11+
"$LAB_HOME"/cloud-setup/utils/main-destroy.sh
12+
13+
cd
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Make sure this is run via source or .
6+
if ! (return 0 2>/dev/null); then
7+
echo "ERROR: Usage 'source env.sh'"
8+
exit
9+
fi
10+
11+
# POSIX compliant find and replace
12+
function sed_i(){
13+
local OP="$1"
14+
local FILE="$2"
15+
sed -e "$OP" "$FILE" >"/tmp/$FILE"
16+
mv -- "/tmp/$FILE" "$FILE"
17+
}
18+
export -f sed_i
19+
20+
# Set LAB_HOME
21+
str="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
22+
substr="cloud-setup"
23+
prefix=${str%%$substr*}
24+
index=${#prefix}
25+
export LAB_HOME=${str:0:$index-1}
26+
27+
# export LAB_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
28+
# shellcheck disable=SC2164
29+
cd "$LAB_HOME"
30+
echo "LAB_HOME: $LAB_HOME"
31+
32+
# Java Home
33+
if test -d ~/graalvm-ce-java11-21.3.0/Contents/Home/bin; then
34+
# We are on Mac doing local dev
35+
export JAVA_HOME=~/graalvm-ce-java11-21.3.0/Contents/Home;
36+
else
37+
# Assume linux
38+
export JAVA_HOME=~/graalvm-ce-java11-21.3.0
39+
fi
40+
export PATH=$JAVA_HOME/bin:$PATH
41+
42+
# State directory
43+
if test -d ~/lab-state; then
44+
export LAB_STATE_HOME=~/lab-state
45+
else
46+
export LAB_STATE_HOME="${LAB_HOME}"/cloud-setup/state
47+
fi
48+
49+
# Log directory
50+
export LAB_LOG="${LAB_HOME}"/cloud-setup/log
51+
mkdir -p "${LAB_LOG}"
52+
53+
# Source the state functions
54+
source "${LAB_HOME}"/cloud-setup/utils/state-functions.sh
55+
56+
export PATH=$PATH:${LAB_HOME}/cloud-setup/utils/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Make sure this is run via source or .
6+
if ! (return 0 2>/dev/null); then
7+
echo "ERROR: Usage 'source setup.sh'"
8+
exit
9+
fi
10+
11+
if state_done SETUP; then
12+
echo "The setup has been completed"
13+
return
14+
fi
15+
16+
SETUP_SCRIPT="$LAB_HOME/cloud-setup/utils/main-setup.sh"
17+
if ps -ef | grep "$SETUP_SCRIPT" | grep -v grep; then
18+
echo "The $SETUP_SCRIPT is already running. If you want to restart it then kill it and then rerun."
19+
else
20+
$SETUP_SCRIPT 2>&1 | tee -ai "$LAB_LOG"/main-setup.log
21+
fi
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
data "oci_identity_availability_domain" "ad1" {
5+
compartment_id = var.tenancy_ocid
6+
ad_number = 1
7+
}
8+
9+
data "oci_database_autonomous_databases" "autonomous_databases_atp" {
10+
#Required
11+
compartment_id = var.compartment_ocid
12+
13+
#Optional
14+
display_name = var.autonomous_database_display_name
15+
db_workload = var.autonomous_database_db_workload
16+
}
17+
18+
//======= Name space details ------------------------------------------------------
19+
data "oci_objectstorage_namespace" "lab8022_objstore_namespace" {
20+
#Optional
21+
compartment_id = var.compartment_ocid
22+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
//========= Outputs ===========================
5+
output "ns_objectstorage_namespace" {
6+
value = [ data.oci_objectstorage_namespace.lab8022_objstore_namespace.namespace ]
7+
}
8+
9+
output "autonomous_database_admin_password" {
10+
value = [ "Welcome12345" ]
11+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//================= create ATP Instance =======================================
2+
resource "random_string" "autonomous_database_wallet_password" {
3+
length = 16
4+
special = true
5+
}
6+
resource "random_password" "database_admin_password" {
7+
length = 12
8+
upper = true
9+
lower = true
10+
number = true
11+
special = false
12+
min_lower = "1"
13+
min_upper = "1"
14+
min_numeric = "1"
15+
}
16+
resource "oci_database_autonomous_database" "autonomous_database_atp" {
17+
#Required
18+
compartment_id = var.compartment_ocid
19+
db_name = var.autonomous_database_db_name
20+
21+
#Optional
22+
admin_password = random_password.database_admin_password.result
23+
cpu_core_count = var.autonomous_database_cpu_core_count
24+
data_storage_size_in_tbs = var.autonomous_database_data_storage_size_in_tbs
25+
# is_free_tier = true , if there exists sufficient service limit
26+
is_free_tier = var.autonomous_database_is_free_tier
27+
db_workload = var.autonomous_database_db_workload
28+
db_version = var.autonomous_database_db_version
29+
license_model = var.autonomous_database_license_model
30+
display_name = var.autonomous_database_display_name
31+
is_auto_scaling_enabled = "false"
32+
is_preview_version_with_service_terms_accepted = "false"
33+
}
34+
35+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" { }
5+
variable "user_ocid" { }
6+
variable "region" { }
7+
variable "compartment_ocid" { }
8+
9+
variable "autonomous_database_db_workload" {
10+
default = "OLTP"
11+
}
12+
13+
variable "autonomous_database_defined_tags_value" {
14+
default = "value"
15+
}
16+
17+
variable "autonomous_database_license_model" {
18+
default = "BRING_YOUR_OWN_LICENSE"
19+
}
20+
21+
variable "autonomous_database_is_dedicated" {
22+
default = false
23+
}
24+
25+
variable "autonomous_database_cpu_core_count" {
26+
default = "2"
27+
}
28+
29+
variable "autonomous_database_db_name" {
30+
default = "atp_db1"
31+
}
32+
33+
variable "autonomous_database_db_version" {
34+
description = "Oracle Autonomous Database Version"
35+
type = string
36+
default = "19c"
37+
validation {
38+
condition = contains(["19c", "21c"], var.autonomous_database_db_version)
39+
error_message = "Valid values for var: autonomous_database_db_version are (19c, 21c)."
40+
}
41+
}
42+
43+
variable "autonomous_database_display_name" {
44+
default = "MyATPDB"
45+
}
46+
47+
variable "autonomous_database_data_storage_size_in_tbs" {
48+
default = "1"
49+
}
50+
51+
variable "autonomous_database_is_free_tier" {
52+
default = false
53+
}

0 commit comments

Comments
 (0)