How to deploy KinesisAutoscaling.war on Java Application Server or Tomcat? - amazon-web-services

I want to manage kinesis shards automatically so I want to deploy KinesisAutoscaling.war on Tomcat. I found steps(https://github.com/awslabs/amazon-kinesis-scaling-utils) to deploy at Elastic Beanstalk.
Similar way I want step by step solution to deploy on Tomcat.

I was able to slow this problem using below steps.
Downlaod the code from here.
Open the project as Maven project in eclipse
Change the stream configuration in the configuration.json and provide the path of configuration in AutoscalingController.java like below
String configPath = "C:\
amazon-kinesis-scaling-utils-master\conf\configuration.json";
Build the project and place .jar file to the webapps folder of tomcat and start tomcat.

Related

How I can replace customized /etc/nginx/nginx.conf file, when build Elastic Beanstalk from Docker File

Dear network please take a look on following questions.
ENVIRONMENT:
AWS Elastic Beanstalk (EBS) (Docker running on 64bit Amazon Linux 2/3.4.12)
SITUATION:
I am running AWS EBS from Docker Platform and using Docker File to run the container. After deployment I need to replace nginx.conf file with my updated nginx.conf,
ACTIONS:
Trying to use in DockerFile ADD https://my-scripts.s3.amazonaws.com/nginx.conf /etc/nginx command, but after deployment the file isn't replacing the original file.
RESULT:
Seems the reason is, that nginx installing in container after Docker File process and probably to have custom nginx.conf I need to use on of the aws platform
custom hooks.
QUESTIONS:
Am I in the right direction regarding custom hooks, or there are
better ways to solve it?
How platform custom hooks could be used for this case to build EBS:
Should I just add hooks /opt/elasticbeanstalk/hooks/postdeploy
EX: ADD s3://my_custom_hook_script /opt/elasticbeanstalk/hooks/postdeploy.?
As a solution just make war/zip archive with DockerFile and .platform/nginx/nginx.conf and deploy war/zip instead of DockerFile only. That replaced /etc/nginx/nginx.conf and not need to restart nginx. COuld be this meaningfull solution ?
NOTE:
When I was building AWS EBS from war file for my other service, I just added the .platform/nginx/nginx.conf under the root of project and after building war keep that folder in the same level as the generated project jar, which replace with custom nginx.conf without restarting nginx service.
Thanks in advance

How do I make a django project compatible with AWS Beanstalk?

I want to make a Django project compatible with AWS Beanstalk.
I dont want this to be like in AWS tutorial, since they use git and need to setup the whole project as they tell.
I just want to know if there is a way of converting an already created Python-Django project to be AWS Beanstalk compatible. I mean, isn't there a standard project layout to download or a plugin or command-line tool that creates the .ebsettings folder for me? I want to convert my project and upload it throw the AWS web gui, dont need all the git stuff.
You can do this without using git route. You just need to zip your source bundle and upload to the Beanstalk Web Console. The code structure can be kept the way you want.
Key configurations are:
1. WSGIPath : This should point to the .py file which you need to start the app (WSGI app)
2. static: This should point to the path containing the static files
You can add the configurations in the .ebextensions folder, which should at the root of your app zip. You can read more details here: Customizing and Configuring a Python Container - AWS Elastic Beanstalk

Deployment package did not contain an iisApp

I'm trying to upload a zip of files of a published .net project to Amazon elastic beanstalk but it keeps throwing an error in the logs saying iisApp is not there. How to fix?
Elastic Beanstalk expects a WebDeploy package, not just a zipped web application. You'll probably want to run:
msbuild <web.csproj> /t:Package /p:Configuration=Release /p:PackageLocation=<outputdirectory>
to create a WebDeploy package.

How to deploy the Web service in to tomcat 7 from out side of eclipse juno?

i am very new to web services and i have one problem please suggest me .. i.e i have a WSDL(SOAP) file and with that i created the Web Service-server and web service-Client using Top-Down approach with JAX-WS in eclipse Juno Java EE. i integrated the Tomcat 7 with that Eclipse and from eclipse its working fine.
But my problem is i need to run the Tomcat from out side of the eclipse and i need to deploy the web service in to the tomcat. i don't want to run the Tomcat using eclipse? i just need to run the client from eclipse but i dont want to run the tomcat from eclipse. Please Help me.
File -> Export -> Web -> War (configure where to create it)
Deploying a tomcat application consist of building a war file then deploying it. We call this servlet.
Building the WAR
As you already have your server code, you should now complet the WEB-INF/web.xml file. This file describe the path of your servlet(your server code), on the tomcat server. Depending of your framework you can have some configuration to add in your META-INF/context.xml file.
In an eclipse project, thoses file are generaly under a directory name 'webapp' in your project. (src/main/webapp for a maven project).
First you must use the javaee & javaweb tools of eclipse to build a war file that contains all yours libs, files, class and web.xml
Alternativly you can use a maven build process to get a war, if you use maven.
Deploying the war
After installing tomcat, the deployement is as simple as drop the .war file is deploy directory of the home-directory of tomcat. Then your application is usable on default port 8080.
If you have install also the manager webapp of tomcat, you can see all yours currently deployed application in the manager http://myurl:8080/manager/html.
When you install tomcat, let be sure that your eclipse pseudo server is shutdown, or your tomcat server will have problem to get it's port and startup.

How could I automate build deploy in jenkins?

We are using jenkins for CI. we get late night builds. Is there any way to automate the build deploy as soon as we get a mail or intimation ? Any suggestions would be appreciated..
One mechanism to deploy off of a build on Jenkins is to use artifacts to place the latest binary in a known location, and then kick off a new job (only on success of the compile/test phase) which uses (private key protected) ssh or scp to copy the artifacts to the test/production machine and then perform the install.
We use a similar mechanism for some automated testing that we do. The tricky part is getting the shell command to handle the ssh keys, so we do the following:
eval `ssh-agent -s`
ssh-add ~/.ssh/your_private_key_here
As long as that private key is on the Jenkins server and the public key is on the server you're trying to push to, you can then use ssh and scp commands in the rest of the script to perform functions on the server in question.
If you prefer to run the process entirely from the target server end, you can create a small script that runs on the server that checks for new files in the artifact directory of your Jenkins server build. Thanks to the latest path, you don't have to know the build number to do this. To find the specific path, you can log in to your Jenkins server (once you've saved at least one artifact), and find the project you are using and look at the Last Successful Artifacts, which will be URLs to the last successful builds of the artifacts. These URLs remain constant and always point at the most recent successful build, so you don't have to worry about them changing unless the project name or server name changes.
NOTE: there are security holes here that you can drive a truck through if you are doing this for anything other than a deployment to test. In the case of the first mechanism, your build server has an ssh key that gives it access (potentially destructive) to the target. In the case of the second mechanism, you are trusting that the Jenkins server will only serve up binaries that are good for you. However, for test environments, push to stage, etc. these techniques will work well.
These are the ways I know:
With a script:
In the Jenkins configurations, you can execute windows/shell commands after the execution of your maven goals. In my case, I have a Glassfish on a Linux, and via ssh I execute the asadmin parameters for the deployment. I have installed an instance in the server, and the process that I follow is: stop instance, undeploy app, deploy app, start instance (commands).
With a Maven Deploy Plugin:
This plugin takes a war/ear file and deploys that to a running remote application server at the end of a build. The list of currently supported containers include:
Tomcat 4.x/5.x/6.x/7.x
JBoss 3.x/4.x
Glassfish 2.x/3.x
https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin
With Cargo:
The Deploy Plugin is based on this. You must edit your pom.xml and execute the goals of deploy with maven.
http://cargo.codehaus.org/
In tomcat, configuration with jenkins and tomcat:
Install and download the jenkins on your server and start the server go to jenkins portal after that create the project using 'New Item' and select the pom.xml and create the maven project.
Now go to your project and click on Configure and select the "Restrict where this project can be run" and add master in your Level Expression.
select the "Source Code Management" clisck on git and configure your git repository and credential and branch name.
Select the "Build" add Root pom : pom.xml and Goals and options : clean install -DskipTests
select the "Post-build Actions" and select the "Deploy war/ear to a container"
WAR/EAR files : target/test.war
Context path : test
Containers select tomcat and add Credentials
Tomcat URL : example : http://localhost:8080/
Update the 'apache-tomcat-8.5.5\webapps\manager\META-INF\context.xlm file. uncomment the Value tag. and restart server
context.xml file
Before :
<Context antiResourceLocking="false" privileged="true">
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="192\.168\.0\.9|127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>
After change :
<Context antiResourceLocking="false" privileged="true" >
</Context>
for auto deployment: go to 'apache-tomcat-8.5.5\conf\context.xml' and add antiResourceLocking="true" in 'Context' tag