Jenkins running on AWS EC2 Windows instance - cannot find Jenkins job files - amazon-web-services

So I've got Jenkins running on an AWS EC2 windows instance. I've created some test jobs and they run my Selenium automation scripts fine from Jenkins in my FF browser using localhost:8080.
I have Jenkins installed in C:\Jenkins. However, inside C:\Jenkins/jobs I see no files at all. Where are my Jenkins job files located?

Look under here:
C:\Users\<user that you use to run jenkins>\.jenkins
You can see your home directory clicking on: Jenkins->Manage Jenkins->Configure System. That's where your job files should be.

Related

AWS ElasticBeanstalk configuring or running additional commands on deployment

I am working deploying a Laravel application to the AWS ElasticBeanstalk. I configured the CLI and I could deploy the application to an ElasticBeanstalk environment running the command. This is what I have done so far.
I created an ElasticBeanstalk application and an environment in it.
Then I initialised the application for deployment using "eb init" and deployed it using "eb deploy". But I would like to add some additional commands to be run during the deployment. For example, I might run "gulp build" or other commands. Where and how can I figure it? I know that there is an .elasticextension folder but that does not allow us to add custom commands to be run on deployment.
I know that there is an .elasticextension folder but that does not allow us to add custom commands to be run on deployment.
Not sure what do you mean that you can't run commands in .ebextensions during deployment. But the extensions are commonly used for running commands or scripts when you are deploying your app. There are special sections for that:
commands: You can use the commands key to execute commands on the EC2 instance. The commands run before the application and web server are set up and the application version file is extracted.
container_commands: You can use the container_commands key to execute commands that affect your application source code. Container commands run after the application and web server have been set up and the application version archive has been extracted, but before the application version is deployed.
There are also platform hooks on Amazon Linux 2 to further fine tune the deployment of your applications.
Finally, if all of them are not suited, you could create dedicated build step in CodePipleline for you application. The dedicated step could be used to create fully deployment version of your application for EB with minimal amount of work to do at EB instances.

How to deploy a spring boot application jar from Jenkins to an EC2 machine

I'm seeing so many different sources how to to achieve CI with Jenkins and EC2 and strangely none seem to fit my needs.
I have 2 EC2 ubuntu instances. One is empty and the other has Jenkins installed on it.
I want to perform a build on the Jenkins machine and copy the jar to the other ubuntu machine. Once the jar is there i want to run mvn spring-boot:run
That's is - a very simple flow which i can't find a good source to follow that doesn't include slaves, dockers etc..
AWS Code Deploy lets you use a Jenkins and deploy it on your EC2 instances.
Quick google search gave me this very detailed instruction on how to setup code pipeline with AWS Code Deploy.
The pipeline uses GitHub -> Jenkins -> EC2 flow, as you need it.
Set up jenkins to do a build then scp the artifact to the other machine
There's an answer here how to setup ssh keys for jenkins to publish via ssh about setting up the keys for ssh

Where are the source files for my Docker application deployed to ECS?

I built a Dockerized Python/Django application and deployed it to ECS using these instructions.
The application is deployed and responsive. But I notice there are some bugs. So to troubleshoot, I SSH'ed the the EC2 instance running the application. I did a ps and I can clearly see all my application's processes running. That's good.
However, when I look for my source files and any of the application's log files, I cannot find them anywhere on that instance. I have searched the entire disk thoroughly but those files are nowhere to be found. How is that possible? Where is it running my application from? Does it run it out of the ECR? How can I monitor log files for my application?
As 200 OK suggested, you need to ssh into the docker container to see your application files.
docker exec -it <container_id> bash
Also, you can see the logs from the AWS CloudWatch Console itself if you enable the awslogs log driver in the application's ECS Task Definition.

AWS Elastic Beanstalk . Execute .ebextensions commands only on new Instance or Manually

I have configured my .ebextensions folder to download and install a windows service on the leader ec2 instance.
Problem is that every time i want to update to a new version of the web application (Not the windows service) Those commands execute again and try to re install the service again.
On the other side. Every time i want to update only the widows service, i have to do the work manually through ssh or rdp. Or re-deploy the whole application which triggers the .ebextensions commands.
Is there a more elegant workflow for this i am skipping?
You are encountering Elastic Beanstalk weakest link. You host two different services on the same EB instance, which is unsupported by EB (which is lame I agree).
I resolved the "setup only once" need by appending a test to the setup extentension config file. In my case it's a linux box, but you can do something similar:
commands:
10_setup_win_service:
test: test ! -f /opt/elasticbeanstalk/.post-provisioning-complete
command: <...>
Now to complete this hack I have a file called .ebextensions/99_finalize_setup.config:
commands:
99_write_post_provisioning_complete_file:
command: touch /opt/elasticbeanstalk/.post-provisioning-complete
this approach ensures the win service is installed only once.
Now for your maintenance issue of the win service, you cannot use the EB toolset for that. Your understanding of the options here are correct - either use SSH to automate the work, or do it manually by logging into the server.

AWS Elastic Beanstalk - Deployment Quandry

I have an AWS Elastic Beanstalk with an environment setup (Windows Server 2012, IIS 8, Load Balanced). When I first create the environment with a .NET application, everything appears to work just fine. However, when I redeploy the application - using the AWS tools for Visual Studio 2012 - the new version does not seem to be deployed. I see the new deployment bundle up inthe proper S3 location, and the event viewer in the console indicates that everything is going fine:
Environment update is starting.
Deploying new version to instance(s).
Command execution completed successfully.
New application version was deployed to running EC2 instances.
Environment update completed successfully.
However, no new files appear on the server. Just for a check, I deleted all of the files in the c:\inetpub\wwwroot directory (the application deploys as the root app) and when the redeploy completes, I still do not see any files in this directory. I've tried to snapshot the logs, but there don't appear to be any (the list comes back empty). I've checked the deployments log files on the server itself (via RDP) and they are also empty. I've checked the server's event viewer as well - also void of any messages. It is almost as if the server is not actually running the deployment.
I am not sure what I could be doing wrong, but any guidance or suggestions are appreciated.
Have you looked under your 'Application Versions'?
It is possible that the bundle has been uploaded but not running on the instances.
The problem was because I was using a custom AMI for the beanstalks. I found out that the AMI I was using was not beanstalk-friendly, even though I created it from a beanstalk EC2 instance that I had customized. There was something in the configuration that made the new machines not deploy properly. In any case, for now I decided that I should just update my deployment package to include the stuff I needed (e.g., C++ redistributable) as opposed to trying to customize the machine images (i.e., Command for Elastic Beanstalk configuration to install Visual C++ Redistributable).