Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 661074 - www-servers/nginx-unit: dynamic web and application server
Summary: www-servers/nginx-unit: dynamic web and application server
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Default Assignee for New Packages
URL: https://github.com/rseichter/gentoo-e...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-13 15:19 UTC by Ralph Seichter
Modified: 2018-07-17 18:00 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Initial ebuild submission (nginx-unit-1.3.ebuild,873 bytes, text/plain)
2018-07-13 15:19 UTC, Ralph Seichter
Details
Ebuild with added init script and IUSE support (nginx-unit-1.3-r1.ebuild,936 bytes, text/plain)
2018-07-13 19:07 UTC, Ralph Seichter
Details
Template for /etc/init.d/nginx-unit (nginx-unit-initd,230 bytes, text/plain)
2018-07-13 19:11 UTC, Ralph Seichter
Details
Improved ebuild with REQUIRED_USE (nginx-unit-1.3-r2.ebuild,992 bytes, text/plain)
2018-07-14 09:23 UTC, Ralph Seichter
Details
Ebuild with dependency slot fixes (nginx-unit-1.3.ebuild,980 bytes, text/plain)
2018-07-15 13:15 UTC, Ralph Seichter
Details
Initial version of ebuild metadata (metadata.xml,861 bytes, text/xml)
2018-07-15 13:16 UTC, Ralph Seichter
Details
/etc/init.d/nginx-unit with fixed copyright (nginx-unit-initd,301 bytes, text/plain)
2018-07-15 13:18 UTC, Ralph Seichter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Seichter 2018-07-13 15:19:16 UTC
Created attachment 539370 [details]
Initial ebuild submission

Please find attached my initial submission of an ebuild for "NGINX Unit". The ebuild is designed for version 1.3, which has been released today (2018-07-13). I have been using this ebuild locally since the release of Unit 1.0.

Quoting https://unit.nginx.org :

NGINX Unit is a dynamic web and application server, designed to run applications in multiple languages. Unit is lightweight, polyglot, and dynamically configured via API. The design of the server allows reconfiguration of specific application parameters as needed by the engineering or operations.

I suggest using "www-servers/nginx-unit" as the full name, matching the existing "www-servers/nginx" web server.

-Ralph
Comment 1 Tomáš Mózes 2018-07-13 17:43:46 UTC
Hello Ralph, glad you want to bring this into Gentoo :)

A few notes:
- drop src_compile() as it's the default anyway
- in src_install() start with default and then just add keepdir (and then remove emake... because it's called within default)
- only add python/perl/php support if one wants it (add IUSE and R/DEPENDs on dev-lang/php[embed] etc.). You can add a condition so that at least one has to be enabled if you wish. Optionally, adding ruby/go would be also nice but can be done later on of course.
- please at least add an openrc init script
Comment 2 Ralph Seichter 2018-07-13 19:07:18 UTC
Created attachment 539438 [details]
Ebuild with added init script and IUSE support

Hi Tomáš,

I made the improvements you mentioned. Hopefully I am doing it right, this is the first time I attempt to publish an ebuild.
Comment 3 Ralph Seichter 2018-07-13 19:11:17 UTC
Created attachment 539440 [details]
Template for /etc/init.d/nginx-unit
Comment 4 Ralph Seichter 2018-07-14 09:23:24 UTC
Created attachment 539516 [details]
Improved ebuild with REQUIRED_USE

I added REQUIRED_USE to have users select at least one of 'perl', 'php' or 'python'. Also, the ebuild will now abort if configuring the support module for any specified USE flag fails.

BTW, I plan to add support for Go, Ruby et al as well, but I have not yet needed these and hence don't have applications I could use for testing.
Comment 5 Ralph Seichter 2018-07-15 13:15:37 UTC
Created attachment 539652 [details]
Ebuild with dependency slot fixes

Latest version of ebuild includes fixes for dependency slots. I will also add manifest and metadata files.
Comment 6 Ralph Seichter 2018-07-15 13:16:25 UTC
Created attachment 539654 [details]
Initial version of ebuild metadata
Comment 7 Ralph Seichter 2018-07-15 13:18:20 UTC
Created attachment 539656 [details]
/etc/init.d/nginx-unit with fixed copyright
Comment 8 Tomáš Mózes 2018-07-15 20:42:13 UTC
Thanks for the update, a few more comments:

init.d:
- does nginx-unit really "need net"? (please check https://bugs.gentoo.org/439092)
- wouldn't it be better to run nginx-unit as a non-root user?

metadata:
- please also add proxy-maint
- the perl/python/php flags are already listed in profiles/use.desc

ebuild:
- please leave a blank line after EAPI=6
- aren't any use flags of perl/php/python needed for their support (like php[embed])?
Comment 9 Ralph Seichter 2018-07-15 21:16:32 UTC
> does nginx-unit really "need net"?
I'll check if Unit can do without.

> wouldn't it be better to run nginx-unit as a non-root user?
Only the main process runs as 'root'. Controller and router processes
run as 'nobody', individual application processes as the user defined in
Unit's application configuration section. Here's a typical output form
one of my servers:

  # ps aux | grep unit
  root    4124  (...)  0:00 unit: main v1.3 [/usr/sbin/unitd]
  nobody  4174  (...)  0:00 unit: controller
  nobody  4175  (...)  0:00 unit: router
  nginx   4176  (...)  5:40 unit: "foo" application
  nginx   4187  (...)  5:39 unit: "bar" application

I configured the 'foo' and 'bar' applications to run as 'nginx', because
NGINX is acting as a proxy for these apps. This is done within Unit.

> please also add proxy-maint
Already did, at least in my Git repo at least. ;-)

> the perl/python/php flags are already listed in profiles/use.desc
Does that mean I can remove the flags from my metadata.xml? I thought
they were required, in addition to IUSE.

> please leave a blank line after EAPI=6
Repoman did not complain, but I can add a blank line of course.

> aren't any use flags of perl/php/python needed for their support (like php[embed])?
Perl and Python don't require particular flags as far as I could tell,
but php[embed] might be required (apparently this flag is enabled via a
profile here, so I guess I should try turning it off manually).
Comment 10 Tomáš Mózes 2018-07-15 21:27:03 UTC
(In reply to Ralph Seichter from comment #9)
> > please also add proxy-maint
> Already did, at least in my Git repo at least. ;-)

Just checked the attachment here :)

