Skip to content
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
1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The Redis Cloud Autoscaler is and application designed to run in your own enviro
| Name | Description
| REDIS_HOST_AND_PORT | The private endpoint of the Redis Cloud subscription database.
| REDIS_PASSWORD | The password for accessing the Redis Cloud database.
| REDIS_USE_SSL | Whether to use TLS when connecting to the Redis Cloud database (true/false).
| REDIS_CLOUD_API_KEY | The API key for interacting with Redis Cloud services.
| REDIS_CLOUD_ACCOUNT_KEY | The account key for authenticating with Redis Cloud.
| REDIS_CLOUD_SUBSCRIPTION_ID | The ID of the Redis Cloud subscription.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.jedis.JedisClientConfiguration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;

Expand All @@ -18,18 +19,22 @@ public JedisConnectionFactory jedisConnectionFactory() {
int redisPort = Integer.parseInt(redisHostAndPort.split(":")[1]);
String redisPassword = System.getenv("REDIS_PASSWORD");
String redisUser = System.getenv("REDIS_USER") != null ? System.getenv("REDIS_USER") : "default";
boolean useSsl = System.getenv("REDIS_USE_SSL") != null && System.getenv("REDIS_USE_SSL").equalsIgnoreCase("true");
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration(redisHost, redisPort);
LOG.info("connecting to redis at {}:{}", redisHost, redisPort);

if(redisPassword != null && !redisPassword.isEmpty()) {
config.setPassword(redisPassword);
}

if (redisUser != null && !redisUser.isEmpty()) {
config.setUsername(redisUser);
}

return new JedisConnectionFactory(config);
JedisClientConfiguration.JedisClientConfigurationBuilder jedisClientConfigurationBuilder = JedisClientConfiguration.builder();
if(useSsl) {
LOG.info("Using SSL to connect to Redis");
jedisClientConfigurationBuilder.useSsl();
}
return new JedisConnectionFactory(config, jedisClientConfigurationBuilder.build());
}

@Bean
Expand Down
6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ resource "google_compute_firewall" "autoscale_allow_egress" {


data "rediscloud_payment_method" "card"{
card_type = "Visa"
card_type = "Mastercard"
last_four_numbers = var.last_four_digits
}

Expand Down Expand Up @@ -135,6 +135,7 @@ resource "rediscloud_subscription_database" "autoscale-database" {
throughput_measurement_by = "operations-per-second"
throughput_measurement_value = 1000
memory_limit_in_gb = 0.5
enable_tls = true
modules = [
{
"name" : "RedisJSON"
Expand Down Expand Up @@ -183,7 +184,7 @@ resource "null_resource" "build_app" {
}

provisioner "file" {
source = "./autoscaler/redis-cloud-autoscaler/build/libs/redis-cloud-autoscaler-0.0.4.jar"
source = "./autoscaler/redis-cloud-autoscaler/build/libs/redis-cloud-autoscaler-0.0.5.jar"
destination = "autoscaler.jar"
}

Expand Down Expand Up @@ -213,6 +214,7 @@ resource "null_resource" "build_app" {
"echo 'Environment=REDIS_CLOUD_API_KEY=${var.redis_cloud_api_key}' | sudo tee -a /etc/systemd/system/autoscaler.service > /dev/null",
"echo 'Environment=REDIS_CLOUD_ACCOUNT_KEY=${var.redis_cloud_account_key}' | sudo tee -a /etc/systemd/system/autoscaler.service > /dev/null",
"echo 'Environment=REDIS_CLOUD_SUBSCRIPTION_ID=${rediscloud_subscription.autoscaling_sub.id}' | sudo tee -a /etc/systemd/system/autoscaler.service > /dev/null",
"echo 'Environment=REDIS_USE_SSL=true' | sudo tee -a /etc/systemd/system/autoscaler.service > /dev/null",
"echo 'Environment=ALERT_MANAGER_HOST=${google_compute_instance.autoscale-vm-prometheus.network_interface[0].access_config[0].nat_ip}' | sudo tee -a /etc/systemd/system/autoscaler.service > /dev/null",
"echo 'Environment=ALERT_MANAGER_PORT=9093' | sudo tee -a /etc/systemd/system/autoscaler.service > /dev/null",
"echo 'ExecStart=/usr/bin/java -jar /usr/local/bin/autoscaler.jar' | sudo tee -a /etc/systemd/system/autoscaler.service > /dev/null",
Expand Down
4 changes: 2 additions & 2 deletions quickstart/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ resource "google_compute_firewall" "autoscale_allow_egress" {


data "rediscloud_payment_method" "card"{
card_type = "Visa"
card_type = "Mastercard"
last_four_numbers = var.last_four_digits
}

Expand All @@ -108,7 +108,7 @@ resource "rediscloud_subscription" "autoscaling_sub" {

creation_plan {
memory_limit_in_gb = 5
quantity = 3
quantity = 1
replication = false
throughput_measurement_by = "operations-per-second"
throughput_measurement_value = 25000
Expand Down