-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require "console" | ||
require "async/container/notify" | ||
|
||
# Console.logger.debug! | ||
|
||
class Jobs | ||
LOG_FILE = File.join(Dir.pwd, "jobs.log") | ||
|
||
def self.start = self.new.start | ||
|
||
def start | ||
Console.debug(self, "Starting jobs...") | ||
|
||
if notify = Async::Container::Notify.open! | ||
Console.info(self, "Notifying container ready...") | ||
notify.ready! | ||
end | ||
|
||
loop do | ||
Console.info(self, "Jobs running...") | ||
|
||
sleep 1 | ||
end | ||
rescue Interrupt | ||
Console.debug(self, "Exiting jobs...") | ||
exit | ||
end | ||
end | ||
|
||
Jobs.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require "async/container" | ||
require "console" | ||
|
||
# Console.logger.debug! | ||
|
||
class AppController < Async::Container::Controller | ||
def setup(container) | ||
container.spawn(name: "Web") do |instance| | ||
# Specify ready: false here as the child process is expected to take care of the readiness notification: | ||
instance.exec("bundle", "exec", "web", ready: false) | ||
end | ||
|
||
container.spawn(name: "Jobs") do |instance| | ||
instance.exec("bundle", "exec", "jobs", ready: false) | ||
end | ||
end | ||
end | ||
|
||
controller = AppController.new | ||
|
||
controller.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require "console" | ||
require "async/container/notify" | ||
|
||
# Console.logger.debug! | ||
|
||
class Web | ||
LOG_FILE = File.join(Dir.pwd, "web.log") | ||
|
||
def self.start = self.new.start | ||
|
||
def start | ||
Console.debug(self, "Starting web...") | ||
|
||
if notify = Async::Container::Notify.open! | ||
Console.info(self, "Notifying container ready...") | ||
notify.ready! | ||
end | ||
|
||
loop do | ||
Console.info(self, "Web running...") | ||
|
||
sleep 1 | ||
end | ||
rescue Interrupt | ||
Console.debug(self, "Exiting web...") | ||
exit | ||
end | ||
end | ||
|
||
Web.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters