Conversation
92c80f7 to
f7e4e37
Compare
lib/cove/instance_on_demand.rb
Outdated
| end | ||
|
|
||
| def name | ||
| "#{service.name}-#{role.name}-#{version}" |
There was a problem hiding this comment.
You could use the SecureRandom class to create a random string and attach it to the container to keep the name unique.
I would also suggest adding “run” or something to the name to better visually distinguish it from the deployed containers.
jfahrer
left a comment
There was a problem hiding this comment.
This is looking good. Regarding the labels we talked about on how to identify on-demand instances VS deployed instances.
I think a Label cove.type with on-demand or deployed as the values sound like the right path forward. You could apply this label in the respective instance classes. And then change the code that finds existing containers to also respect that label. Feel free to do this in a separate PR.
lib/cove/command/builder.rb
Outdated
| [:docker, "container", "start", *containers.flatten] | ||
| end | ||
|
|
||
| def self.start_attached_container(container) |
There was a problem hiding this comment.
| def self.start_attached_container(container) | |
| def self.start_container_and_attach(container) |
Feels more descriptive for what is going on.
lib/cove/command/builder.rb
Outdated
| # @param [Cove::DesiredContainer] config | ||
| # @return [Array] The command to create the container | ||
| def self.run_container(config) | ||
| Docker::Container::Run.build(image: config.image, name: config.name, remove: true, detach: false, interactive: true, labels: config.labels, command: config.command, ports: config.ports, mounts: config.mounts) |
There was a problem hiding this comment.
Should we remove this and related code since it is not used?
lib/cove/instance_on_demand.rb
Outdated
| @@ -0,0 +1,39 @@ | |||
| module Cove | |||
| class InstanceOnDemand | |||
There was a problem hiding this comment.
How would you feel naming this OnDemandInstance. Another approach could be to make an Instance module and have Instance::OnDemand and Instance::Deployed or something. That would keep those two very closely related concepts closer together.
| @index = 1 | ||
| end | ||
|
|
||
| def name |
There was a problem hiding this comment.
Can you add the doc for the return type as well? Thanks.
| end | ||
|
|
||
| def labels | ||
| end |
There was a problem hiding this comment.
Needs to be deleted, otherwise it overwrites the delegate for labels above.
…ting for ServiceRun and Service
c8d83b6 to
b5d1c7b
Compare
No description provided.