diff --git a/src/clj/auto_ap/datomic.clj b/src/clj/auto_ap/datomic.clj index e70bc375..091ba145 100644 --- a/src/clj/auto_ap/datomic.clj +++ b/src/clj/auto_ap/datomic.clj @@ -630,7 +630,7 @@ (conj {:sort-key "default" :asc (if (contains? args :default-asc?) (:default-asc? args) true)}) - (conj {:sort-key "e" :asc true})) + (conj {:sort-key "e" :asc false})) length (count sort-bys) comparator (fn [xs ys] (reduce diff --git a/src/clj/auto_ap/datomic/ledger.clj b/src/clj/auto_ap/datomic/ledger.clj index 7fa71558..df8e4e1b 100644 --- a/src/clj/auto_ap/datomic/ledger.clj +++ b/src/clj/auto_ap/datomic/ledger.clj @@ -3,7 +3,7 @@ [auto-ap.datomic :refer [add-sorter-fields apply-pagination - apply-sort-3 + apply-sort-4 conn merge-query observable-query @@ -117,7 +117,7 @@ true (merge-query {:query {:find ['?sort-default '?e]}})))] (->> (observable-query query) - (apply-sort-3 (update args :sort conj {:sort-key "default-2" :asc true})) + (apply-sort-4 (update args :sort conj {:sort-key "default-2" :asc true})) (apply-pagination args)))) (defn graphql-results [ids db _] diff --git a/terraform/solr_ec2.tf b/terraform/solr_ec2.tf new file mode 100644 index 00000000..d458b58b --- /dev/null +++ b/terraform/solr_ec2.tf @@ -0,0 +1,91 @@ +resource "aws_instance" "solr_ec2" { + ami = data.aws_ami.amazon_linux_2023.id + instance_type = "m7g.large" + key_name = "http-proxy" + + vpc_security_group_ids = [ "sg-004e5855310c453a3", "sg-02d167406b1082698", "sg-08cd873bd29a2b3c9"] + subnet_id = "subnet-89bab8d4" + + root_block_device { + volume_size = 30 # The size of the EBS volume in GB. + } + + tags = { + Name = "solr_ec2_${var.stage}" + } +} + +data "aws_ami" "amazon_linux_2023" { + most_recent = true + + filter { + name = "name" + values = ["al2023-ami-*"] + } + + filter { + name = "virtualization-type" + values = ["hvm"] + } +filter { + name="architecture" + values=["arm64"] +} +} + +resource "aws_ebs_volume" "solr_ec2_storage" { + availability_zone = aws_instance.solr_ec2.availability_zone + size = 30 # Size of the EBS volume in GB. + + tags = { + Name = "solr_storage_${var.stage}" + } +} + +resource "aws_volume_attachment" "attach_solr_storage" { + device_name = "/dev/xvdf" # Choose a suitable device name based on your needs. + instance_id = aws_instance.solr_ec2.id + volume_id = aws_ebs_volume.solr_ec2_storage.id + + #wait_for detachment_timeout = "30m" +} + +# You may need to add additional resources such as IAM roles, security groups configuration, etc., +# depending on what services or actions your Solr needs access to. + +output "ec2_public_ip" { + value = aws_instance.solr_ec2.public_ip +} + + +resource "aws_service_discovery_service" "solr_ec2" { + name = "solr-ec2-${var.stage}" + + dns_config { + namespace_id = var.local_namespace + dns_records { + ttl = 60 + type = "A" + } + + routing_policy = "MULTIVALUE" + } + + health_check_custom_config { + failure_threshold = 1 + } +} + +resource "aws_service_discovery_instance" "solr_instance" { + service_id = aws_service_discovery_service.solr_ec2.id + instance_id = "solr-ec2" + + attributes = { + "AWS_INSTANCE_IPV4" = aws_instance.solr_ec2.private_ip + } + + depends_on = [ + aws_service_discovery_service.solr_ec2, + aws_instance.solr_ec2, + ] +}