-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f6aa3e1
Showing
12 changed files
with
422 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.classpath | ||
.project | ||
.settings | ||
target | ||
tmp-git-deployment-staging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.classpath | ||
.project | ||
.settings | ||
target | ||
tmp-git-deployment-staging | ||
syntax:glob | ||
*.log | ||
.idea | ||
syntax:glob | ||
"*.iml" | ||
.Vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Welcome to your beanstalk-maven-plugin archetype project! | ||
|
||
## About | ||
|
||
For up to date information, see http://docs.ingenieux.com.br/project/beanstalker/ | ||
|
||
This project was generated from the elasticbeanstalk-dropwizard-webapp-archetype. | ||
|
||
As it is, it is a boilerplate code for a generic, modern webapp using Amazon Web Services' Elastic Beanstalk Service with [Docker](http://docker.io) and [Dropwizard](http://dropwizard.github.io/) | ||
|
||
We hope you like it. If you run into any problems, please let us know by the [mailing list](http://groups.google.com/group/beanstalker-users) or the [issue tracker](http://github.com/ingenieux/beanstalker/issues) | ||
|
||
## Setting up your Maven Build | ||
|
||
TL;DR: Set AWS_ACCESS_KEY and AWS_SECRET_KEY from your environment. | ||
|
||
Create / Edit your settings.xml as suggested in the [Security Page](http://beanstalker.ingenieux.com.br/beanstalk-maven-plugin/security.html) | ||
|
||
This project, as is, supports modes 1-2 (settings.xml), and it looks by default for aws.amazon.com. | ||
|
||
*Don't worry, you're likely to do it once for each and every machine you plan to build. :)* | ||
|
||
## Configuring your Project | ||
|
||
We suggest convention over configuration, but anyway. The only setting you're likely to set is your ```cnamePrefix``` and ```environmentRef```` properties on your pom.xml file. | ||
|
||
Make sure you pick something unique and unlikely to conflict with other users. | ||
|
||
It is also interesting to review the parameters in the ```properties``` section. | ||
|
||
## Deploying | ||
|
||
Simply call ```mvn deploy -Pfast-deploy``` | ||
|
||
If your environment is Ready (Green or Red), it will deploy. If not, a new version will get published. | ||
|
||
*You can always launch a new environment...* | ||
|
||
## Launching an Environment | ||
|
||
If you did the previous step, it will create a new elastic beanstalk application for you in AWS Console. You can launch and environment right away with: | ||
|
||
```mvn beanstalk:create-environment``` | ||
|
||
Or you could use the console. From the console, click in "Launch New Environment". In this dialog, not all options are available, so initially set the ```Health Check URL``` to the /debug handler: | ||
|
||
```/services/api/v1/debug``` | ||
|
||
Don't launch it yet, though. We have some tips... | ||
|
||
## Deploy versus Fast-Deploy | ||
|
||
There are two variables involved when deploying into AWS Elastic Beanstalk: | ||
|
||
- Git versus S3 (we chose git in this project) | ||
- Downtime or Zero-Downtime | ||
|
||
Since we already made your life simpler by choosing git over S3, you have two profiles to pick according to your needs: | ||
|
||
- Production: mvn -Pdeploy deploy will do a zero-downtime deploy. No downtime, but uses more resources | ||
- Development: mvn -Pfast-deploy deploy will do a plain git deploy. It will incur downtime, but uses less resources | ||
|
||
## Environment / Configuration Tips: | ||
|
||
- We suggest you save your environment into a configuration template once you're happy. We suggest ```envname-yyyymmdd-nn```, where NN is a number which gets incremented. | ||
|
||
Hint: Use ```mvn beanstalk:tag-environment``` to do this. If you want to launch a new environment based on this template, simply use ```mvn beanstalk:create-environment -Dbeanstalk.templateName=envname-yyyymmdd-nn``` | ||
|
||
## Setting the Proper Health Check URL | ||
|
||
Besides that, make sure you can map to an SSH Key you already have, so you are able to log into your EC2 Instance and troubleshoot any problems (unlikely, but better safe than sorry). | ||
|
||
Ok, now you can launch. | ||
|
||
Once the application is launched (and there's a Green Icon), click in "Edit Configuration" and set your applications AWS Access Key / Shared Key, then you can set set the proper Health Check URL: | ||
|
||
```/health/check``` | ||
|
||
## SCM Notes | ||
|
||
### Git Fast-Deploy | ||
|
||
Please never commit the contents of your ```tmp-git-staging``` directory. | ||
|
||
Its there to cache locally and enable fast deployments into elastic beanstalk via the git backend. | ||
|
||
(if you look closely, thats the reason for both .gitignore and .hgignore files) | ||
|
||
# Code Notes | ||
|
||
## Health Check | ||
|
||
The health check code tries to poll DynamoDB, S3, and EC2. If your EC2 keys are IAM-limited, comment-out the relevant sections. | ||
|
||
## Misc Notes | ||
|
||
- Check [the plugin page](http://beanstalker.ingenieux.com.br/beanstalk-maven-plugin/) for General Reference and Usage Instructions. | ||
- Subscribe to the beanstalker-users list at [[http://groups.google.com/group/beanstalker-users]] to get up-to-date information | ||
- Problems? Let us know, on the lists or [the issue tracker](http://github.com/ingenieux/beanstalker/issues) | ||
- Feedback please! | ||
|
||
We hope beanstalk-maven-plugin helps your life easier, and find it fun and easy as much as we do. | ||
|
||
btw, why not [donate to beanstalker](http://beanstalker.ingenieux.com.br/donate.html)? | ||
|
||
Thank you. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>io.ingenieux</groupId> | ||
<artifactId>azurator-sample</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
||
<app.mainClass>io.ingenieux.Main</app.mainClass> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.dropwizard</groupId> | ||
<artifactId>dropwizard-core</artifactId> | ||
<version>0.8.0-rc1</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.artifactId}</finalName> | ||
|
||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
|
||
<testResources> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
</testResource> | ||
</testResources> | ||
|
||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|
||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>br.com.ingenieux</groupId> | ||
<artifactId>beanstalk-maven-plugin</artifactId> | ||
<inherited>true</inherited> | ||
<version>1.4.0-SNAPSHOT</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>azurewebsites</id> | ||
<properties> | ||
<maven.test.skip>true</maven.test.skip> | ||
<maven.install.skip>true</maven.install.skip> | ||
<maven.deploy.skip>true</maven.deploy.skip> | ||
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.5.2</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<descriptor>src/main/assembly/bin.xml</descriptor> | ||
<attach>false</attach> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.ingenieux</groupId> | ||
<artifactId>azurator-maven-plugin</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>fast-deploy</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<assembly | ||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 | ||
http://maven.apache.org/xsd/assembly-1.1.2.xsd"> | ||
|
||
<id>bin</id> | ||
<formats> | ||
<format>dir</format> | ||
</formats> | ||
<baseDirectory /> | ||
<dependencySets> | ||
<dependencySet> | ||
<outputDirectory>repo</outputDirectory> | ||
</dependencySet> | ||
</dependencySets> | ||
<files> | ||
<file> | ||
<source>src/main/config/app.cmd</source> | ||
<outputDirectory>/</outputDirectory> | ||
<filtered>true</filtered> | ||
</file> | ||
<file> | ||
<source>src/main/config/web.config</source> | ||
<outputDirectory>/</outputDirectory> | ||
<filtered>true</filtered> | ||
</file> | ||
</files> | ||
<fileSets> | ||
<fileSet> | ||
<directory>target/classes</directory> | ||
<outputDirectory>classes</outputDirectory> | ||
</fileSet> | ||
<fileSet> | ||
<directory>src/main/config</directory> | ||
<outputDirectory /> | ||
<excludes> | ||
<exclude>web.config</exclude> | ||
</excludes> | ||
</fileSet> | ||
</fileSets> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@echo on | ||
set | ||
D: | ||
SET WEBROOT_PATH=D:\home\site\wwwroot | ||
cd %WEBROOT_PATH% | ||
echo "%JAVA_HOME%\bin\java.exe" -Djava.net.preferIPv4Stack=true -Ddw.server.applicationConnectors[0].port=%HTTP_PLATFORM_PORT% -classpath "%WEBROOT_PATH%\classes;%WEBROOT_PATH%\repo\*" ${app.mainClass} server "%WEBROOT_PATH%\config.yml" | ||
"%JAVA_HOME%\bin\java.exe" -Djava.net.preferIPv4Stack=true -Ddw.server.applicationConnectors[0].port=%HTTP_PLATFORM_PORT% -classpath "%WEBROOT_PATH%\classes;%WEBROOT_PATH%\repo\*" ${app.mainClass} server "%WEBROOT_PATH%\config.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server: | ||
applicationConnectors: | ||
- type: http | ||
port: 8080 | ||
|
||
logging: | ||
level: INFO | ||
loggers: | ||
"com.sun.jersey": OFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<system.webServer> | ||
<handlers> | ||
<add name="httppPlatformHandler" path="*" verb="*" | ||
modules="httpPlatformHandler" resourceType="Unspecified" /> | ||
</handlers> | ||
|
||
<!-- | ||
HttpPlatform configuration | ||
- - - - - - - - - - - - - - | ||
processPath - path to the executable or script that will | ||
launch a process listening for Http requests. | ||
examples: | ||
1. %JAVA_HOME%\bin\java.exe | ||
2. d:\home\site\wwwroot\bin\tomcat\bin\startup.bat | ||
3. d:\home\site\wwwroot\bin\tomcat\bin\catalina.bat | ||
arguments - (default="") arguments to the executable or | ||
script specified in 'processPath' setting. | ||
examples: | ||
1. processPath="d:\home\site\wwwroot\bin\tomcat\bin\catalina.bat" | ||
arguments="start" | ||
2. processPath="%JAVA_HOME\bin\java.exe" | ||
arguments="-Djava.net.preferIPv4Stack=true | ||
-Djetty.port=%HTTP_PLATFORM_PORT% | ||
-Djetty.base="d:\home\site\wwwroot\bin\jetty-distribution-9.1.0.v20131115" | ||
-jar "d:\home\site\wwwroot\bin\jetty-distribution-9.1.0.v20131115\start.jar"" | ||
startupTimeLimit - (default=10seconds) Duration for which | ||
HttpPlatformHandler will wait for the executable/script | ||
to start a process listening on the port. | ||
If this time limit is exceeded, httpPlatformHandler will | ||
kill the process and try to launch it again | ||
'startupRetryCount' times. | ||
startupRetryCount - (default=10) Number of times HttpPlatformHandler will try | ||
to launch process specified in processPath. | ||
(please see startupTimeLimit for more details). | ||
rapidFailsPerMinute - (default=10) Number of times the process specified in processPath | ||
is allowed to crash per minute. If this limit is exceeded, | ||
HttpPlatformHandler will stop launching the process for that minute. | ||
requestTimeout - (default="00:02:00") Duration for which HttpPlatformHandler will | ||
wait for a response from the process listening on | ||
%HTTP_PLATFORM_PORT%. | ||
stdoutLogEnabled - (default="true") stdout and stderr of the process specified in | ||
'processPath' setting will be redirected to a file specified in | ||
'stdoutLogFile' (see below). | ||
stdoutLogFile - (default='d:\home\LogFiles\httpPlatformStdout.log') | ||
absolute file path to the file where stdout/stderr from process | ||
specified in processPath will be logged. | ||
NOTE: %HTTP_PLATFORM_PORT% is a special placeholder which needs to specified either as part of | ||
'arguments' or part of the httpPlatform 'environmentVariable' list - This will be replaced | ||
by an internally generated PORT by HttpPlatformHandler so that the process specified in | ||
'processPath' setting can listen on this port. | ||
--> | ||
|
||
<httpPlatform processPath="D:\Windows\system32\cmd.exe" | ||
arguments="/C call D:\home\site\wwwroot\app.cmd" | ||
startupTimeLimit="180"> | ||
<environmentVariables> | ||
<!-- <environmentVariable name="foo" value="bar" /> --> | ||
</environmentVariables> | ||
</httpPlatform> | ||
</system.webServer> | ||
</configuration> |
Oops, something went wrong.