Class: Seira::Db::Create
- Inherits:
-
Object
- Object
- Seira::Db::Create
- Includes:
- Commands
- Defined in:
- lib/seira/db/create.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#cpu ⇒ Object
readonly
Returns the value of attribute cpu.
-
#make_highly_available ⇒ Object
readonly
Returns the value of attribute make_highly_available.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#proxyuser_password ⇒ Object
readonly
Returns the value of attribute proxyuser_password.
-
#replica_for ⇒ Object
readonly
Returns the value of attribute replica_for.
-
#root_password ⇒ Object
readonly
Returns the value of attribute root_password.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(app:, action:, args:, context:) ⇒ Create
constructor
A new instance of Create.
- #run(existing_instances) ⇒ Object
Methods included from Commands
#gcloud, gcloud, kubectl, #kubectl
Constructor Details
#initialize(app:, action:, args:, context:) ⇒ Create
Returns a new instance of Create.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/seira/db/create.rb', line 11 def initialize(app:, action:, args:, context:) @app = app @action = action @args = args @context = context # We allow overriding the version, so you could specify a mysql version but much of the # below assumes postgres for now @version = 'POSTGRES_9_6' @cpu = 1 # Number of CPUs @memory = 4 # GB @storage = 10 # GB @replica_for = nil @make_highly_available = false @root_password = nil @proxyuser_password = nil end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
6 7 8 |
# File 'lib/seira/db/create.rb', line 6 def action @action end |
#app ⇒ Object (readonly)
Returns the value of attribute app.
6 7 8 |
# File 'lib/seira/db/create.rb', line 6 def app @app end |
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/seira/db/create.rb', line 6 def args @args end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/seira/db/create.rb', line 6 def context @context end |
#cpu ⇒ Object (readonly)
Returns the value of attribute cpu.
8 9 10 |
# File 'lib/seira/db/create.rb', line 8 def cpu @cpu end |
#make_highly_available ⇒ Object (readonly)
Returns the value of attribute make_highly_available.
8 9 10 |
# File 'lib/seira/db/create.rb', line 8 def make_highly_available @make_highly_available end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
8 9 10 |
# File 'lib/seira/db/create.rb', line 8 def memory @memory end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/seira/db/create.rb', line 8 def name @name end |
#proxyuser_password ⇒ Object (readonly)
Returns the value of attribute proxyuser_password.
9 10 11 |
# File 'lib/seira/db/create.rb', line 9 def proxyuser_password @proxyuser_password end |
#replica_for ⇒ Object (readonly)
Returns the value of attribute replica_for.
8 9 10 |
# File 'lib/seira/db/create.rb', line 8 def replica_for @replica_for end |
#root_password ⇒ Object (readonly)
Returns the value of attribute root_password.
9 10 11 |
# File 'lib/seira/db/create.rb', line 9 def root_password @root_password end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
8 9 10 |
# File 'lib/seira/db/create.rb', line 8 def storage @storage end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
8 9 10 |
# File 'lib/seira/db/create.rb', line 8 def version @version end |
Instance Method Details
#run(existing_instances) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/seira/db/create.rb', line 30 def run(existing_instances) @name = "#{app}-#{Seira::Random.unique_name(existing_instances)}" run_create_command if replica_for.nil? update_root_password create_proxy_user end set_secrets write_pgbouncer_yaml puts "To use this database, deploy the pgbouncer config file that was created and use the ENV that was set." puts "To make this database the primary, promote it using the CLI and update the DATABASE_URL." end |