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

Solr on ECS - Solr Replication Setup #48

Merged
merged 3 commits into from
Jul 20, 2022
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
12 changes: 10 additions & 2 deletions terraform/ecs/provision/follower.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions terraform/ecs/provision/leader.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion terraform/ecs/provision/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

########################
Expand Down