From c9150df5618d8d59377e14eaea24e98ad972d36b Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sun, 22 Dec 2024 16:53:39 +1300 Subject: [PATCH] Add puma example. --- examples/puma/application.rb | 17 ++++++++++++++++ examples/puma/config.ru | 3 +++ examples/puma/gems.locked | 39 ++++++++++++++++++++++++++++++++++++ examples/puma/gems.rb | 6 ++++++ examples/puma/puma.rb | 6 ++++++ 5 files changed, 71 insertions(+) create mode 100755 examples/puma/application.rb create mode 100644 examples/puma/config.ru create mode 100644 examples/puma/gems.locked create mode 100644 examples/puma/gems.rb create mode 100644 examples/puma/puma.rb diff --git a/examples/puma/application.rb b/examples/puma/application.rb new file mode 100755 index 0000000..44f28b7 --- /dev/null +++ b/examples/puma/application.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "async/container" +require "console" + +# Console.logger.debug! + +class Application < Async::Container::Controller + def setup(container) + container.spawn(name: "Web") do |instance| + instance.exec("bundle", "exec", "puma", "-C", "puma.rb", ready: false) + end + end +end + +Application.new.run diff --git a/examples/puma/config.ru b/examples/puma/config.ru new file mode 100644 index 0000000..8440fb6 --- /dev/null +++ b/examples/puma/config.ru @@ -0,0 +1,3 @@ +run do |env| + [200, {"content-type" => "text/plain"}, ["Hello World"]] +end diff --git a/examples/puma/gems.locked b/examples/puma/gems.locked new file mode 100644 index 0000000..f874949 --- /dev/null +++ b/examples/puma/gems.locked @@ -0,0 +1,39 @@ +PATH + remote: ../.. + specs: + async-container (0.18.3) + async (~> 2.10) + +GEM + remote: https://rubygems.org/ + specs: + async (2.21.1) + console (~> 1.29) + fiber-annotation + io-event (~> 1.6, >= 1.6.5) + console (1.29.2) + fiber-annotation + fiber-local (~> 1.1) + json + fiber-annotation (0.2.0) + fiber-local (1.1.0) + fiber-storage + fiber-storage (1.0.0) + io-event (1.7.5) + json (2.9.1) + nio4r (2.7.4) + puma (6.5.0) + nio4r (~> 2.0) + rack (3.1.8) + +PLATFORMS + ruby + x86_64-linux + +DEPENDENCIES + async-container! + puma + rack (~> 3) + +BUNDLED WITH + 2.5.22 diff --git a/examples/puma/gems.rb b/examples/puma/gems.rb new file mode 100644 index 0000000..585bdcd --- /dev/null +++ b/examples/puma/gems.rb @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "async-container", path: "../.." + +gem "puma" +gem "rack", "~> 3" diff --git a/examples/puma/puma.rb b/examples/puma/puma.rb new file mode 100644 index 0000000..2d12df3 --- /dev/null +++ b/examples/puma/puma.rb @@ -0,0 +1,6 @@ +on_booted do + require "async/container/notify" + + notify = Async::Container::Notify.open! + notify.ready! +end