-
Notifications
You must be signed in to change notification settings - Fork 2
code structure and build Instructions
Anuj Bhandar edited this page Mar 10, 2017
·
1 revision
###Here is the Code Structure we used:
- spring17-devops
- infrastructure -> all the Infrastructure-as-code will go here
- EntityFolder -> example: identity server, jenkins, api-server, portal etc.
- Ias Vendor -> Terraform, ansible, chef etc.
- cloud-vendor -> AWS, OpenStack etc.
- code -> actual source code.
- cloud-vendor -> AWS, OpenStack etc.
- Ias Vendor -> Terraform, ansible, chef etc.
- EntityFolder -> example: identity server, jenkins, api-server, portal etc.
- infrastructure -> all the Infrastructure-as-code will go here
An example path will be: (spring17-devops/infrastructure/identity-server/terraform/OpenStack-infra/) This path will contain, identity-server code, built using terraform and deployed on OpenStack.
Network: A Common network infrastructure is set up on OpenStack which will contain all the instances used as a part of Airavata courses development. The Network contains the following Components:
- OpenStack network: airavata-courses-server-network
- Subnet description: airavata-courses-server-subnet
- Router: airavata-courses-network-router
- Interface: Connecting both the router and subnet. This network is exposed to the public internet.
Rest of the infrastructure: These will contain just the code to provision instance and related entities like security groups, keypairs etc. which should be hooked the above-mentioned network parameters, for example:
resource "openstack_compute_floatingip_v2" "terraform" {
pool = "${var.pool}"
}
resource "openstack_compute_instance_v2" "terraform" {
name = "jenkins-server-compute-instance"
image_id = "${var.image}"
flavor_name = "${var.flavor}"
key_pair = "${openstack_compute_keypair_v2.terraform.name}"
security_groups = ["${openstack_compute_secgroup_v2.terraform.name}"]
floating_ip = "${openstack_compute_floatingip_v2.terraform.address}"
user_data = "${file("userdata.sh")}"
network {
name = "airavata-courses-server-network"
}
}
##Code build instructions:
###Requirements:
- JDK 1.8, maven 3.3.*, Thrift 0.93 for code development and building
- Terraform 0.8.6 for building infrastructure
###Lets get started:
- Checkout the source code
git clone https://github.com/airavata-courses/spring17-devops
- Install Terraform, instructions here
- Configure your AWS credentials in your system, instructions here, we will need this to configure remote state, which is accessible to members of Airavata only. Also will be needed if the infrastructure is to provisioned on AWS.
- Terraform automatically fetches the AWS credentials, if they are stored in default path ($HOME/.aws/credentials), or else refer this document to set up manually.
- To Setup remote state config for Terraform, navigate to any leaf folder, and source the file remote-state-config, but before this the openstack CLI should be setup.
- Navigate to any leaf folder, type command
terraform plan
, if everything is setup correctly, the output should show the entities which will be created on AWS account. - Finally if you type
terraform apply
, all those changes will be pushed to AWS.