class EzPaaS::Server::Routes::Deployments
Private Instance Methods
app_not_found()
click to toggle source
# File lib/ezpaas/server/routes/deployments.rb, line 130 def app_not_found content_type :json halt [404, { error: 'app not found' }.to_json] end
ensure_app()
click to toggle source
# File lib/ezpaas/server/routes/deployments.rb, line 81 def ensure_app app_name = request.params['app'] if app_name.nil? app_not_found end app_slug = app_name.to_slug app = Models::App.where(name: app_slug).first if app.nil? app_not_found end @app = app end
open_message_stream() { |emitter| ... }
click to toggle source
# File lib/ezpaas/server/routes/deployments.rb, line 99 def open_message_stream sse_stream do |out| begin emitter = Emittr::Emitter.new emitter.on :message do |message| out.push :event => 'message', :data => message end yield emitter rescue Exception => ex raise ensure out.close end end end
redeploy(emitter)
click to toggle source
# File lib/ezpaas/server/routes/deployments.rb, line 117 def redeploy(emitter) manager = Helpers::ContainerManager.new scale_strings = @app.scale.map { |k, v| "#{k}: #{v}" } emitter.emit :message, "-----> App scaled to: #{scale_strings.join(', ')}" emitter.emit :message, '-----> Deploying application' manager.undeploy_app(@app.name, emitter) manager.deploy_app(@app.name, @app.slug, @app.scale, emitter) emitter.emit :message, '-----> Application deployed' end