Skip to content

sdole/tvarit-maven

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Tvarit This tool is being migrated to a different repository: https://github.com/sdole/fastup

Build Status ##About Tvarit is a dev ops automation maven plugin project for continuous delivery of JEE apps using Maven and AWS platforms.

##Goals

  1. Provide a completely automatic path to take code from every code commit to production and further on to retirement or rollback
  2. Support application integration and dependencies (with API contracts) in every environment
  3. Be automatically scalable, available and cost effective

Non-goals

  1. Supporting non-Jee deployments

##Current status This maven plugin can be used to deploy a standalone webapp (WAR) to an automatically scalable environment in AWS. Actual capabilities of the environment can be customized by customizing the underlying AWS CloudFormation templates.

##Usage Tvarit Maven Plugin is available in Maven Central. Followed below are instructions on how to use it within your Maven WAR project. Default cloudformation templates used in this maven plugin are in GitHub. All maven goals accept a template url parameter for using an alternate cloudformation template. Running any of these maven goals will likely incur costs on AWS.

###AWS Credentials Make access id and secret key available in environment as. This access id should be allowed all required IAM permissions to run the plugin.

  <profiles>
		<profile>
			<id>default</id>
			<properties>
				<myAccessKey>accessKey</myAccessKey>
				<mySecretKey>secretKey</mySecretKey>
			</properties>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
		</profile> 
	</profiles>

###Configure the Maven plugin. ####Step 1: Create all infrastructure needed in AWS Do this only once. This will create a cloudformation stack consisting of a VPC and other resources in your account. If you already have required setup or plan to create this manually, skip this step. Please see vpc infrastructure template for resources you will need. This execution configuration can optionally take a parameter named templateUrl pointing to an S3 hosted cloudformation template. If set, resources specified in that template will be created instead. To run this goal:

mvn -P makeinfra tvarit:make-infra@make-infra     <-- To use this syntax, you'll need at least ver 3.3.3 of Maven
  <profile>
            <id>makeinfra</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.tvarit</groupId>
                        <artifactId>tvarit-maven-plugin</artifactId>
                        <version>0.0.1-SNAPSHOT</version>
                        <executions>
                            <execution>
                                <id>make-infra</id>
                                <goals>
                                    <goal>make-infra</goal>
                                </goals>
                                <configuration>
                                    <projectName>mycoolproject</projectName>
                                    <domainName>mycooldomainname.io</domainName>
                                    <bucketName>mycoolproject-automation</bucketName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

####Create an autoscaling group in EC2 for app servers Do this only once. Go to your AWS console and obtain the IAM instance profile, IAM role and bucket ARN that were created in the step above. Use those here. Please see autoscaling template for resources needed in this step. This execution configuration can optionally take a parameter named templateUrl pointing to an S3 hosted cloudformation template. If set, resources specified in that template will be created instead. To run this goal:

mvn -P makeasg tvarit:setup-autoscaling@setup-as     <-- To use this syntax, you'll need at least ver 3.3.3 of Maven
   <profile>
              <id>makeasg</id>
              <build>
                  <plugins>
                      <plugin>
                          <groupId>io.tvarit</groupId>
                          <artifactId>tvarit-maven-plugin</artifactId>
                          <version>0.0.1-SNAPSHOT</version>
                          <executions>
                              <execution>
                                  <id>setup-as</id>
                                  <goals>
                                      <goal>setup-autoscaling</goal>
                                  </goals>
                                  <configuration>
                                      <projectName>mycoolproject</projectName>
                                      <tvaritInstanceProfile>IAM instance profile</tvaritInstanceProfile>
                                      <bucketName>Bucket Name</bucketName>
                                      <tvaritRoleArn>IAM role</tvaritRoleArn>
                                  </configuration>
                              </execution>
                          </executions>
                      </plugin>
                  </plugins>
              </build>
          </profile>

####Deploy app and launch servers into the auto scaling group - work in progress To run this goal:

mvn -P deploy-app deploy 
<profile>
            <id>deploy-app</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.tvarit</groupId>
                        <artifactId>tvarit-maven-plugin</artifactId>
                        <version>0.0.1-SNAPSHOT</version>
                        <executions>
                            <execution>
                                <id>deploy</id>
                                <goals>
                                    <goal>deploy-tomcat-ui-app</goal>
                                </goals>
                                <phase>deploy</phase>
                                <configuration>
                                    <bucketName>Bucket name</bucketName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

##Automaton Permissions The Automaton user is the user who runs the maven plugin. In a developer workstation, that will be the developer. On a continuous integration server, such as Teamcity or Jenkins, it may be a new IAM role created for automation purposes. This role will need a wide range of permissions including at least the following. For all specific permissions required, please see the cloudformation template that sets up all infrastructure.

  • S3 Buckets, Objects, create, read
  • Lambda, Functions, create
  • IAM, role, instance profile, policy, trusts, create.
  • EC2/Autoscaling, launch configurations, auto scaling groups, ELB, create, read
  • CloudFormation, S3, read
Additionally, the following trust relationships will be needed:
  • CloudFormation assume role

Basic schematic diagram

Default cloudformation template will create resources shown in this diagram. Basic schematic diagram

Tagging

###Instances Instances are tagged with a single tag of the following format. Key: tvarti::groupId::artifactId::version Value: empty

##License Tvarit is licensed under GPLv3