{"id":15064616,"url":"https://github.com/puzzle/nochmal","last_synced_at":"2025-04-10T12:41:16.585Z","repository":{"id":41974176,"uuid":"407237558","full_name":"puzzle/nochmal","owner":"puzzle","description":"Adds a rake task to reupload ActiveStorage attachments to a new storage. Also provides some helper-code to transition between storage backends","archived":false,"fork":false,"pushed_at":"2025-02-25T17:14:58.000Z","size":14483,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-24T11:21:33.042Z","etag":null,"topics":["activestorage","rails","rake-task"],"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/puzzle.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-16T16:28:52.000Z","updated_at":"2025-02-25T17:15:02.000Z","dependencies_parsed_at":"2024-09-25T00:23:13.047Z","dependency_job_id":"6406c15a-fa28-4255-bc5e-29c141eea72c","html_url":"https://github.com/puzzle/nochmal","commit_stats":{"total_commits":96,"total_committers":3,"mean_commits":32.0,"dds":"0.17708333333333337","last_synced_commit":"55a9cfbade16e78396ce69dbbb6267864d35fc84"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzle%2Fnochmal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzle%2Fnochmal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzle%2Fnochmal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puzzle%2Fnochmal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puzzle","download_url":"https://codeload.github.com/puzzle/nochmal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247926506,"owners_count":21019501,"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":["activestorage","rails","rake-task"],"created_at":"2024-09-25T00:22:35.923Z","updated_at":"2025-04-10T12:41:16.563Z","avatar_url":"https://github.com/puzzle.png","language":"Ruby","readme":"# Nochmal\n\nThis gem adds a rake task to your application that finds all your models that have attachments and reuploads the attachments to the newly configured (or specified) storage service.\n\nYou can use this to switch to a different storage service. The keys of the uploaded files stay the same, so your app can remain ignorant.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'nochmal'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install nochmal\n\n## Usage\n\n### Reuploading from one service to another\n\n1. Update your `config/storage.yml` with the new service:\n   ```yaml\n    local:\n      service: Disk\n      root: \u003c%= Rails.root.join(\"storage\") %\u003e\n\n    remote:\n      service: Disk\n      root: \u003c%= Rails.root.join(\"tmp/remote_storage\") %\u003e\n   ```\n1. Update your configured storage `config/environments/production.rb`:\n   ```ruby\n     config.active_storage.service = :remote\n   ```\n1. Run the rake task:\n   ```bash\n     rake nochmal:reupload REUPLOAD_FROM=local REUPLOAD_TO=remote # or rake nochmal:reupload[local,remote]\n   ```\n\n### Migrating from Carrierwave (Disk-Storage) to ActiveStorage\n\nThe migration from Carrierwave is mostly series manual steps, nochmal provides some advice for preparation and helps with the copying of data. No automated code-changes are made, you are the master of your ~~fate~~_app_, you are the captain of your ~~soul~~_code_. The journey includes mostly these steps:\n\n1. Analyze your application for exisiting uploaders and needed changes\n   ```bash\n     rake nochmal:carrierwave:analyze\n   ```\n2. Change your application and test it automatically and manually\n   With the provided helper, you can read from active_storage and carrierwave and upload to active_storage\n\n3. Deploy your application with this hybrid setup\n\n4. Reupload all carrierwave-uploads to active_storage\n   ```bash\n     NOCHMAL_MIGRATION=yay rake nochmal:carrierwave:migrate\n   ```\n   Nochmal store some metadata to allow resuming a migration if the process dies or gets interrupted. If you want to keep this data either way, you can pass the environment-variable `NOCHMAL_KEEP_METADATA` with any value:\n   ```bash\n     NOCHMAL_MIGRATION=yay NOCHMAL_KEEP_METADATA=any rake nochmal:carrierwave:migrate\n   ```\n   If you want or need to resume a migration, run the command again and follow the suggestion that works best for you.\n\n5. Remove all remainders of carrierwave, deploy that, remove all carrierwave-uploads\n\n## Project Scope\n\n- [x] Works for `has_one_attached` attachments\n- [x] Works for `has_many_attached` attachments\n- [x] Works for single-file disk-based carrierwave-uploaders\n- [ ] Does not yet work for multi-file carrierwave-uploaders\n- [ ] Does not yet help you with migrating from paperclip\n\n## What about the name?\n\nImagine a little child that does something dangerous or exhausting, but yells \"again!\" at the end. \"Nochmal\" is german for \"again\" and uploading files is fun, but also (bandwidth) exhausting. And if we switch the storage for uploaded files, we, the devs also yell \"nochmal!\" at the app. The app does not care, but this gem does.\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/puzzle/nochmal. 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/puzzle/nochmal/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 Nochmal project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/puzzle/nochmal/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuzzle%2Fnochmal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuzzle%2Fnochmal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuzzle%2Fnochmal/lists"}