DMCDeploy

 

Our goal is to implement infrastructure as code. Terraform.io was chosen to aid in this process because it is provider agnostic, open source and with good community support and documentation. Full instructions for how to use it can be found at https://terraform.io/.

 

Steps to create a Deployment:

 

  1. Install Terraform
    1. https://terraform.io/downloads.html – follow the instructions for your system https://terraform.io/intro/getting-started/install.html
    2. make sure the path variables are properly set
      1. debian based systems 
        1. $ echo "export PATH=$PATH:/path/to/terraform" >> ~/.bashrc
        2. source ~/.bashrc
    3. verify install with: $ terraform -v
  2. Clone the DMCDeploy repo you want
    1. production – $ git clone https://bitbucket.org/DigitalMfgCommons/dmcdeploy.git
    2. development – git clone https://bitbucket.org/DigitalMfgCommons/dmcdeploy_dev.git
  3. Ensure that you have aws keys created for the appropriate region where you want to deploy to and that you have downloaded the appropriate  .pem files
  4. Configure the variables found in terraform.tfvars

access_key = "your aws key"

secret_key = "your aws secret key"

key_name = "alexTERRA2"  << make sure no .pem and make sure the key is configured for the appropriate aws region

key_full_path = "~/Desktop/aws/tf/test/DMCFrontEnd/alexTERRA2.pem"  << full path to your pem file including the file

stackPrefix = "alex2" << this prefix will be added to all infrastructure elements created so that your stack can be identified form others

activeMqRootPass = "admin" << the admin root pass for activemq

activeMqUserPass = "user"  << the user pass for activemq

stackPrefix = "alexGG" << prefix for the stack to be deployed so multiple stacks can coexist

release = "hot" << will determine which release to pull from 'hot'=master/newest code [for dev always use hot] 'alpha'=alpha release when available

aws_region = "us-west-2" << will deploy in Oregon region 'us-east-1' will deploy in Virginia

 

  1. Create a terraform plan named "a"
    1.  $ terraform plan -out a
    2. This does not create infrastructure but allows one to visualize and verify the infrastructure that will be created
  2. Deploy the infrastructure created by plan "a"
    1. $ terraform apply a
  3. To bring down the infrastructure you deployed
    1. $ terraform destroy