Class: GV::Valley::Addon
- Inherits:
-
Bedrock::Service
- Object
- Bedrock::Service
- GV::Valley::Addon
- Includes:
- Common::DockerHelper, Common::HostHelper
- Defined in:
- lib/gv/valley/addon.rb
Overview
Addon Service
Direct Known Subclasses
Constant Summary collapse
- PORT =
nil
Instance Attribute Summary collapse
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #create(app_name) ⇒ Object
- #destroy(app_name) ⇒ Object
- #info(app_name) ⇒ Object
-
#initialize ⇒ Addon
constructor
A new instance of Addon.
- #port(app_name) ⇒ Object
Constructor Details
Instance Attribute Details
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
20 21 22 |
# File 'lib/gv/valley/addon.rb', line 20 def cmd @cmd end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
20 21 22 |
# File 'lib/gv/valley/addon.rb', line 20 def image @image end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
20 21 22 |
# File 'lib/gv/valley/addon.rb', line 20 def params @params end |
Instance Method Details
#create(app_name) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/gv/valley/addon.rb', line 32 def create app_name @app_name = app_name addon_name = "#{@name}.#{app_name}" return nil if ps? addon_name pipe "docker run --name #{addon_name} -d -p #{self.external_ip}::#{self.class::PORT} -e PORT=#{self.class::PORT} #{self.params} #{self.image} #{self.cmd}" end |
#destroy(app_name) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/gv/valley/addon.rb', line 39 def destroy app_name @app_name = app_name addon_name = "#{@name}.#{app_name}" batch addon_name, "stop", true batch addon_name, "rm", true end |
#info(app_name) ⇒ Object
46 47 48 49 50 |
# File 'lib/gv/valley/addon.rb', line 46 def info app_name @app_name = app_name addon_name = "#{@name}.#{app_name}" info(container_id(addon_name)) end |
#port(app_name) ⇒ Object
52 53 54 55 56 |
# File 'lib/gv/valley/addon.rb', line 52 def port app_name @app_name = app_name addon_name = "#{@name}.#{app_name}" container_port addon_name, self.external_ip, self.class::PORT end |