Sha256: 79797055a7b294737a1924ee02121a42818b1a8219182c5a2d844c573aebb52e

Contents?: true

Size: 1021 Bytes

Versions: 1

Compression:

Stored size: 1021 Bytes

Contents

namespace :api do
  desc 'Create proxy configuration file.'
  task :create_proxy_config => :environment do |t,args|
    base_dir = Dir.getwd
    filename = "./tmp/proxy.conf"

    config_file = ERB.new File.new("./app/api/proxy_nginx.conf", "r").read
    File.open(filename, "w+") { |f| f.write(config_file.result(binding)) }

    puts "Created new proxy configuration file: '#{filename}'."
  end

  desc 'Start proxy server'
  task :start_proxy => :environment do |t,args|
    exec "sudo -u #{DcmgrGui::Application.config.proxy_root_user} nginx -c #{Dir.getwd}/tmp/proxy.conf"

    puts "Nginx proxy server up and running."
  end

  desc 'Stop proxy server'
  task :stop_proxy => :environment do |t,args|
    exec "sudo -u #{DcmgrGui::Application.config.proxy_root_user} nginx -s stop -c #{Dir.getwd}/tmp/proxy.conf"

    puts "Nginx proxy server shut down."
  end
  
  task :start_auth => :environment do |t,args|
    exec "rackup -o localhost -p 8081 config-api.ru"
    
    puts "Auth server up and runing"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wakame-vdc-webui-10.12.0 lib/tasks/dcmgr_api.rake