autopilotpattern / jenkins

Extension of official Jenkins Docker image that supports Joyent's Triton for elastic slave provisioning
43 stars 10 forks source link

How to be specific with Triton using men_limit in docker-compose.yml #12

Closed charandas closed 7 years ago

charandas commented 7 years ago

I have been playing with this recently, and am curious how Triton decided for a men_limit of 4G to offer me a g4-highcpu-4G instance instead of a g4-general-4G?

Is there a way to specify the metadata(aka Triton package) through docker-compose.yml, or would I rely on triton-cli for resizing the container after the fact?

geek commented 7 years ago

Here is more information on the sizing: https://apidocs.joyent.com/docker/features/resources

You can add a label named com.joyent.package to designate a specific package.

Otherwise, it reads any mem_limit from docker and finds the package with the smallest memory size to satisfy the memory requirements: https://github.com/joyent/sdc-docker/blob/master/lib/backends/sdc/containers.js#L1262

charandas commented 7 years ago

Thank you @geek. The other question I had was about the Jenkins slave provisioning on the fly.

Will I be able to specify the above mentioned label in Jenkins docker plugin config?

Why are the jobs running on master by default? Is it just a matter of using Jenkins slave labels and putting those on specific jobs?

I see all the Triton regions preconfigured in Jenkins docker plugin config with client credentials and the like, guess the last thing is to see a successful build happen off the master :)

tgross commented 7 years ago

Why are the jobs running on master by default? Is it just a matter of using Jenkins slave labels and putting those on specific jobs?

I see all the Triton regions preconfigured in Jenkins docker plugin config with client credentials and the like, guess the last thing is to see a successful build happen off the master :)

We're building on master by default because very little in the way of resources will be used for the builds -- the idea here is that you'd launch the actual test containers onto Triton (using something like the framework in https://github.com/autopilotpattern/testing. One could of course extend your jobs to build on Jenkins slaves if need be.

charandas commented 7 years ago

Thanks @tgross. I get it. That makes total sense.

So I just need to follow this: https://github.com/autopilotpattern/testing/blob/master/README.md#testing-on-triton

So the idea with preloaded configuration in docker plugin is that if I utilize the Jenkins docker plugin for spawning docker containers then, I won't have to worry about providing certs and such, correct?

I am using Jenkins pipeline builds, but surely there must be a way to use Jenkins docker plugin as opposed to 'sh "docker..."' in my Groovy file.

Thanks so much for the help.

alexandrascript commented 7 years ago

@charandas

I know you've closed this, but I wanted to let you know you can also add it to your Docker Compose file:

Using Docker Compose

When creating a service in Docker Compose, you can set the image, memory limit, ports, and more. When declaring the mem_limit, be sure to declare if it’s megabytes or gigabytes with m and g respectively. For example, this creates an ubuntu container with a memory limit of 4g and specifies the package as standard:

myservice:
   image: ubuntu:latest
   restart: always
   mem_limit: 4g
   labels:
      - com.joyent.package=g4-standard-4G

You can even use the Joyent portal to create an instance and specify the memory limit. Check out those instructions in our documentation.

charandas commented 7 years ago

:thumbsup: this is perfect. Thanks @heyawhite