{"id":13879211,"url":"https://github.com/ankane/trove","last_synced_at":"2025-11-17T14:16:10.826Z","repository":{"id":59158105,"uuid":"308787904","full_name":"ankane/trove","owner":"ankane","description":"Deploy machine learning models in Ruby (and Rails)","archived":false,"fork":false,"pushed_at":"2025-09-30T01:04:07.000Z","size":41,"stargazers_count":74,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-18T14:21:03.872Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ankane.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-10-31T02:26:58.000Z","updated_at":"2025-09-30T22:09:32.000Z","dependencies_parsed_at":"2024-01-03T02:24:29.625Z","dependency_job_id":"4c3d346a-f5bc-4ac2-acd0-fdcb525aebf8","html_url":"https://github.com/ankane/trove","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.25,"last_synced_commit":"79dbc0b7f68c2c9f09b9734bd518c42067edf0b7"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ankane/trove","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrove","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrove/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrove/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrove/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankane","download_url":"https://codeload.github.com/ankane/trove/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankane%2Ftrove/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284894629,"owners_count":27080739,"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-11-17T02:00:06.431Z","response_time":55,"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":[],"created_at":"2024-08-06T08:02:13.591Z","updated_at":"2025-11-17T14:16:10.810Z","avatar_url":"https://github.com/ankane.png","language":"Ruby","funding_links":[],"categories":["Ruby","Gems"],"sub_categories":["Articles"],"readme":"# Trove\n\n:fire: Deploy machine learning models in Ruby (and Rails)\n\nWorks great with [XGBoost](https://github.com/ankane/xgboost), [Torch.rb](https://github.com/ankane/torch.rb), [fastText](https://github.com/ankane/fastText), and many other gems\n\n## Installation\n\nAdd this line to your application’s Gemfile:\n\n```ruby\ngem \"trove\"\n```\n\nAnd run:\n\n```sh\nbundle install\ntrove init\n```\n\nAnd [configure your storage](#storage) in `.trove.yml`.\n\n## Storage\n\n### Amazon S3\n\nCreate a bucket and enable object versioning.\n\nNext, set up your AWS credentials. You can use the [AWS CLI](https://github.com/aws/aws-cli):\n\n```sh\npip install awscli\naws configure\n```\n\nOr environment variables:\n\n```sh\nexport AWS_ACCESS_KEY_ID=...\nexport AWS_SECRET_ACCESS_KEY=...\nexport AWS_REGION=...\n```\n\nIAM users need:\n\n- `s3:GetObject` and `s3:GetObjectVersion` to pull files\n- `s3:PutObject` to push files\n- `s3:ListBucket` and `s3:ListBucketVersions` to list files and versions\n- `s3:DeleteObject` and `s3:DeleteObjectVersion` to delete files\n\nHere’s an example policy:\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"Trove\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:GetObject\",\n                \"s3:GetObjectVersion\",\n                \"s3:PutObject\",\n                \"s3:ListBucket\",\n                \"s3:ListBucketVersions\",\n                \"s3:DeleteObject\",\n                \"s3:DeleteObjectVersion\"\n            ],\n            \"Resource\": [\n                \"arn:aws:s3:::my-bucket\",\n                \"arn:aws:s3:::my-bucket/trove/*\"\n            ]\n        }\n    ]\n}\n```\n\nIf your production servers only need to pull files, only give them `s3:GetObject` and `s3:GetObjectVersion` permissions.\n\n## How It Works\n\nGit is great for code, but it’s not ideal for large files like models. Instead, we use an object store like Amazon S3 to store and version them.\n\nTrove creates a `trove` directory for you to use as a workspace. Files in this directory are ignored by Git but can be pushed and pulled from the object store. By default, files are tracked in `.trove.yml` to make it easy to deploy specific versions with code changes.\n\n## Getting Started\n\nUse the `trove` directory to save and load models.\n\n```ruby\n# training code\nmodel.save_model(\"trove/model.bin\")\n\n# prediction code\nmodel = FastText.load_model(\"trove/model.bin\")\n```\n\nWhen a model is ready, push it to the object store with:\n\n```sh\ntrove push model.bin\n```\n\nAnd commit the changes to `.trove.yml`. The model is now ready to be deployed.\n\n## Deployment\n\nWe recommend pulling files during the build process.\n\n- [Heroku and Dokku](#heroku-and-dokku)\n- [Docker](#docker)\n\nMake sure your storage credentials are available in the build environment.\n\n### Heroku and Dokku\n\nAdd to your `Rakefile`:\n\n```ruby\nRake::Task[\"assets:precompile\"].enhance do\n  Trove.pull\nend\n```\n\nThis will pull files at the very end of the asset precompile. Check the build output for:\n\n```text\nremote:        Pulling model.bin...\nremote:        Asset precompilation completed (30.00s)\n```\n\n### Docker\n\nAdd to your `Dockerfile`:\n\n```Dockerfile\nRUN bundle exec trove pull\n```\n\n## Commands\n\nPush a file\n\n```sh\ntrove push model.bin\n```\n\nPull all files in `.trove.yml`\n\n```sh\ntrove pull\n```\n\nPull a specific file (uses the version in `.trove.yml` if present)\n\n```sh\ntrove pull model.bin\n```\n\nPull a specific version of a file\n\n```sh\ntrove pull model.bin --version 123\n```\n\nDelete a file\n\n```sh\ntrove delete model.bin\n```\n\nList files\n\n```sh\ntrove list\n```\n\nList versions\n\n```sh\ntrove versions model.bin\n```\n\n## Ruby API\n\nYou can use the Ruby API in addition to the CLI.\n\n```ruby\nTrove.push(filename)\nTrove.pull\nTrove.pull(filename)\nTrove.pull(filename, version: version)\nTrove.delete(filename)\nTrove.list\nTrove.versions(filename)\n```\n\nThis makes it easy to perform operations from code, iRuby notebooks, and the Rails console.\n\n## Automated Training\n\nBy default, Trove tracks files in `.trove.yml` to make it easy to deploy specific versions with code changes. However, this functionality is entirely optional. Disable it with:\n\n```yml\nvcs: false\n```\n\nThis is useful if you want to automate training or build more complex workflows.\n\n## Non-Ruby\n\nTrove can be used in non-Ruby projects as well.\n\n```sh\ngem install trove\ntrove init\n```\n\n## History\n\nView the [changelog](https://github.com/ankane/trove/blob/master/CHANGELOG.md)\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/ankane/trove/issues)\n- Fix bugs and [submit pull requests](https://github.com/ankane/trove/pulls)\n- Write, clarify, or fix documentation\n- Suggest or add new features\n\nTo get started with development:\n\n```sh\ngit clone https://github.com/ankane/trove.git\ncd trove\nbundle install\n\nexport AWS_ACCESS_KEY_ID=...\nexport AWS_SECRET_ACCESS_KEY=...\nexport AWS_REGION=...\nexport S3_BUCKET=my-bucket\n\nbundle exec rake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Ftrove","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankane%2Ftrove","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankane%2Ftrove/lists"}