Kong / jenkins-infrastructure

Cloudformation to create and update an ECS cluster that runs jenkins
Apache License 2.0
12 stars 26 forks source link

To Implement Cloudformation Template with Default Vpc , What Configuration Changes are Required? #9

Open AditModi opened 3 years ago

AditModi commented 3 years ago

Hi, My use-case involves creating a cloudformation template that will internally use default vpc for creating ecs - clusters and jenkins docker image needs to be used within the ecs-clusters. ( only change required is instead of using custom vpc , we require to use default vpc ) If I am looking to implement the above mentioned setup , what changes do I need to make in the current cloudformation template.

hutchic commented 3 years ago

I think this could be achieved by updating https://github.com/Kong/jenkins-infrastructure/blob/master/master.yaml

Drop the VPC resource and add parameters for all instances of !GetAtt VPC.Outputs.VPC

AditModi commented 3 years ago

@hutchic , Implemented above setup. I am facing an issue:

if I want to run the aws-cli / node ( npm commands ) / eb-cli / docker commands etc . For that to happen I need those packages to be installed like If I need aws-cli to be installed , how I could do that ? (I don’t seem to get the fact that I can’t ssh into the jenkins instance and so I cannot install these packages.)

Is there a way I can install aws-cli / node / docker / eb-cli ???

when running jenkins pipeline ( using jenkins custom docker image) on ecs , I have to run a bunch of aws-cli / node / docker based commands , how can I install those commands.

AditModi commented 3 years ago

-> solution could be installing all the packages in a custom jenkins docker image. But if I need any new package like after some time I need nginx package , I need to install it in a custom jenkins docker image and build image and update template to use new image. ( I know these solution could do the job , but is it optimal ?? is there any solution available which is better than provided solution! )

hutchic commented 3 years ago

The jenkins docker image ( https://hub.docker.com/r/jenkins/jenkins ) includes some documentation on how to handle this

As an example the jenkins docker image we run has the aws-cli installed which you can use as inspiration https://github.com/Kong/jenkins. Best approach is tell Docker hub to auto build this Dockerfile for you

AditModi commented 3 years ago

I think using docker hub to auto build is a good approach ( I may use an alternative to docker hub like ecr and try my own autobuild ) . It raises another concern for me, I have a cloudformation template already created using my docker (jenkins) image , I have an auto build for my dockerfile ( same image ) , will I have to update my template manually ??

hutchic commented 3 years ago

the jenkins image that gets used is a cloudformation template variable. So the template itself won't need to be but just re-run the cloudformation by updating it and setting the new image tag as an argument