puma-daemon 0.1.2 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +3 -7
- data/.gitignore +2 -0
- data/CHANGELOG.md +36 -0
- data/{Gemfile → Gemfile.puma-v5} +2 -0
- data/Gemfile.puma-v6 +15 -0
- data/Makefile +20 -0
- data/README.adoc +80 -49
- data/Rakefile +1 -1
- data/bin/console +1 -1
- data/example/cluster.sh +61 -0
- data/example/config.ru +3 -0
- data/example/puma.rb +76 -0
- data/example/single.sh +64 -0
- data/exe/pumad +4 -0
- data/lib/puma/daemon/cli.rb +4 -2
- data/lib/puma/daemon/configuration.rb +4 -0
- data/lib/puma/daemon/runner_adapter.rb +37 -0
- data/lib/puma/daemon/version.rb +1 -1
- data/lib/puma/daemon.rb +4 -3
- data/puma-daemon.gemspec +4 -3
- metadata +14 -9
- data/lib/puma/daemon/runner.rb +0 -30
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8bae578ae5bec9d82e347cbc82bdf97ef49a094b72c525930b584feab2dbfd63
         | 
| 4 | 
            +
              data.tar.gz: '09ea3be6ec46d05ad27e60539699ab84234e9f2c51c354ee6ba0d8897a553a28'
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b541e8dcee17f59c37f13cae02ff999ce5cf589d65a11aaaf8c640c05c0b455d0caad6e30a71311bc0012c41642170499eac9d761862f2f0c0799d1c32572bb8
         | 
| 7 | 
            +
              data.tar.gz: 054d3b730d753e07a0b638f3e8678e2aee72a3e2bd26ec717e01c515c282ca2367fd60ad24f1823853cc001b3ed0fb6e65fd9d3ef649078f72aa61c41df1cbea
         | 
    
        data/.github/workflows/main.yml
    CHANGED
    
    | @@ -7,7 +7,7 @@ jobs: | |
| 7 7 | 
             
                runs-on: ubuntu-latest
         | 
| 8 8 | 
             
                strategy:
         | 
| 9 9 | 
             
                  matrix:
         | 
| 10 | 
            -
                    ruby-version: [3.0.0, 2.7.2, 2.6.6, 2.5.7]
         | 
| 10 | 
            +
                    ruby-version: [3.2.0, 3.1.3, 3.0.5, 2.7.2, 2.6.6, 2.5.7]
         | 
| 11 11 |  | 
| 12 12 | 
             
                steps:
         | 
| 13 13 | 
             
                - uses: actions/checkout@v2
         | 
| @@ -15,12 +15,8 @@ jobs: | |
| 15 15 | 
             
                  uses: ruby/setup-ruby@v1
         | 
| 16 16 | 
             
                  with:
         | 
| 17 17 | 
             
                    ruby-version: ${{ matrix.ruby-version }}
         | 
| 18 | 
            -
                - name:  | 
| 19 | 
            -
                  run:  | 
| 20 | 
            -
                - name: Run RSpecs
         | 
| 21 | 
            -
                  run: bundle exec rspec --color
         | 
| 22 | 
            -
                - name: Run Rubocop
         | 
| 23 | 
            -
                  run: bundle exec rubocop
         | 
| 18 | 
            +
                - name: Run Specs
         | 
| 19 | 
            +
                  run: make test-all
         | 
| 24 20 | 
             
                - name: Upload Code Coverage
         | 
