Skip to content

juxt/pack-datomic

Repository files navigation

Pack-Datomic

pack-datomic provides a Packer template - datomic.json - to build an Amazon EC2 AMI with the Datomic Transactor pre-baked. When running Packer you supply your my.datomic.com credentials and a Datomic version, and then a Packer provisioner will fetch the Datomic JAR file and bake it in to the machine image ready for execution. A motivation of this module is to provide means for Datomic administrators to customise their own AMI image, for example to exert bespoke control over logging and to install monitoring agents onto the machine.

pack-datomic also provides a sample Terraform configuration that takes the AMI built by Packer as an input variable and builds the transactor into the cloud, along with the necessary constructs such as security groups and IAM roles etc. Care has been taken so that multiple Datomic transactor environments can be provisioned and segregated, so that you can easily rebuild your different environments such as development, UAT and production, without conflict or dependencies.

Build the Packer AMI.

datomic.json is the Packer template file for building a Datomic Transactor AMI.

Replace the ? symbols below and run.

packer build -var 'datomic_version=?' -var 'datomic_user=?' -var 'datomic_password=? datomic.json

Terraform

See the sample.tf for a straightforward Terraform configuration to provision the Datomic Transactor. Terraform also has a getting started guide.

One option is to clone this repository into a working subdirectory of your project to start using it. You could also refer to the transactor module directly from Git:

module "datomic" {
  source = "github.com/juxt/pack-datomic//modules/transactor?ref=0.2.2"
  # Declare variable inputs
  # ...
}

To use this module you need to provide the relevant variables that are declared at the top of sample.tf, you can do so either from the command line or from a tf.vars file. Assuming you went ahead and supplied the variables in a dev.tfvars file, then the Terraform commands to plan and to subsequently execute provisioning would be:

Get the module ready:

terraform get

Make the Terraform plan

terraform plan -var-file=dev.tfvars -out proposed.plan

Execute the plan:

terraform apply proposed.plan

Requirements

Packer and Terraform 0.8.

Acknowledgements

Before making this library we originally used Robert Stutterford’s existing Terraform example. Please have a look at this repository as it contains extra goodies such as provisioning for Memcached and Datadog.