{"id":21991940,"url":"https://github.com/elct9620/openbox","last_synced_at":"2025-04-30T14:21:35.627Z","repository":{"id":39678011,"uuid":"433681105","full_name":"elct9620/openbox","owner":"elct9620","description":"The zero-configuration Ruby container entry-point.","archived":false,"fork":false,"pushed_at":"2022-11-03T10:08:10.000Z","size":57,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-10T03:14:04.406Z","etag":null,"topics":["containers","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elct9620.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-01T04:23:04.000Z","updated_at":"2023-12-10T16:53:04.000Z","dependencies_parsed_at":"2023-01-20T23:02:08.177Z","dependency_job_id":null,"html_url":"https://github.com/elct9620/openbox","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fopenbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fopenbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fopenbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elct9620%2Fopenbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elct9620","download_url":"https://codeload.github.com/elct9620/openbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227206373,"owners_count":17747734,"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","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":["containers","rails","ruby"],"created_at":"2024-11-29T20:12:15.124Z","updated_at":"2024-11-29T20:12:15.706Z","avatar_url":"https://github.com/elct9620.png","language":"Ruby","readme":"# Openbox\n\n![main branch](https://github.com/elct9620/openbox/actions/workflows/main.yml/badge.svg?branch=main)\n\nThe zero-configuration Ruby container entry-point.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'openbox'\n```\n\nAnd then execute:\n\n    $ bundle install\n\n## Usage\n\nCreate `openbox` binstus to allow container use it as entrypoint\n\n```bash\nbundle binstubs openbox\n```\n\nModify your `Dockerfile` to use it as `entrypoint`\n\n```dockerfile\nENTRYPOINT [\"bin/openbox\"]\nCMD [\"server\"]\n```\n\n### Commands\n\nThe commands are pre-defined for the Rack and Rails applications.\n\n| Name      | Enabled Condition | Description              |\n|-----------|-------------------|--------------------------|\n| `server`  | `rails` or `rack` | Start application server |\n| `rake`    | `rails` or `rake` | Run rake tasks           |\n| `console` | `rails`           | Start rails console      |\n| `migrate` | `rails`           | Run database migration   |\n| `seed`    | `rails`           | Run database seed        |\n| `sidekiq` | `sidekiq`         | Run sidekiq server       |\n\n#### Customize Commands\n\nWhen `openbox` execute, the `lib/openbox/commands/*/**.rb` will be scanned and require before started.\nWe can register new command by adding files to `lib/openbox/commands` directory.\n\n```ruby\n# lib/openbox/commands/daemon.rb\n\nclass Daemon \u003c Openbox::Command\n  def execute\n    exec('bundle exec my-daemon')\n  end\nend\n\nOpenbox::Entrypoint.register Daemon, :daemon, :daemon, 'Run a daemon'\n```\n\n\u003e The Rails are not loaded to speed up bootstrap, if you need Rails please load by yourself.\n\n### Environments\n\n| Name             | Example                                | Description                                                                          |\n|------------------|----------------------------------------|--------------------------------------------------------------------------------------|\n| `AUTO_MIGRATION` | `yes`                                  | When present, the `migrate` will run before `server` started                         |\n| `DATABASE_URL`   | `postgres://user:pass@postgres/dbname` | When `pg` or `mysql2` gem present, Openbox will use it to ensure database connection |\n| `SWARM_SECRETS`  | `app-env`                              | List the Docker Swarm secret names to load as environment file                       |\n\n## Environment Loader\n\nTo rotate secrets easier, we may not use Rails credentials but inject secrets via the environment variables.\n\nOpenbox provides a before hook before the command is executed and load the environments from a security source.\n\n### Docker Swarm\n\nWhen use Docker Swarm, the secret will put into `/run/secrets` directory, you can load these files via Dotenv.\n\n```yaml\n# Docker Swarm Stack\nservices:\n  application:\n    environment:\n      - SWARM_SECRETS=sahred-secret,applicate-secret\n    # ...\n```\n\n## Roadmap\n\n* [ ] `config/openbox.rb` config\n* [x] Customize command\n* [x] Database connection check\n  * [x] PostgreSQL support\n  * [x] MySQL support\n* [x] Run Web Server\n  * [x] `rails server`\n  * [x] `rackup -o 0.0.0.0`\n* [x] Rake Task support\n* [x] Sidekiq support\n* [x] Rails capability\n  * [x] `openbox console` to `rails console`\n  * [x] `openbox migrate` to `rails db:migrate`\n  * [x] `openbox seed` to `rails db:seed`\n  * [x] Use `AUTO_MIGRATION` to run migration before server started\n* [ ] Load Secrets as Environment\n  * [ ] AWS Secrets Manager\n  * [ ] Hashicorp Valut\n  * [ ] Docker Swarm Secrets\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/elct9620/openbox. 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/elct9620/openbox/blob/main/CODE_OF_CONDUCT.md).\n\n## Code of Conduct\n\nEveryone interacting in the Openbox project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elct9620/openbox/blob/main/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felct9620%2Fopenbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felct9620%2Fopenbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felct9620%2Fopenbox/lists"}