Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More flexible heap setting / custom crate.yml settings #133

Merged
merged 4 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ The main setup consists of the following steps:

# CrateDB-specific configuration
crate = {
# Java Heap size in GB available to CrateDB
heap_size_gb = 2
# Java Heap size available to CrateDB
heap_size = "2g"

cluster_name = "crate-cluster"

Expand Down
3 changes: 2 additions & 1 deletion aws/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ data "cloudinit_config" "config" {
crate_download_url = var.cratedb_tar_download_url
crate_user = local.config.crate_username
crate_pass = local.cratedb_password
crate_heap_size = var.crate.heap_size_gb
crate_heap_size = var.crate.heap_size
crate_cluster_name = var.crate.cluster_name
crate_cluster_size = var.crate.cluster_size
crate_nodes_ips = indent(12, yamlencode(aws_network_interface.interface[*].private_ip))
crate_ssl_enable = var.crate.ssl_enable
crate_protocol = var.crate.ssl_enable ? "https" : "http"
crate_ssl_certificate = base64encode(tls_self_signed_cert.ssl.cert_pem)
crate_ssl_private_key = base64encode(tls_private_key.ssl.private_key_pem)
cratedb_user_settings = indent(8, yamlencode(var.cratedb_settings))
}
)
}
Expand Down
4 changes: 3 additions & 1 deletion aws/scripts/cloud-init-cratedb-rpm.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ write_files:
ssl.keystore_filepath: /etc/crate/keystore.p12
ssl.keystore_password: changeit
ssl.keystore_key_password: changeit

${cratedb_user_settings}
owner: root:root
path: /etc/crate/crate.yml
permissions: "0755"
Expand All @@ -89,7 +91,7 @@ write_files:
# (e.g. 26g, stay below ~30G to benefit from CompressedOops)
# - disable swapping my setting bootstrap.mlockall in crate.yml
# Heap Size (defaults to 256m min, 1g max)
CRATE_HEAP_SIZE=${crate_heap_size}g
CRATE_HEAP_SIZE=${crate_heap_size}

# Additional Java options
CRATE_JAVA_OPTS="-javaagent:/usr/share/crate/crate-jmx-exporter-1.2.0.jar=8080"
Expand Down
8 changes: 5 additions & 3 deletions aws/scripts/cloud-init-cratedb-tar.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ write_files:
ssl.keystore_filepath: /opt/crate/config/keystore.p12
ssl.keystore_password: changeit
ssl.keystore_key_password: changeit

${cratedb_user_settings}
owner: root:root
path: /opt/crate/config/crate.yml
permissions: "0755"
Expand All @@ -85,10 +87,10 @@ write_files:
# (e.g. 26g, stay below ~30G to benefit from CompressedOops)
# - disable swapping my setting bootstrap.mlockall in crate.yml
# Heap Size (defaults to 256m min, 1g max)
CRATE_HEAP_SIZE=${crate_heap_size}g
CRATE_HEAP_SIZE=${crate_heap_size}

# Additional Java options
CRATE_JAVA_OPTS="-javaagent:/opt/crate/crate-jmx-exporter-1.1.0.jar=8080"
CRATE_JAVA_OPTS="-javaagent:/opt/crate/crate-jmx-exporter-1.2.0.jar=8080"
owner: root:root
path: /etc/default/crate
permissions: "0755"
Expand Down Expand Up @@ -166,7 +168,7 @@ runcmd:
- tar -xf crate-*.tar.gz
- mv -n crate-*/* /opt/crate
- mv crate-*/config/log4j2.properties /opt/crate/config
- curl --output-dir /opt/crate -O https://repo1.maven.org/maven2/io/crate/crate-jmx-exporter/1.1.0/crate-jmx-exporter-1.1.0.jar
- curl --output-dir /opt/crate -O https://repo1.maven.org/maven2/io/crate/crate-jmx-exporter/1.2.0/crate-jmx-exporter-1.2.0.jar
- chown -R crate:crate /opt/crate
- systemctl daemon-reload
- systemctl enable crate
Expand Down
10 changes: 8 additions & 2 deletions aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ variable "config" {

variable "crate" {
type = object({
heap_size_gb = number
heap_size = string
cluster_name = string
cluster_size = number
ssl_enable = bool
})

default = {
heap_size_gb = 2
heap_size = "2g"
cluster_name = "CrateDB-Cluster"
cluster_size = 3
ssl_enable = true
Expand All @@ -34,6 +34,12 @@ variable "crate" {
description = "CrateDB application configuration"
}

variable "cratedb_settings" {
type = map(string)
default = {}
description = "CrateDB settings applied to crate.yml"
}

variable "cratedb_password" {
type = string
default = null
Expand Down
Loading