{"id":31702310,"url":"https://github.com/avamia/kanrisuru-nginx","last_synced_at":"2026-05-17T00:08:47.066Z","repository":{"id":56879874,"uuid":"394046660","full_name":"avamia/kanrisuru-nginx","owner":"avamia","description":"Manage remove Nginx websevers with Kanrisuru in ruby.","archived":false,"fork":false,"pushed_at":"2021-08-09T16:04:04.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T00:27:57.771Z","etag":null,"topics":["devops","kanrisuru","nginx","webserver"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avamia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-08T18:58:44.000Z","updated_at":"2021-08-09T16:14:28.000Z","dependencies_parsed_at":"2022-08-20T23:40:18.481Z","dependency_job_id":null,"html_url":"https://github.com/avamia/kanrisuru-nginx","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/avamia/kanrisuru-nginx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avamia%2Fkanrisuru-nginx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avamia%2Fkanrisuru-nginx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avamia%2Fkanrisuru-nginx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avamia%2Fkanrisuru-nginx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avamia","download_url":"https://codeload.github.com/avamia/kanrisuru-nginx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avamia%2Fkanrisuru-nginx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278854210,"owners_count":26057418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","kanrisuru","nginx","webserver"],"created_at":"2025-10-08T21:50:38.357Z","updated_at":"2025-10-08T21:50:40.482Z","avatar_url":"https://github.com/avamia.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kanrisuru::Nginx\n\nThis project helps you manage your remote Nginx webservers. Built ontop of the [Kanrisuru library](https://github.com/avamia/kanrisuru), it utilizes the core set of commands to install, service and configure the Nginx webserver.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'kanrisuru-nginx'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install kanrisuru-nginx\n\n## Usage\n\nThe nginx module is namespaced on a `host` and `cluster` instance under the `nginx` name.\n\n### Requirment\n\nTo use `Kanrisuru::Nginx` in your project, make sure to include both projects to manage the infrastructure. \n```ruby\nrequire 'kanrisuru'\nrequire 'kanrisuru-nginx'\n```\n\nMost commands with nginx need to be run as root, so don't forget to call the `su` method before running the nginx module.\n\n### Package Installation\nInstallation of the nginx package is straightforward.  You can check if the package is installed directly with the `installed?` method.\n\n```ruby\nhost.su('root')\nhost = Kanrisuru::Remote::Host.new(host: 'centos-host', username: 'centos', keys: ['~/.ssh/id-rsa'])\n\nhost.nginx.installed?\n# =\u003e false\n\nresult = host.nginx.install\nresult.success?\n# =\u003e true \n\nhost.nginx.installed?\n# =\u003e true\n```\n\nThe installation is installed via the `apt`, `yum`, and `zypper` package managers for their respective linux distribution types, namely:\n| Package Manager | OS Distro |\n|-----------------|-----------|\n| `apt` | debian |\n| `apt` | ubuntu |\n| `yum` | centos |\n| `yum` | redhat |\n| `yum` | fedora |\n| `zypper` | opensuse |\n| `zypper` | SUSE Enterprise Linux |\n\nWith Kanrisuru, the `os_include` and `os_define` takes care of figuring out which linux distro and release should be used with the corresponding install method, so you only need to call `host.nginx.install` for it to work. \n\n### Package Removal\nTo remove an installed version of Nginx, call:\n```ruby\nhost.nginx.installed?\n# =\u003e true\n\nhost.nginx.remove\n\nhost.nginx.installed?\n# =\u003e false\n``` \n\nNote that if Nginx is running while calling remove, it will automatically stop any master / worker processes that are running before removing the package.\n\n### Service Methods\nTo service the nginx webserver, the following commands help you easily start, stop, and restart the webserver\n```ruby\nhost.nginx.running?\n# =\u003e false\n\n## Start the webserver\nresult = host.nginx.start\nresult.success?\n# =\u003e true\n\nhost.nginx.running?\n# =\u003e true\n\nhost.nginx.master_pid\n# =\u003e 1337\n\nresult = host.nginx.restart\nresult.success?\n# =\u003e true\n\nhost.nginx.master_pid\n# =\u003e 4343\n\nresult = host.nginx.stop\nresult.success?\n# =\u003e true\n\nhost.nginx.running?\n# =\u003e false\n```\n\nYou can test to see if the current configuration files are properly formatted\n```ruby\nresult = host.nginx.test\nresult.success?\n# =\u003e true\n\nresult = host.nginx.test(config: '~/test.conf')\nresult.success?\n# =\u003e true\n```\n\nTo reload the nginx workers with updated configuration files, but not a full restart\n```ruby\nhost.nginx.master_pid\n# =\u003e 4343\n\nresult = host.nginx.reload\nresult.success?\n# =\u003e true\n\nhost.nginx.master_pid\n# =\u003e 4343\n``` \n\n### Configuration Management\nThis is currently in development and is the focus of the next release for this module.\n\n### Utilities\nYou can fetch the master and worker process information\n```ruby\nhost.nginx.master_process\n#\u003cStruct:Kanrisuru::Core::System::ProcessInfo:0x000005f0\n  ppid = 1,\n  command = \"nginx: master process nginx\",\n  cpu_time = \"00:00:00\",\n  cpu_usage = 0.0,\n  flags = 1,\n  gid = 0,\n  group = \"root\",\n  memory_usage = 0.0,\n  pid = 20484,\n  policy = \"SCHED_OTHER\",\n  policy_abbr = \"TS\",\n  priority = 19,\n  stat = \"Ss\",\n  uid = 0,\n  user = \"root\"\n\u003e\n\nhost.nginx.master_pid\n# =\u003e 20484\n\nhost.nginx.worker_processess\n[\n  #\u003cStruct:Kanrisuru::Core::System::ProcessInfo:0x0000f4d8\n    ppid = 20484,\n    command = \"nginx: worker process\",\n    cpu_time = \"00:00:00\",\n    cpu_usage = 0.0,\n    flags = 5,\n    gid = 994,\n    group = \"nginx\",\n    memory_usage = 0.0,\n    pid = 20485,\n    policy = \"SCHED_OTHER\",\n    policy_abbr = \"TS\",\n    priority = 19,\n    stat = \"S\",\n    uid = 997,\n    user = \"nginx\"\n  \u003e\n]\n```\n## Development\n\nAfter 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.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/avamia/kanrisuru-nginx. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/avamia/kanrisuru-nginx/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Kanrisuru::Nginx project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/avamia/kanrisuru-nginx/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favamia%2Fkanrisuru-nginx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favamia%2Fkanrisuru-nginx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favamia%2Fkanrisuru-nginx/lists"}