Sha256: a3e97ec91d3be913c8b24590da83df09216770e42d133300a1f5ba65fd9ff9ba

Contents?: true

Size: 1.49 KB

Versions: 51

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

require 'addressable/uri'
require 'avm/eac_redmine_base0/data_unit'
require 'avm/eac_redmine_base0/instances/docker_image'
require 'avm/eac_redmine_base0/rest_api'
require 'avm/eac_webapp_base0/instance'
require 'avm/eac_rails_base1/instance'

module Avm
  module EacRedmineBase0
    class Instance < ::Avm::EacRailsBase1::Instance
      enable_simple_cache

      FILES_UNITS = { files: 'files' }.freeze

      def docker_image_class
        ::Avm::EacRedmineBase0::Instances::DockerImage
      end

      def docker_run_arguments
        [
          '--volume',
          "#{read_entry(::Avm::Instances::EntryKeys::FS_PATH)}:/home/myuser/eac_redmine_base0",
          '--publish', "#{read_entry(:ssh_port)}:22",
          '--publish', "#{read_entry(:http_port)}:80",
          '--publish', "#{read_entry(:https_port)}:443"
        ]
      end

      def data_package
        @data_package ||= ::Avm::Data::Instance::Package.new(
          self,
          units: {
            all: ::Avm::EacRedmineBase0::DataUnit.new(self)
          }
        )
      end

      # @return [Addressable::URI]
      def root_url
        r = ::Addressable::URI.parse(read_entry(::Avm::Instances::EntryKeys::WEB_URL))
        r.query_values = nil
        r
      end

      private

      # @return [Avm::EacRedmineBase0::RestApi]
      def rest_api_uncached
        url = root_url
        url.query_values = { key: read_entry('api.key') }
        ::Avm::EacRedmineBase0::RestApi.new(url)
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 3 rubygems

Version Path
eac_tools-0.22.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.21.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.20.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.19.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.18.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.17.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.16.1 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.16.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.15.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.14.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.13.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.12.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.11.1 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
avm-eac_redmine_base0-0.11.0 lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.11.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
avm-eac_redmine_base0-0.10.0 lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.10.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.9.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb
avm-eac_redmine_base0-0.9.1 lib/avm/eac_redmine_base0/instance.rb
eac_tools-0.8.0 sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instance.rb