class WcoHosting::Serverhost
def add_docker_service app
def add_docker_service app @obj = app Wco::Log.puts! nil, '#add_docker_service', obj: @obj ac = ActionController::Base.new ac.instance_variable_set( :@app, app ) ac.instance_variable_set( :@workdir, WORKDIR ) # rendered_str = ac.render_to_string("wco_hosting/docker-compose/dc-#{app.tmpl.kind}") rendered_str = ac.render_to_string("wco_hosting/docker-compose/dc-any") Wco::Log.puts! rendered_str, 'add_docker_service rendered_str', obj: @obj file = Tempfile.new('prefix') file.write rendered_str file.close # puts! file.path, 'file.path' cmd = "scp #{file.path} #{ssh_host}:#{WORKDIR}/dc-#{app.service_name}.yml " do_exec cmd cmd = "ssh #{ssh_host} 'cd #{WORKDIR} ; \ docker compose -f dc-#{app.service_name}.yml up -d #{app.service_name} ; \ echo ok #add_docker_service ' " do_exec cmd end