Skip to content

Commit

Permalink
Add puma example.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Dec 22, 2024
1 parent 61f2688 commit c9150df
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/puma/application.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions examples/puma/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
run do |env|
[200, {"content-type" => "text/plain"}, ["Hello World"]]
end
39 changes: 39 additions & 0 deletions examples/puma/gems.locked
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions examples/puma/gems.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "async-container", path: "../.."

gem "puma"
gem "rack", "~> 3"
6 changes: 6 additions & 0 deletions examples/puma/puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
on_booted do
require "async/container/notify"

notify = Async::Container::Notify.open!
notify.ready!
end

0 comments on commit c9150df

Please sign in to comment.