diff --git a/terraform/ecs/provision/follower.tf b/terraform/ecs/provision/follower.tf index 02b4c41..d2474df 100644 --- a/terraform/ecs/provision/follower.tf +++ b/terraform/ecs/provision/follower.tf @@ -25,9 +25,13 @@ resource "aws_ecs_task_definition" "solr-follower-no-efs" { command = ["/bin/bash", "-c", join(" ", [ "df -h;", "cd /tmp; /usr/bin/wget -O solr_setup.sh ${var.setupFollowerLink}; /bin/bash solr_setup.sh;", + "mv /tmp/ckan_config/solrconfig_follower.xml /tmp/ckan_config/solrconfig.xml;", + "sed -i 's/SOLR_REPLICATION_LEADER_URL/https:\\/\\/${local.leader_domain}:443\\/solr\\/ckan\\/replication/g' /tmp/ckan_config/solrconfig.xml;", + "sed -i 's/SOLR_REPLICATION_LEADER_USER/${random_uuid.username.result}/g' /tmp/ckan_config/solrconfig.xml;", + "sed -i 's/SOLR_REPLICATION_LEADER_PASSWORD/${random_password.password.result}/g' /tmp/ckan_config/solrconfig.xml;", "chown -R 8983:8983 /var/solr/data;", "cd -; su -c \"", - "init-var-solr; precreate-core ckan /tmp/ckan_config; chown -R 8983:8983 /var/solr/data; solr-fg -m ${local.solrFollowerMemInG}g\" -m solr" + "init-var-solr; precreate-core ckan /tmp/ckan_config; chown -R 8983:8983 /var/solr/data; solr-fg -m ${local.solrFollowerMemInG}g -Dsolr.disable.shardsWhitelist=true\" -m solr" ])] portMappings = [ @@ -66,9 +70,13 @@ resource "aws_ecs_task_definition" "solr-follower" { essential = true command = ["/bin/bash", "-c", join(" ", [ "cd /tmp; /usr/bin/wget -O solr_setup.sh ${var.setupFollowerLink}; /bin/bash solr_setup.sh;", + "mv /tmp/ckan_config/solrconfig_follower.xml /tmp/ckan_config/solrconfig.xml;", + "sed -i 's/SOLR_REPLICATION_LEADER_URL/https:\\/\\/${local.leader_domain}:443\\/solr\\/ckan\\/replication/g' /tmp/ckan_config/solrconfig.xml;", + "sed -i 's/SOLR_REPLICATION_LEADER_USER/${random_uuid.username.result}/g' /tmp/ckan_config/solrconfig.xml;", + "sed -i 's/SOLR_REPLICATION_LEADER_PASSWORD/${random_password.password.result}/g' /tmp/ckan_config/solrconfig.xml;", "chown -R 8983:8983 /var/solr/data;", "cd -; su -c \"", - "init-var-solr; precreate-core ckan /tmp/ckan_config; chown -R 8983:8983 /var/solr/data; solr-fg -m ${local.solrMemInG}g\" -m solr" + "init-var-solr; precreate-core ckan /tmp/ckan_config; chown -R 8983:8983 /var/solr/data; solr-fg -m ${local.solrFollowerMemInG}g -Dsolr.disable.shardsWhitelist=true\" -m solr" ])] portMappings = [ diff --git a/terraform/ecs/provision/leader.tf b/terraform/ecs/provision/leader.tf index e005847..0e52c4d 100644 --- a/terraform/ecs/provision/leader.tf +++ b/terraform/ecs/provision/leader.tf @@ -56,6 +56,7 @@ resource "aws_ecs_task_definition" "solr" { essential = true command = ["/bin/bash", "-c", join(" ", [ "cd /tmp; /usr/bin/wget -O solr_setup.sh ${var.setupLink}; /bin/bash solr_setup.sh;", + "rm -rf /tmp/ckan_config/solrconfig_follower.xml;", "chown -R 8983:8983 /var/solr/data;", "cd -; su -c \"", "init-var-solr; precreate-core ckan /tmp/ckan_config; chown -R 8983:8983 /var/solr/data; solr-fg -m ${local.solrMemInG}g\" -m solr" @@ -116,6 +117,7 @@ resource "aws_ecs_task_definition" "solr-no-efs" { command = ["/bin/bash", "-c", join(" ", [ "df -h;", "cd /tmp; /usr/bin/wget -O solr_setup.sh ${var.setupLink}; /bin/bash solr_setup.sh;", + "rm -rf /tmp/ckan_config/solrconfig_follower.xml;", "chown -R 8983:8983 /var/solr/data;", "cd -; su -c \"", "init-var-solr; precreate-core ckan /tmp/ckan_config; chown -R 8983:8983 /var/solr/data; solr-fg -m ${local.solrMemInG}g\" -m solr" diff --git a/terraform/ecs/provision/variables.tf b/terraform/ecs/provision/variables.tf index 3cb31e0..a5e5bdb 100644 --- a/terraform/ecs/provision/variables.tf +++ b/terraform/ecs/provision/variables.tf @@ -85,7 +85,7 @@ variable "solrFollowerDiskSize" { variable "setupFollowerLink" { type = string description = "The Solr setup file for Followers to initialize cores/authentication/et cetera..." - default = "https://raw.githubusercontent.com/GSA/catalog.data.gov/main/solr/solr_follower_setup.sh" + default = "https://raw.githubusercontent.com/GSA/catalog.data.gov/main/solr/solr_setup.sh" } ########################