Sha256: 283b8ff1309b19e78b0664bf81a01584004255643ad4dbbb498cb07d16f58fa7
Contents?: true
Size: 1.8 KB
Versions: 48
Compression:
Stored size: 1.8 KB
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' require 'avm/jobs/base' require 'avm/eac_ubuntu_base0/apache' require 'eac_templates/core_ext' module Avm module EacWebappBase0 class ApacheHost JOBS = %w[write_available_no_ssl_site enable_no_ssl_site remove_ssl_site reload_apache run_certbot enable_ssl_site reload_apache].freeze include ::Avm::Jobs::Base def no_ssl_site_content ::Avm::EacWebappBase0::ApacheHost .template.child('no_ssl.conf') .apply(variables_source) end def ssl? options[:certbot] end private def apache_uncached ::Avm::EacUbuntuBase0::Apache.new(instance.host_env) end def enable_no_ssl_site infom 'Enabling no SSL site...' no_ssl_site.enable end def enable_ssl_site return unless ssl? infom 'Enabling SSL site...' ssl_site.enable end def no_ssl_site_uncached apache.site(instance.id) end def reload_apache infom 'Reloading Apache...' apache.service('reload') end def remove_ssl_site infom 'Removing SSL site...' ssl_site.remove end def run_certbot return unless ssl? infom 'Running Certbot...' instance.host_env.command( 'sudo', 'certbot', '--apache', '--domain', instance.read_entry('web.hostname'), '--redirect', '--non-interactive', '--agree-tos', '--email', instance.read_entry('admin.email') ).system! end def ssl_site_uncached apache.site(no_ssl_site.name + '-le-ssl') end def write_available_no_ssl_site infom 'Writing no SSL site conf...' no_ssl_site.write(no_ssl_site_content) end end end end
Version data entries
48 entries across 48 versions & 3 rubygems