> > the perl/python/php flags are already listed in profiles/use.desc
> Does that mean I can remove the flags from my metadata.xml? I thought
> they were required, in addition to IUSE.

Since they are so common, they are defined globally so don't have to be repeated each time (for example check https://github.com/gentoo/gentoo/blob/master/app-editors/vim/metadata.xml plus the vim ebuild that has perl,python,ruby...)

> > please leave a blank line after EAPI=6
> Repoman did not complain, but I can add a blank line of course.

Nothing serious though, but it's like that in the other ebuilds.
Comment 11 Tomáš Mózes 2018-07-15 21:31:10 UTC
I think you're doing fine Ralph with your first ebuild, but please note I cannot add your package to Gentoo as I'm not a developer. Probably it will be better to open a PR on github later on where other devs/proxy maint can comment and hopefully add your ebuild to the main tree.
Comment 12 Ralph Seichter 2018-07-15 22:00:35 UTC
Thank you for helping me with this, Tomáš. It makes the process easier
for me.

> Probably it will be better to open a PR on github later on

No problem, I will do that. I should have figured out earlier that these
days a GitHub PR is the preferred method. I've already invested quite
some time reading the documentation about GH based contributions, and I
don't expect much trouble.
Comment 13 Ralph Seichter 2018-07-15 23:29:52 UTC
GitHub pull request created. Please note that the PR contains *newer* versions of the attachments. I'm not quite sure if I should keep updating the attachments this bug report?
Comment 14 Tomáš Mózes 2018-07-16 05:08:28 UTC
I don't think it's necessary to update on both places.
Comment 15 Larry the Git Cow gentoo-dev 2018-07-17 17:14:40 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45c246558a1abfd8c5fdb2b51d00b33faf1a0d81

commit 45c246558a1abfd8c5fdb2b51d00b33faf1a0d81
Author:     Ralph Seichter <github@seichter.de>
AuthorDate: 2018-07-16 10:57:14 +0000
Commit:     Tony Vroon <chainsaw@gentoo.org>
CommitDate: 2018-07-17 17:14:24 +0000

    www-servers/nginx-unit: New package, by Ralph Seichter.
    
    NGINX Unit is a dynamic web and application server, designed to run
    applications in multiple languages. Unit is lightweight, polyglot,
    and dynamically configured via API. The design of the server allows
    reconfiguration of specific application parameters as needed by the
    engineering or operations.  (Source: http://unit.nginx.org/)
    
    Bug: https://bugs.gentoo.org/661074
    Package-Manager: Portage-2.3.40, Repoman-2.3.9
    Closes: https://github.com/gentoo/gentoo/pull/9249
    Closes: https://bugs.gentoo.org/661074

 www-servers/nginx-unit/Manifest               |  1 +
 www-servers/nginx-unit/files/nginx-unit.initd | 14 ++++++++++
 www-servers/nginx-unit/metadata.xml           | 22 +++++++++++++++
 www-servers/nginx-unit/nginx-unit-1.3.ebuild  | 39 +++++++++++++++++++++++++++
 4 files changed, 76 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45c246558a1abfd8c5fdb2b51d00b33faf1a0d81

commit 45c246558a1abfd8c5fdb2b51d00b33faf1a0d81
Author:     Ralph Seichter <github@seichter.de>
AuthorDate: 2018-07-16 10:57:14 +0000
Commit:     Tony Vroon <chainsaw@gentoo.org>
CommitDate: 2018-07-17 17:14:24 +0000

    www-servers/nginx-unit: New package, by Ralph Seichter.
    
    NGINX Unit is a dynamic web and application server, designed to run
    applications in multiple languages. Unit is lightweight, polyglot,
    and dynamically configured via API. The design of the server allows
    reconfiguration of specific application parameters as needed by the
    engineering or operations.  (Source: http://unit.nginx.org/)
    
    Bug: https://bugs.gentoo.org/661074
    Package-Manager: Portage-2.3.40, Repoman-2.3.9
    Closes: https://github.com/gentoo/gentoo/pull/9249
    Closes: https://bugs.gentoo.org/661074

 www-servers/nginx-unit/Manifest               |  1 +
 www-servers/nginx-unit/files/nginx-unit.initd | 14 ++++++++++
 www-servers/nginx-unit/metadata.xml           | 22 +++++++++++++++
 www-servers/nginx-unit/nginx-unit-1.3.ebuild  | 39 +++++++++++++++++++++++++++
 4 files changed, 76 insertions(+)
Comment 16 Tomáš Mózes 2018-07-17 18:00:40 UTC
Thank you Ralph and happy proxy maintaining :)