| 25 21 | 
             
                  run: bash <(curl -s https://codecov.io/bash)
         | 
| 26 22 |  | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,41 @@ | |
| 1 1 | 
             
            # Changelog
         | 
| 2 2 |  | 
| 3 | 
            +
            ## [v0.2.1](https://github.com/kigster/puma-daemon/tree/v0.2.1) (2023-03-07)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            [Full Changelog](https://github.com/kigster/puma-daemon/compare/v0.2.0...v0.2.1)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            **Fixed bugs:**
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            - pumad doesn't work with puma v6 [\#10](https://github.com/kigster/puma-daemon/issues/10)
         | 
| 10 | 
            +
            - doesn't daemonize [\#9](https://github.com/kigster/puma-daemon/issues/9)
         | 
| 11 | 
            +
            - Log is not working [\#8](https://github.com/kigster/puma-daemon/issues/8)
         | 
| 12 | 
            +
            - Currently breaks in a single \(non-cluster\) mode [\#1](https://github.com/kigster/puma-daemon/issues/1)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            **Merged pull requests:**
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            - Hopefully fixing demonization for Puma v5 and v6 [\#11](https://github.com/kigster/puma-daemon/pull/11) ([kigster](https://github.com/kigster))
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            ## [v0.2.0](https://github.com/kigster/puma-daemon/tree/v0.2.0) (2023-03-07)
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            [Full Changelog](https://github.com/kigster/puma-daemon/compare/v0.1.2...v0.2.0)
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            **Merged pull requests:**
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            - Fix README spelling [\#7](https://github.com/kigster/puma-daemon/pull/7) ([lulalala](https://github.com/lulalala))
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            ## [v0.1.2](https://github.com/kigster/puma-daemon/tree/v0.1.2) (2021-03-05)
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            [Full Changelog](https://github.com/kigster/puma-daemon/compare/v0.1.1...v0.1.2)
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            **Fixed bugs:**
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            - uninitialized constant Puma::HAS\_SSL \(NameError\) [\#3](https://github.com/kigster/puma-daemon/issues/3)
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            **Merged pull requests:**
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            - Hoping to fix HAS\_SSL error [\#5](https://github.com/kigster/puma-daemon/pull/5) ([kigster](https://github.com/kigster))
         | 
| 37 | 
            +
            - Adding dockerfiles for testing Puma on Linux [\#2](https://github.com/kigster/puma-daemon/pull/2) ([kigster](https://github.com/kigster))
         | 
| 38 | 
            +
             | 
| 3 39 | 
             
            ## [v0.1.1](https://github.com/kigster/puma-daemon/tree/v0.1.1) (2021-01-24)
         | 
| 4 40 |  | 
| 5 41 | 
             
            [Full Changelog](https://github.com/kigster/puma-daemon/compare/v0.1.0...v0.1.1)
         | 
    
        data/{Gemfile → Gemfile.puma-v5}
    RENAMED
    
    
    
        data/Gemfile.puma-v6
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            source 'https://rubygems.org'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # Specify your gem's dependencies in puma-daemon.gemspec
         | 
| 6 | 
            +
            gemspec
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            gem 'puma', '~> 6.0'
         | 
| 9 | 
            +
            gem 'rake', '~> 13.0'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            group :test do
         | 
| 12 | 
            +
              gem 'codecov', require: false
         | 
| 13 | 
            +
              gem 'rspec', '~> 3.0'
         | 
| 14 | 
            +
              gem 'rubocop', '~> 0.80'
         | 
| 15 | 
            +
            end
         | 
    
        data/Makefile
    CHANGED
    
    | @@ -16,6 +16,23 @@ PUMAD_HOME			:= $(shell dirname $(MAKEFILE_PATH)) | |
| 16 16 | 
             
            help:	   			## Prints help message auto-generated from the comments.
         | 
| 17 17 | 
             
            				@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
         | 
| 18 18 |  | 
| 19 | 
            +
            puma-v5: 			## Installs puma 5.0.0
         | 
| 20 | 
            +
            				@ln -nfs Gemfile.puma-v5 Gemfile
         | 
| 21 | 
            +
            				@bundle install
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            puma-v6: 			## Installs puma 5.0.0
         | 
| 24 | 
            +
            				@ln -nfs Gemfile.puma-v6 Gemfile
         | 
| 25 | 
            +
            				@bundle install
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            test:				## Runs the test suite
         | 
| 28 | 
            +
            				@bundle exec rspec
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            test-all:			## Test all supported Puma Versions
         | 
| 31 | 
            +
            				make puma-v5
         | 
| 32 | 
            +
            				make test
         | 
| 33 | 
            +
            				make puma-v6
         | 
| 34 | 
            +
            				make test
         | 
| 35 | 
            +
            				
         | 
| 19 36 | 
             
            docker-build-ruby:		## Builds the Docker image by compiling ruby 3.0.0
         | 
| 20 37 | 
             
            				@docker build -f Dockerfile.build    -t puma-daemon:latest .
         | 
| 21 38 |  | 
| @@ -28,4 +45,7 @@ docker-build-run: 		docker-build-ruby ## Drops you into a BASH session on ubuntu | |
| 28 45 | 
             
            docker-download-run: 		docker-download-ruby ## Drops you into a BASH session on ubuntu with ruby 3.0.0
         | 
| 29 46 | 
             
            				@docker run -it puma-daemon:latest
         | 
| 30 47 |  | 
| 48 | 
            +
             | 
| 49 | 
            +
            clean:				## Clean-up
         | 
| 50 | 
            +
            				@rm -rf Gemfile Gemfile.lock coverage 
         | 
| 31 51 |  | 
    
        data/README.adoc
    CHANGED
    
    | @@ -4,37 +4,48 @@ | |
| 4 4 | 
             
            :sectnums:
         | 
| 5 5 | 
             
            :icons: font
         | 
| 6 6 |  | 
| 7 | 
            -
            image:https://github.com/kigster/puma-daemon/workflows/Ruby/badge.svg[link=https://github.com/kigster/puma-daemon/actions?query=workflow%3ARuby]  | 
| 7 | 
            +
            image:https://github.com/kigster/puma-daemon/workflows/Ruby/badge.svg[link=https://github.com/kigster/puma-daemon/actions?query=workflow%3ARuby] 
         | 
| 8 | 
            +
            image:https://codecov.io/gh/kigster/puma-daemon/branch/master/graph/badge.svg?token=asxarMSGbz[link=https://codecov.io/gh/kigster/puma-daemon]
         | 
| 9 | 
            +
            image:https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkigster%2Fpuma-daemon.svg?type=shield[link=https://app.fossa.com/projects/git%2Bgithub.com%2Fkigster%2Fpuma-daemon?ref=badge_shield]
         | 
| 10 | 
            +
            image:https://badge.fury.io/rb/puma-daemon.svg["Gem Version", link="https://badge.fury.io/rb/puma-daemon"]
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            image:https://codecov.io/gh/kigster/puma-daemon/commit/9ebd665764786a9815b159b699087148e19e671a/graphs/sunburst.svg[sunbirst]
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            == Motivation
         | 
| 8 15 |  | 
| 9 16 | 
             
            In version 5.0 of the popular Ruby HTTP server https://github.com/puma/puma[Puma] the developers chose to https://github.com/puma/puma/pull/2170/files[drop the daemonization] support from Puma. They did that because the code wasn't actively maintained. Other and perhaps better options now exist (such as `systemd`, etc), not to mention that many people have switched to Kubernetes and Docker, where you generally want to start all servers in the foreground.
         | 
| 10 17 |  | 
| 11 | 
            -
            And yet, on occasion, it was rather useful and straightforward to use the built-in daemonization feature that was cross-platform and is now gone. Some folks are still using this feature and are therefore stuck with Puma version 4, or must wrap Puma either in the `systemd` manifest or `launchctl plist` on Mac OS-X, or a Docker container. Well, **not anymore!** | 
| 18 | 
            +
            And yet, on occasion, it was rather useful and straightforward to use the built-in daemonization feature that was cross-platform and is now gone. Some folks are still using this feature and are therefore stuck with Puma version 4, or must wrap Puma either in the `systemd` manifest or `launchctl plist` on Mac OS-X, or a Docker container. Well, **not anymore!**
         | 
| 12 19 |  | 
| 13 20 | 
             
            NOTE: Add this gem to your dependencies, and make a one line change either in your `config/puma.rb` file, or use `pumad` binary to start Puma as per usual, and you can even leave `-d` flags there (they are ignored when started via `pumad`, and Puma always goes to the background when started that way).
         | 
| 14 21 |  | 
| 15 | 
            -
            One of the nice features of the old daemonization functionality was that it worked across all platforms. | 
| 22 | 
            +
            One of the nice features of the old daemonization functionality was that it worked across all platforms.
         | 
| 16 23 |  | 
| 17 24 | 
             
            So, if you want to use the latest and greatest Puma 5+, but have it self-daemonize, this gem is for you.
         | 
| 18 25 |  | 
| 19 | 
            -
            ==  | 
| 26 | 
            +
            == Compatibility
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            === Ruby Versions
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            We did not restore the daemon functionality for JRuby; so at the moment this will work with the MRI distribution, and possibly others that support https://ruby-doc.org/core-2.6.1/Process.html#method-c-daemon[`Process.daemon(true, true)`].
         | 
| 20 31 |  | 
| 21 | 
            -
             | 
| 32 | 
            +
            For supported MRI Ruby Versions see the https://github.com/kigster/puma-daemon/blob/master/.github/workflows/main.yml#L10[Github Workflow] file.
         | 
| 22 33 |  | 
| 23 | 
            -
             | 
| 34 | 
            +
            === Puma Versions
         | 
| 24 35 |  | 
| 25 | 
            -
              | 
| 26 | 
            -
             * MRI Ruby 2.7.2
         | 
| 27 | 
            -
             * MRI Ruby 2.6.6
         | 
| 28 | 
            -
             * MRI Ruby 2.5.7
         | 
| 36 | 
            +
            Currently Puma versions 5 and 6 are supported.
         | 
| 29 37 |  | 
| 38 | 
            +
            === Known Issues
         | 
| 30 39 |  | 
| 31 | 
            -
             | 
| 40 | 
            +
            Please see the list of open issues on the https://github.com/kigster/puma-daemon/issues[Issues Page]. Any help is always welcomed.
         | 
| 32 41 |  | 
| 33 | 
            -
             | 
| 42 | 
            +
            == Design Decisions
         | 
| 34 43 |  | 
| 35 | 
            -
             | 
| 44 | 
            +
            This gem's goal was to surgically augment Puma's source code to restore daemonization by merely requiring `puma/daemon`.
         | 
| 36 45 |  | 
| 37 | 
            -
             | 
| 46 | 
            +
            We accomplished this goal by adding the daemonization call to the routine `output_header()` which is invoked by both `Puma::Single` runner and the `Puma::Cluster` runner at the very beginning of the launch process. While relatively brittle, particularly if the future versions of Puma change this, this approach seems to work with the currently released version of Puma (5 and 6).
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            If you run into problems, please https://github.com/kigster/puma-daemon/issues/new[submit an issue].
         | 
| 38 49 |  | 
| 39 50 | 
             
            == Installation
         | 
| 40 51 |  | 
| @@ -43,23 +54,43 @@ Add this line to your application's Gemfile: | |
| 43 54 | 
             
            [source,ruby]
         | 
| 44 55 | 
             
            ----
         | 
| 45 56 | 
             
            gem 'puma-daemon', require: false
         | 
| 46 | 
            -
            gem 'puma',  '~> 5'
         | 
| 57 | 
            +
            gem 'puma',  '~> 5' # or 6
         | 
| 58 | 
            +
            ----
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            In your `config/puma.rb`, eg.
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            [source,ruby]
         | 
| 63 | 
            +
            ----
         | 
| 64 | 
            +
            require 'puma/daemon'
         | 
| 65 | 
            +
            bind 'tcp://0.0.0.0:3000'
         | 
| 66 | 
            +
            workers 2
         | 
| 67 | 
            +
            threads 4
         | 
| 68 | 
            +
            daemonize
         | 
| 47 69 | 
             
            ----
         | 
| 48 70 |  | 
| 49 71 | 
             
            And then execute:
         | 
| 50 72 |  | 
| 51 73 | 
             
             $ bundle install
         | 
| 74 | 
            +
             $ bundle exec puma -C config/puma.rb
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            Make sure you have `config.ru` Rackup file in the current folder. Checkout the shell script inside the `example` folder for more info.
         | 
| 52 77 |  | 
| 53 78 | 
             
            == Usage
         | 
| 54 79 |  | 
| 55 80 | 
             
            There were two ways you could daemonize Puma in the past:
         | 
| 56 81 |  | 
| 57 82 | 
             
             1. By specifying `daemonize` or `daemonize(true)` in your config file.
         | 
| 58 | 
            -
             2.  | 
| 83 | 
            +
             2. By specifying `-d` or `--daemonize` on the command line.
         | 
| 59 84 |  | 
| 60 | 
            -
             | 
| 85 | 
            +
            Both of these ways are supported, as long as you do `require 'puma/daemon'` in your puma config file, and — in the case of `-d` flag, you pass it to `pumad` executable, not `puma`.
         | 
| 61 86 |  | 
| 62 | 
            -
             | 
| 87 | 
            +
            The recommended way to daemonize is via the provided `pumad` executable, or via the require in `puma.rb` and a subsequent call to `daemonize()` method.
         | 
| 88 | 
            +
             | 
| 89 | 
            +
            Please note that you must include `puma-daemon` in your Gemfile, but you may specify it as `require: false` — it will only activate if you explicitly require it in your Puma config file.
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            === Examples
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            Please see the https://github.com/kigster/puma-daemon/tree/master/example[`example`] directory in the source of the gem. It contains `single.sh` and `cluster.sh` scripts that boot Puma via `pumad` binary.
         | 
| 63 94 |  | 
| 64 95 | 
             
            === Daemonizing via the Config File
         | 
| 65 96 |  | 
| @@ -74,7 +105,7 @@ port 3001 | |
| 74 105 | 
             
            workers 3
         | 
| 75 106 | 
             
            threads 2,3
         | 
| 76 107 | 
             
            # accepts true or false, and if false is passed will NOT daemonize
         | 
| 77 | 
            -
            daemonize | 
| 108 | 
            +
            daemonize
         | 
| 78 109 | 
             
            ----
         | 
| 79 110 |  | 
| 80 111 | 
             
            With this method you can continue using the standard `puma` executable to get it started, but (and this is important) — **you must remove any `-d` or `--daemonize` from the command line**, or Puma v5 and above will fail with an error.
         | 
| @@ -83,19 +114,21 @@ Here is an example of daemonizing via the config file shown above, and using the | |
| 83 114 |  | 
| 84 115 | 
             
            [source,bash]
         | 
| 85 116 | 
             
            ----
         | 
| 86 | 
            -
            ❯  | 
| 87 | 
            -
            ❯ puma -C  | 
| 88 | 
            -
             | 
| 89 | 
            -
            [ | 
| 90 | 
            -
            [ | 
| 91 | 
            -
            [ | 
| 92 | 
            -
            [ | 
| 93 | 
            -
            [ | 
| 94 | 
            -
            [ | 
| 95 | 
            -
            [ | 
| 96 | 
            -
            [ | 
| 97 | 
            -
            [ | 
| 98 | 
            -
            [ | 
| 117 | 
            +
            ❯ cd example
         | 
| 118 | 
            +
            ❯ bundle exec puma -I ../lib -C $(pwd)/puma.rb -w 4 config.ru
         | 
| 119 | 
            +
            [62235] Puma starting in cluster mode...
         | 
| 120 | 
            +
            [62235] * Puma version: 6.1.1 (ruby 2.7.6-p219) ("The Way Up")
         | 
| 121 | 
            +
            [62235] *  Min threads: 0
         | 
| 122 | 
            +
            [62235] *  Max threads: 16
         | 
| 123 | 
            +
            [62235] *  Environment: development
         | 
| 124 | 
            +
            [62235] *   Master PID: 62235
         | 
| 125 | 
            +
            [62235] *  Puma Daemon: Daemonizing...
         | 
| 126 | 
            +
            [62235] *  Gem: puma-daemon v0.2.0
         | 
| 127 | 
            +
            [62235] *  Gem: puma v6.1.1
         | 
| 128 | 
            +
            [62258] *      Workers: 4
         | 
| 129 | 
            +
            [62258] *     Restarts: (✔) hot (✔) phased
         | 
| 130 | 
            +
            [62258] * Listening on unix:///tmp/puma.sock
         | 
| 131 | 
            +
            [62258] * Listening on http://0.0.0.0:9292
         | 
| 99 132 | 
             
            ----
         | 
| 100 133 |  | 
| 101 134 | 
             
            Note that using this method you can decide whether to daemonize or not by passing true or false to the `daemonize` method.
         | 
| @@ -106,32 +139,30 @@ If you prefer to make a decision whether to daemonize or not on the command line | |
| 106 139 |  | 
| 107 140 | 
             
            NOTE: We did not want to conflict with the `puma` gem by introducing another executable under the same name. The executable this gem provides is called `pumad` (where 'd' stands for daemon, and follows standard UNIX convention, as in eg `sshd`, `ftpd`, etc).
         | 
| 108 141 |  | 
| 109 | 
            -
            If you replace `puma` with `pumad | 
| 142 | 
            +
            If you replace `puma` with `pumad`, you no longer need to pass any additional command line flag (`-d` and `--daemonize`) to daemonize. You can continue passing them or you can remove them (these flags are stripped out before ARGV is passed onto Puma's CLI parser.)
         | 
| 110 143 |  | 
| 111 144 | 
             
            [source,bash]
         | 
| 112 145 | 
             
            ----
         | 
| 113 | 
            -
            ❯  | 
| 114 | 
            -
            ❯  | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
             | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 125 | 
            -
             | 
| 126 | 
            -
             | 
| 127 | 
            -
            [98795] *  Puma Daemon: Daemonizing (puma-daemon v0.1.1)...
         | 
| 146 | 
            +
            ❯ cd example
         | 
| 147 | 
            +
            ❯ ../exe/pumad -C $(pwd)/puma.rb -w 0 config.ru
         | 
| 148 | 
            +
             | 
| 149 | 
            +
            Puma starting in single mode...
         | 
| 150 | 
            +
            * Puma version: 6.1.1 (ruby 2.7.6-p219) ("The Way Up")
         | 
| 151 | 
            +
            *  Min threads: 0
         | 
| 152 | 
            +
            *  Max threads: 16
         | 
| 153 | 
            +
            *  Environment: development
         | 
| 154 | 
            +
            *          PID: 63179
         | 
| 155 | 
            +
            *  Puma Daemon: Daemonizing...
         | 
| 156 | 
            +
            *  Gem: puma-daemon v0.2.0
         | 
| 157 | 
            +
            *  Gem: puma v6.1.1
         | 
| 158 | 
            +
            * Listening on unix:///tmp/puma.sock
         | 
| 159 | 
            +
            * Listening on http://0.0.0.0:9292
         | 
| 128 160 | 
             
            ----
         | 
| 129 161 |  | 
| 130 162 | 
             
            As you can see, at the end it says "Daemonizing".
         | 
| 131 163 |  | 
| 132 164 | 
             
            If you start puma this way, you can still specify `daemonize(false)` in the configuration file to turn it off, but the default is to daemonize. Also, if you start with `pumad` you do not need to include `require 'puma/daemon'` in your configuration file, as the `pumad` binary loads all dependencies prior to parsing the config.
         | 
| 133 165 |  | 
| 134 | 
            -
             | 
| 135 166 | 
             
            == Development
         | 
| 136 167 |  | 
| 137 168 | 
             
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -26,7 +26,7 @@ end | |
| 26 26 | 
             
            task build: :permissions
         | 
| 27 27 |  | 
| 28 28 | 
             
            YARD::Rake::YardocTask.new(:doc) do |t|
         | 
| 29 | 
            -
              t.files = %w[lib/**/*.rb exe | 
| 29 | 
            +
              t.files = %w[lib/**/*.rb exe/* - README.adoc CHANGELOG.md LICENSE.txt]
         | 
| 30 30 | 
             
              t.options.unshift('--title', '"Puma Daemon"')
         | 
| 31 31 | 
             
              t.after = -> { exec('open doc/index.html') }
         | 
| 32 32 | 
             
            end
         | 
    
        data/bin/console
    CHANGED
    
    | @@ -7,7 +7,7 @@ require 'puma/daemon' | |
| 7 7 | 
             
            # You can add fixtures and/or initialization code here to make experimenting
         | 
| 8 8 | 
             
            # with your gem easier. You can also use a different console, if you like.
         | 
| 9 9 |  | 
| 10 | 
            -
            # (If you use this, don't forget to add pry to your Gemfile!)
         | 
| 10 | 
            +
            # (If you use this, don't forget to add pry to your Gemfile.puma-v5!)
         | 
| 11 11 | 
             
            # require "pry"
         | 
| 12 12 | 
             
            # Pry.start
         | 
| 13 13 |  | 
    
        data/example/cluster.sh
    ADDED
    
    | @@ -0,0 +1,61 @@ | |
| 1 | 
            +
            #!/usr/bin/env bash
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            export txtblk='\e[0;30m'
         | 
| 4 | 
            +
            export txtred='\e[0;31m'
         | 
| 5 | 
            +
            export txtgrn='\e[0;32m'
         | 
| 6 | 
            +
            export txtylw='\e[0;33m'
         | 
| 7 | 
            +
            export txtblu='\e[0;34m'
         | 
| 8 | 
            +
            export txtpur='\e[0;35m'
         | 
| 9 | 
            +
            export txtcyn='\e[0;36m'
         | 
| 10 | 
            +
            export txtwht='\e[0;37m'
         | 
| 11 | 
            +
            export clr='\e[0;0m'
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            [[ -f cluster.sh ]] || {
         | 
| 14 | 
            +
              echo -e "${txtred}Please run this from the ./example folder.${clr}"
         | 
| 15 | 
            +
              exit 1
         | 
| 16 | 
            +
            }
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            [[ -f ../Gemfile ]] || {
         | 
| 19 | 
            +
              echo -e "${txtred}Please choose either Puma v5 or Puma v6, by running:${clr}"
         | 
| 20 | 
            +
              echo -e "${txtgrn}make puma-v5 or make puma-v6"
         | 
| 21 | 
            +
              exit 2
         | 
| 22 | 
            +
            }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            echo -e "${txtblu}Ensuring your dependencies are installed...${clr}"
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            ( 
         | 
| 27 | 
            +
              cd .. || exit 2;
         | 
| 28 | 
            +
              bundle check || bundle install
         | 
| 29 | 
            +
            ) >/dev/null
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            pid=$(ps -ef | grep puma | grep example | awk '{print $2}')
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            [[ -n $pid ]] && kill $pid && sleep 1
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            echo -e "${txtblu}Starting Puma in cluster mode.${clr}"
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            command="bundle exec puma -I ../lib -C $(pwd)/puma.rb -w 4"
         | 
| 38 | 
            +
            echo -e "${txtblu}Running Command:"
         | 
| 39 | 
            +
            echo -e "${txtgrn}${command}${clr}"
         | 
| 40 | 
            +
            eval "${command}"
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            echo -e "${txtblu}Verifying Puma is running...${clr}"
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            sleep 0.5
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            output=$(mktemp)
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            set -e
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            curl http://0.0.0.0:9292/ > "${output}" 2>/dev/null
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            [[ $(cat ${output}) == "Hello World" ]] || {
         | 
| 53 | 
            +
              echo -e "${txtred}Invalid response:${clr}">&2
         | 
| 54 | 
            +
              cat ${output}
         | 
| 55 | 
            +
              exit 3
         | 
| 56 | 
            +
            }
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            echo -e "${txtgrn}Puma Daemon is running and returning the expected string.${clr}"
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            ps -ef | grep [p]uma
         | 
| 61 | 
            +
             | 
    
        data/example/config.ru
    ADDED
    
    
    
        data/example/puma.rb
    ADDED
    
    | @@ -0,0 +1,76 @@ | |
| 1 | 
            +
            require 'puma/daemon'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # The directory to operate out of.
         | 
| 4 | 
            +
            # The default is the current directory.
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            # The default is “development”.
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            environment 'development'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            # Store the pid of the server in the file at “path”.
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            pidfile '/tmp/puma.pid'
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            # Use “path” as the file to store the server info state. This is
         | 
| 15 | 
            +
            # used by “pumactl” to query and control the server.
         | 
| 16 | 
            +
            state_path '/tmp/puma.state'
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            # Redirect STDOUT and STDERR to files specified. The 3rd parameter
         | 
| 19 | 
            +
            # (“append”) specifies whether the output is appended, the default is
         | 
| 20 | 
            +
            # “false”.
         | 
| 21 | 
            +
            stdout_redirect '/tmp/puma_access.log', '/tmp/puma_error.log', true
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            quiet
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            threads 0, 16
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            # Bind the server to “url”. “tcp://”, “unix://” and “ssl://” are the only
         | 
| 28 | 
            +
            # accepted protocols.
         | 
| 29 | 
            +
            # The default is “tcp://0.0.0.0:9292”.
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            bind 'unix:///tmp/puma.sock'
         | 
| 32 | 
            +
            bind 'tcp://0.0.0.0:9292'
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            # Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you
         | 
| 35 | 
            +
            # can also use the “ssl_bind” option.
         | 
| 36 | 
            +
             | 
| 37 | 
            +
             # ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            # Code to run before doing a restart. This code should
         | 
| 40 | 
            +
            # close log files, database connections, etc.
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            # This can be called multiple times to add code each time.
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            on_restart do
         | 
| 45 | 
            +
              puts 'On restart...'
         | 
| 46 | 
            +
            end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            # Command to use to restart puma. This should be just how to
         | 
| 49 | 
            +
            # load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments
         | 
| 50 | 
            +
            # to puma, as those are the same as the original process.
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            # === Cluster mode ===
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            # How many worker processes to run.
         | 
| 55 | 
            +
            # The default is “0”.
         | 
| 56 | 
            +
             | 
| 57 | 
            +
            workers 2
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            # Code to run when a worker boots to setup the process before booting
         | 
| 60 | 
            +
            # the app.
         | 
| 61 | 
            +
            # This can be called multiple times to add hooks.
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            # === Puma control rack application ===
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            # Start the puma control rack application on “url”. This application can
         | 
| 66 | 
            +
            # be communicated with to control the main server. Additionally, you can
         | 
| 67 | 
            +
            # provide an authentication token, so all requests to the control server
         | 
| 68 | 
            +
            # will need to include that token as a query parameter. This allows for
         | 
| 69 | 
            +
            # simple authentication.
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            # Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb
         | 
| 72 | 
            +
            # to see what the app has available.
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            #activate_control_app 'unix:///var/run/pumactl.sock'
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            daemonize
         | 
    
        data/example/single.sh
    ADDED
    
    | @@ -0,0 +1,64 @@ | |
| 1 | 
            +
            #!/usr/bin/env bash
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            export txtblk='\e[0;30m'
         | 
| 4 | 
            +
            export txtred='\e[0;31m'
         | 
| 5 | 
            +
            export txtgrn='\e[0;32m'
         | 
| 6 | 
            +
            export txtylw='\e[0;33m'
         | 
| 7 | 
            +
            export txtblu='\e[0;34m'
         | 
| 8 | 
            +
            export txtpur='\e[0;35m'
         | 
| 9 | 
            +
            export txtcyn='\e[0;36m'
         | 
| 10 | 
            +
            export txtwht='\e[0;37m'
         | 
| 11 | 
            +
            export clr='\e[0;0m'
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            [[ -f single.sh ]] || {
         | 
| 14 | 
            +
              echo -e "${txtred}Please run this from the ./example folder.${clr}"
         | 
| 15 | 
            +
              exit 1
         | 
| 16 | 
            +
            }
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            [[ -f ../Gemfile ]] || {
         | 
| 19 | 
            +
              echo -e "${txtred}Please choose either Puma v5 or Puma v6, by running:${clr}"
         | 
| 20 | 
            +
              echo -e "${txtgrn}make puma-v5 or make puma-v6${clr}"
         | 
| 21 | 
            +
              exit 2
         | 
| 22 | 
            +
            }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            echo -e "${txtblu}Ensuring your dependencies are installed...${clr}"
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            ( 
         | 
| 27 | 
            +
              cd .. || exit 2;
         | 
| 28 | 
            +
              bundle check || bundle install
         | 
| 29 | 
            +
            ) >/dev/null
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            [[ -d example ]] && cd example
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            pid=$(ps -ef | grep puma | grep example | awk '{print $2}')
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            [[ -n $pid ]] && kill $pid && sleep 1
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            echo -e "${txtblu}Starting Puma in Single mode.${clr}"
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            command="../exe/pumad -C $(pwd)/puma.rb -w 0"
         | 
| 40 | 
            +
            echo "Executing:"
         | 
| 41 | 
            +
            echo -e "${txtgrn}${command}${clr}"
         | 
| 42 | 
            +
            eval "${command}"
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            echo "Verifying Puma is running"
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            output=$(mktemp)
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            set -e
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            curl http://0.0.0.0:9292/ > "${output}" 2>/dev/null
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            [[ $(cat ${output}) == "Hello World" ]] || {
         | 
| 53 | 
            +
              echo -e "${txtred}Invalid response:${clr}">&2
         | 
| 54 | 
            +
              cat ${output}
         | 
| 55 | 
            +
              exit 3
         | 
| 56 | 
            +
            }
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            echo -e "${txtgrn}Puma Daemon is running and returning the expected string.${clr}"
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            ps -ef | grep [p]uma
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            echo
         | 
| 63 | 
            +
             | 
| 64 | 
            +
             | 
    
        data/exe/pumad
    CHANGED
    
    
    
        data/lib/puma/daemon/cli.rb
    CHANGED
    
    | @@ -1,13 +1,15 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            require_relative '../daemon'
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
            module Puma
         | 
| 4 6 | 
             
              module Daemon
         | 
| 5 7 | 
             
                class CLI
         | 
| 6 8 | 
             
                  attr_accessor :argv, :cli
         | 
| 7 9 |  | 
| 8 | 
            -
                  def initialize(argv = ARGV | 
| 10 | 
            +
                  def initialize(argv = ARGV)
         | 
| 9 11 | 
             
                    self.argv = argv
         | 
| 10 | 
            -
                    self.cli = ::Puma::CLI.new(argv | 
| 12 | 
            +
                    self.cli = ::Puma::CLI.new(argv)
         | 
| 11 13 | 
             
                  end
         | 
| 12 14 |  | 
| 13 15 | 
             
                  def run
         | 
| @@ -0,0 +1,37 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require_relative 'version'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module Puma
         | 
| 6 | 
            +
              module Daemon
         | 
| 7 | 
            +
                module RunnerAdapter
         | 
| 8 | 
            +
                  attr_reader :options
         | 
| 9 | 
            +
                  attr_accessor :has_demonized
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def output_header(mode)
         | 
| 12 | 
            +
                    super(mode)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    daemonize! if daemon?
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  def daemon?
         | 
| 18 | 
            +
                    options[:daemon]
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  def daemonize!
         | 
| 22 | 
            +
                    return if has_demonized
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                    log '*  Puma Daemon: Demonizing...'
         | 
| 25 | 
            +
                    log "*  Gem: puma-daemon v#{::Puma::Daemon::VERSION}"
         | 
| 26 | 
            +
                    log "*  Gem: puma v#{::Puma::Const::VERSION}"
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    Process.daemon(true, true)
         | 
| 29 | 
            +
                    self.has_demonized = true
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  def log(str)
         | 
| 33 | 
            +
                    super(str) unless str == 'Use Ctrl-C to stop'
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
            end
         | 
    
        data/lib/puma/daemon/version.rb
    CHANGED
    
    
    
        data/lib/puma/daemon.rb
    CHANGED
    
    | @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'puma'
         | 
| 4 | 
            +
            require 'puma/const'
         | 
| 4 5 | 
             
            require 'puma/runner'
         | 
| 5 6 | 
             
            require 'puma/single'
         | 
| 6 7 | 
             
            require 'puma/cluster'
         | 
| @@ -8,7 +9,7 @@ require 'puma/dsl' | |
| 8 9 | 
             
            require 'puma/cli'
         | 
| 9 10 |  | 
| 10 11 | 
             
            require 'puma/daemon/version'
         | 
| 11 | 
            -
            require 'puma/daemon/ | 
| 12 | 
            +
            require 'puma/daemon/runner_adapter'
         | 
| 12 13 | 
             
            require 'puma/daemon/configuration'
         | 
| 13 14 | 
             
            require 'puma/daemon/cli'
         | 
| 14 15 | 
             
            require 'puma/daemon/dsl'
         | 
| @@ -16,8 +17,8 @@ require 'puma/daemon/dsl' | |
| 16 17 | 
             
            module Puma
         | 
| 17 18 | 
             
              module Daemon
         | 
| 18 19 | 
             
                def self.daemonize!
         | 
| 19 | 
            -
                  ::Puma::Single.include(::Puma::Daemon:: | 
| 20 | 
            -
                  ::Puma::Cluster.include(::Puma::Daemon:: | 
| 20 | 
            +
                  ::Puma::Single.include(::Puma::Daemon::RunnerAdapter)
         | 
| 21 | 
            +
                  ::Puma::Cluster.include(::Puma::Daemon::RunnerAdapter)
         | 
| 21 22 | 
             
                  ::Puma::DSL.include(::Puma::Daemon::DSL)
         | 
| 22 23 | 
             
                  ::Puma::Configuration.prepend(::Puma::Daemon::Configuration)
         | 
| 23 24 | 
             
                  ::Puma::CLI.instance_eval { attr_reader :options }
         | 
    
        data/puma-daemon.gemspec
    CHANGED
    
    | @@ -26,20 +26,21 @@ Gem::Specification.new do |spec| | |
| 26 26 | 
             
                your config file.
         | 
| 27 27 | 
             
              DESCRIPTION
         | 
| 28 28 |  | 
| 29 | 
            -
              spec.homepage      = 'https://github.com/ | 
| 29 | 
            +
              spec.homepage      = 'https://github.com/kigster/puma-daemon'
         | 
| 30 30 | 
             
              spec.license       = 'MIT'
         | 
| 31 31 |  | 
| 32 32 | 
             
              spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
         | 
| 33 33 |  | 
| 34 34 | 
             
              spec.metadata['homepage_uri'] = spec.homepage
         | 
| 35 | 
            -
              spec.metadata['source_code_uri'] = 'https://github.com/ | 
| 36 | 
            -
              spec.metadata['changelog_uri'] = 'https://github.com/ | 
| 35 | 
            +
              spec.metadata['source_code_uri'] = 'https://github.com/kigster/puma-daemon'
         | 
| 36 | 
            +
              spec.metadata['changelog_uri'] = 'https://github.com/kigster/puma-daemon/master/CHANAGELOG.md'
         | 
| 37 37 |  | 
| 38 38 | 
             
              # Specify which files should be added to the gem when it is released.
         | 
| 39 39 | 
             
              # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
         | 
| 40 40 | 
             
              spec.files = Dir.chdir(File.expand_path(__dir__)) do
         | 
| 41 41 | 
             
                `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
         | 
| 42 42 | 
             
              end
         | 
| 43 | 
            +
             | 
| 43 44 | 
             
              spec.bindir        = 'exe'
         | 
| 44 45 | 
             
              spec.executables   = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
         | 
| 45 46 | 
             
              spec.require_paths = ['lib']
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: puma-daemon
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Konstantin Gredeskoul
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2023-03-07 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: puma
         | 
| @@ -162,7 +162,8 @@ files: | |
| 162 162 | 
             
            - CHANGELOG.md
         | 
| 163 163 | 
             
            - Dockerfile.build
         | 
| 164 164 | 
             
            - Dockerfile.download
         | 
| 165 | 
            -
            - Gemfile
         | 
| 165 | 
            +
            - Gemfile.puma-v5
         | 
| 166 | 
            +
            - Gemfile.puma-v6
         | 
| 166 167 | 
             
            - LICENSE.txt
         | 
| 167 168 | 
             
            - Makefile
         | 
| 168 169 | 
             
            - README.adoc
         | 
| @@ -171,22 +172,26 @@ files: | |
| 171 172 | 
             
            - bin/setup
         | 
| 172 173 | 
             
            - config/puma_cluster.rb
         | 
| 173 174 | 
             
            - config/puma_single.rb
         | 
| 175 | 
            +
            - example/cluster.sh
         | 
| 176 | 
            +
            - example/config.ru
         | 
| 177 | 
            +
            - example/puma.rb
         | 
| 178 | 
            +
            - example/single.sh
         | 
| 174 179 | 
             
            - exe/pumad
         | 
| 175 180 | 
             
            - lib/puma-daemon.rb
         | 
| 176 181 | 
             
            - lib/puma/daemon.rb
         | 
| 177 182 | 
             
            - lib/puma/daemon/cli.rb
         | 
| 178 183 | 
             
            - lib/puma/daemon/configuration.rb
         | 
| 179 184 | 
             
            - lib/puma/daemon/dsl.rb
         | 
| 180 | 
            -
            - lib/puma/daemon/ | 
| 185 | 
            +
            - lib/puma/daemon/runner_adapter.rb
         | 
| 181 186 | 
             
            - lib/puma/daemon/version.rb
         | 
| 182 187 | 
             
            - puma-daemon.gemspec
         | 
| 183 | 
            -
            homepage: https://github.com/ | 
| 188 | 
            +
            homepage: https://github.com/kigster/puma-daemon
         | 
| 184 189 | 
             
            licenses:
         | 
| 185 190 | 
             
            - MIT
         | 
| 186 191 | 
             
            metadata:
         | 
| 187 | 
            -
              homepage_uri: https://github.com/ | 
| 188 | 
            -
              source_code_uri: https://github.com/ | 
| 189 | 
            -
              changelog_uri: https://github.com/ | 
| 192 | 
            +
              homepage_uri: https://github.com/kigster/puma-daemon
         | 
| 193 | 
            +
              source_code_uri: https://github.com/kigster/puma-daemon
         | 
| 194 | 
            +
              changelog_uri: https://github.com/kigster/puma-daemon/master/CHANAGELOG.md
         | 
| 190 195 | 
             
            post_install_message:
         | 
| 191 196 | 
             
            rdoc_options: []
         | 
| 192 197 | 
             
            require_paths:
         | 
| @@ -202,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 202 207 | 
             
                - !ruby/object:Gem::Version
         | 
| 203 208 | 
             
                  version: '0'
         | 
| 204 209 | 
             
            requirements: []
         | 
| 205 | 
            -
            rubygems_version: 3. | 
| 210 | 
            +
            rubygems_version: 3.3.26
         | 
| 206 211 | 
             
            signing_key:
         | 
| 207 212 | 
             
            specification_version: 4
         | 
| 208 213 | 
             
            summary: Restore somewhat Puma's ability to self-daemonize, since Puma 5.0 dropped
         | 
    
        data/lib/puma/daemon/runner.rb
    DELETED
    
    | @@ -1,30 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require_relative 'version'
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            module Puma
         | 
| 6 | 
            -
              module Daemon
         | 
| 7 | 
            -
                module Runner
         | 
| 8 | 
            -
                  attr_reader :options
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                  def redirect_io
         | 
| 11 | 
            -
                    super
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                    daemonize! if daemon?
         | 
| 14 | 
            -
                  end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                  def daemon?
         | 
| 17 | 
            -
                    options[:daemon]
         | 
| 18 | 
            -
                  end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                  def daemonize!
         | 
| 21 | 
            -
                    log "*  Puma Daemon: Daemonizing (puma-daemon v#{::Puma::Daemon::VERSION})..."
         | 
| 22 | 
            -
                    Process.daemon(true)
         | 
| 23 | 
            -
                  end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                  def log(str)
         | 
| 26 | 
            -
                    super(str) unless str == 'Use Ctrl-C to stop'
         | 
| 27 | 
            -
                  end
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
              end
         | 
| 30 | 
            -
            end
         |