Sha256: bfa7d1486f43c16f59e9e4f4c70ea609938d3b01262008f654afe58f900ecd09

Contents?: true

Size: 998 Bytes

Versions: 7

Compression:

Stored size: 998 Bytes

Contents

module Souls
  module Gcloud
    module Sql
      class << self
        def create_instance(instance_name: "", root_pass: "Postgre123!", zone: "asia-northeast1-b")
          instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
          system(
            "gcloud sql instances create #{instance_name} \
              --database-version=POSTGRES_13 --cpu=2 --memory=7680MB --zone=#{zone} \
              --root-password='#{root_pass}' --database-flags cloudsql.iam_authentication=on"
          )
        end

        def patch_instance(instance_name: "")
          app_name = Souls.configuration.app
          instance_name = "#{Souls.configuration.app}-db" if instance_name.blank?
          project_id = Souls.configuration.project_id
          system(
            "gcloud beta sql instances patch #{instance_name} \
              --project=#{project_id} \
              --network=#{app_name} \
              --no-assign-ip"
          )
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
souls-0.44.3 lib/souls/cli/gcloud/sql/index.rb
souls-0.44.2 lib/souls/cli/gcloud/sql/index.rb
souls-0.44.1 lib/souls/cli/gcloud/sql/index.rb
souls-0.44.0 lib/souls/cli/gcloud/sql/index.rb
souls-0.43.0 lib/souls/cli/gcloud/sql/index.rb
souls-0.42.1 lib/souls/cli/gcloud/sql/index.rb
souls-0.42.0 lib/souls/cli/gcloud/sql/index.rb