Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created April 13, 2018 21:24
Show Gist options
  • Save jcoyne/dfa437a8f4993aef168a36d2f625aba8 to your computer and use it in GitHub Desktop.
Save jcoyne/dfa437a8f4993aef168a36d2f625aba8 to your computer and use it in GitHub Desktop.
Taco Script 4
{
"$comment": "This is a fixture used for testing. It was derived from create-bs646cd8717.json",
"@context": "http://sdr.sul.stanford.edu/contexts/taco-base.jsonld",
"@type": "http://sdr.sul.stanford.edu/models/sdr3-collection.jsonld",
"citation": "Leon Kolb Collection of Portraits. https://purl.stanford.edu/bs646cd8717",
"depositor": {
"name": "DOR",
"sunetID": "DOR"
},
"label": "Leon Kolb Collection of Portraits",
"access": {
"access": "world",
"copyright": "This work is copyrighted by the creator.",
"download": "world",
"reuseAndReproductionStatement": "Property rights reside with the repository. Literary rights reside with the creators of the documents or their heirs. To obtain permission to publish or reproduce, please contact the Special Collections Public Services Librarian at speccollref@stanford.edu."
},
"administrative": {
"deleted": false,
"sdrPreserve": true,
"remediatedBy": [
{
"name": "Laura Wilsey",
"sunetID": "lauraw15"
}
]
},
"identification": {
"catkey": "4084372",
"sourceId": "bib4084372"
},
"structural": {
"hasAgreement": "druid:dd327qr3670",
"hasMember": [],
"isTargetOf": "",
"hasMemberOrders": []
}
}
# Healthcheck
curl http://taco-demo.sul.stanford.edu/v1/healthcheck
# Create
curl -H "Content-Type: application/json" \
-H "On-Behalf-Of: lmcrae@stanford.edu" \
-d@examples/request1.json \
http://taco-demo.sul.stanford.edu/v1/resource
# Retrieve
curl -H "Content-Type: application/json" \
-H "On-Behalf-Of: lmcrae@stanford.edu" \
http://taco-demo.sul.stanford.edu/v1/resource/n
# Update
curl -X PATCH -H "Content-Type: application/json" \
-H "On-Behalf-Of: lmcrae@stanford.edu" \
-d@examples/request2.json \
http://taco-demo.sul.stanford.edu/v1/resource/n
@eefahy
Copy link

eefahy commented Apr 13, 2018

variable "environment"      { default = "demo" }
variable "hosted_zone_id"   { default = "XXXXXXXXXXX" }
variable "hosted_zone_name" { default = "sul.stanford.edu" }

module "ecs" {
  source = "../../../modules/aws/ecs"
  environment = "${var.environment}"
}

module "infra_cluster" {
  source = "../../../modules/aws/ecs/cluster"

  cluster_name   = "infrastucture"
  environment    = "${var.environment}"
  vpc_id         = "${module.vpc.vpc_id}"
  public_subnets = "${module.vpc.public_subnets}"
}

module "taco_service" {
  source = "../../../modules/aws/ecs/service"

  service_name         = "taco"
  environment          = "${var.environment}"
  port                 = 8080
  health_check_url     = "/v1/healthcheck"
  cpu                  = "256"
  memory               = "512"
  min_capacity         = 2
  max_capacity         = 4
  container_definition = "${file("task_definitions/taco.json")}"

  cluster_id                    = "${module.infra_cluster.id}"
  cluster_name                  = "${module.infra_cluster.name}"
  cluster_alb_dns_name          = "${module.infra_cluster.alb_dns_name}"
  cluster_alb_zone_id           = "${module.infra_cluster.alb_zone_id}"
  cluster_alb_listener_arn      = "${module.infra_cluster.alb_listener_arn}"
  cluster_alb_security_group_id = "${module.infra_cluster.alb_security_group_id}"

  vpc_id             = "${module.vpc.vpc_id}"
  private_subnets    = "${module.vpc.private_subnets}"
  execution_role_arn = "${module.ecs.execution_role_arn}"
  hosted_zone_id     = "${var.hosted_zone_id}"
  hosted_zone_name   = "${var.hosted_zone_name}"
}

module "id_service" {
  source = "../../../modules/aws/ecs/service"

  service_name         = "identifier"
  environment          = "${var.environment}"
  port                 = 8081
  health_check_url     = "/v1/identifiers"
  cpu                  = "256"
  memory               = "512"
  min_capacity         = 2
  max_capacity         = 4
  container_definition = "${file("task_definitions/identifier-service.json")}"

  cluster_id                    = "${module.infra_cluster.id}"
  cluster_name                  = "${module.infra_cluster.name}"
  cluster_alb_dns_name          = "${module.infra_cluster.alb_dns_name}"
  cluster_alb_zone_id           = "${module.infra_cluster.alb_zone_id}"
  cluster_alb_listener_arn      = "${module.infra_cluster.alb_listener_arn}"
  cluster_alb_security_group_id = "${module.infra_cluster.alb_security_group_id}"

  vpc_id             = "${module.vpc.vpc_id}"
  private_subnets    = "${module.vpc.private_subnets}"
  execution_role_arn = "${module.ecs.execution_role_arn}"
  hosted_zone_id     = "${var.hosted_zone_id}"
  hosted_zone_name   = "${var.hosted_zone_name}"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment