{"id":29007215,"url":"https://github.com/fractaledmind/enlitenment","last_synced_at":"2025-07-23T13:36:23.954Z","repository":{"id":265000951,"uuid":"842974195","full_name":"fractaledmind/enlitenment","owner":"fractaledmind","description":"A Rails application template script to lead your app to SQLite enlightenment.","archived":false,"fork":false,"pushed_at":"2024-09-18T22:59:00.000Z","size":96,"stargazers_count":53,"open_issues_count":6,"forks_count":4,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-06-18T18:54:19.338Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fractaledmind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-08-15T14:06:00.000Z","updated_at":"2025-02-13T15:49:37.000Z","dependencies_parsed_at":"2024-11-27T06:48:19.476Z","dependency_job_id":null,"html_url":"https://github.com/fractaledmind/enlitenment","commit_stats":null,"previous_names":["fractaledmind/enlitenment"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fractaledmind/enlitenment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractaledmind%2Fenlitenment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractaledmind%2Fenlitenment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractaledmind%2Fenlitenment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractaledmind%2Fenlitenment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fractaledmind","download_url":"https://codeload.github.com/fractaledmind/enlitenment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fractaledmind%2Fenlitenment/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261879323,"owners_count":23223739,"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":[],"created_at":"2025-06-25T13:07:56.879Z","updated_at":"2025-06-25T13:07:57.607Z","avatar_url":"https://github.com/fractaledmind.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# En*lite*nment\n\n`enlitenment` is a [Rails application template script](https://guides.rubyonrails.org/rails_application_templates.html) that will lead you along the path to SQLite on Rails enlightenment.\n\nAchieving SQLite on Rails nirvana requires 4 critical pieces:\n\n1. properly configured SQLite connections for [optimal performance](https://fractaledmind.github.io/2024/04/15/sqlite-on-rails-the-how-and-why-of-optimal-performance/)\n2. properly configured [Solid Queue](https://github.com/rails/solid_queue) for background jobs\n3. properly configured [Solid Cache](https://github.com/rails/solid_cache) for caching\n4. properly configured [Solid Cable](https://github.com/rails/solid_cable) for web sockets\n5. properly configured [Litestream](https://github.com/fractaledmind/litestream-ruby) for backups\n6. properly configured [Solid Errors](https://github.com/fractaledmind/solid_errors) for error monitoring\n\n\nThe `enlitenment` script provides all 6 pieces, each carefully tuned to be production-ready.\n\n\u003e [!IMPORTANT]\n\u003e Testing the template script while it is private requires you copying the url from the web interface, which includes a `token` query param. Using the URL without that `token` query param results in a 404.\n\n## Usage\n\nYou can use a Rails application template script either when scaffolding a new Rails application, or you can apply the template to an existing Rails application.\n\nTo apply the template while scaffolding a new Rails application, you pass the location of the template (local or remote) using the `-m` or `--template` option to the `rails new` command:\n\n```bash\nrails new my-app \\\n  --template https://raw.githubusercontent.com/fractaledmind/enlitenment/main/template.rb\n```\n\nIf you want to apply the template to an existing application, you use the `app:template` command and pass the location of the template via the `LOCATION` environment variable:\n```bash\nbin/rails app:template \\\n  LOCATION=https://raw.githubusercontent.com/fractaledmind/enlitenment/main/template.rb\n```\n\nRails accepts a URL to a remote version of the script file, so you can point directly to the template file in this repository.\n\n### Configuration\n\nRegardless of how you apply the template, you can also configure various details of how the script will upgrade your application via environment variables.\n\n#### Global vs Production Installation\n\nYou can decide whether to install the gems into all environments or just the production environment by setting the `INSTALL_INTO` environment variable:\n\n```\nINSTALL_INTO = \"production\" | \"application\"\n```\n\nThis determines whether configuration is written to the `config/application.rb` file or the `config/environments/production.rb` file as well as whether the databases are configured for all environments or just the production environment in `config/database.yml`.\n\n#### Skipping Sections\n\nYou can skip certain sections of the script using the `SKIP_*` environment variables:\n\n| Variable                | Default |\n| :---                    | :---:   |\n| `SKIP_SOLID_QUEUE`      | `false` |\n| `SKIP_SOLID_CACHE`      | `false` |\n| `SKIP_SOLID_CABLE`      | `false` |\n| `SKIP_LITESTREAM`       | `false` |\n| `SKIP_SOLID_ERRORS`     | `false` |\n\n`SKIP_SOLID_QUEUE` will skip the entire process of installing and configuring [Solid Queue](https://github.com/rails/solid_queue). This process consists of 10 steps, which would all be skipped if you set this variable to `true`:\n\n1. add the `solid_queue` gem to the Gemfile\n2. install the gem\n3. define a new database configuration\n4. add the new database configuration to all environments\n5. run the Solid Queue installation generator\n6. run the migrations for the new database\n7. configure the application to use Solid Queue in all environments with the new database\n8. add the Solid Queue plugin to Puma\n9. add the Solid Queue engine to the application\n10. mount the Solid Queue engine\n\n`SKIP_SOLID_CACHE` will skip the entire process of installing and configuring [Solid Cache](https://github.com/rails/solid_cache). This process consists of 9 steps, which would all be skipped if you set this variable to `true`:\n\n1. add the `solid_cache` gem to the Gemfile\n2. install the gem\n3. define the new database configuration\n4. add the new database configuration to all environments\n5. run the Solid Cache installation generator\n6. run the migrations for the new database\n7. configure Solid Cache to use the new database\n8. configure Solid Cache as the cache store\n9. optionally enable the cache in development\n\n`SKIP_SOLID_CABLE` will skip the entire process of installing and configuring [Solid Cable](https://github.com/rails/solid_cable). This process consists of 7 steps, which would all be skipped if you set this variable to `true`:\n\n1. add the `solid_cable` gem to the Gemfile\n2. install the gem\n3. define the new database configuration\n4. add the new database configuration to all environments\n5. run the Solid Cable installation generator\n6. run the migrations for the new database\n7. configure Solid Cable to use the new database\n\n`SKIP_LITESTREAM` will skip the entire process of installing and configuring [Litestream](https://github.com/fractaledmind/litestream-ruby). This process consists of 8 steps, which would all be skipped if you set this variable to `true`:\n\n1. add the `litestream` gem\n2. install the gem\n3. run the Litestream installation generator\n4. add the Litestream plugin to Puma\n5. mount the Litestream engine\n6. Secure the Litestream dashboard\n7. Add a recurring task to verify Litestream backups\n8. at the end of the Rails process, configure the Litestream engine\n\n`SKIP_SOLID_ERRORS` will skip the entire process of installing and configuring [Solid Errors](https://github.com/fractaledmind/solid_errors). This process consists of 10 steps, which would all be skipped if you set this variable to `true`:\n\n1. add the `solid_errors` gem to the Gemfile\n2. install the gem\n3. define the new database configuration\n4. add the new database configuration to all environments\n5. run the Solid Errors installation generator\n6. prepare the new database\n7. configure the application to use Solid Errors in all environments with the new database\n8. configure Solid Errors to send emails when errors occur\n9. mount the Solid Errors engine\n10. secure the Solid Errors web dashboard\n\n#### Skipping Steps\n\nFor some sections, there are also certain individual steps that can be skipped:\n\n| Variable                | Default |\n| :---                    | :---:   |\n| `SKIP_DEV_CACHE`        | `false` |\n| `SKIP_LITESTREAM_CREDS` | `false` |\n\n`SKIP_DEV_CACHE` will skip the step of enabling the cache in development. This simply means that in step 8 of the Solid Cache configuration process, the `rails dev:cache` action will not be run. Similarly, `SKIP_LITESTREAM_CREDS` will simply skip step 5 of configuring Litestream and not uncomment the lines in the `config/intializers/litestream.rb` file. You will need to configure Litestream yourself by hand.\n\n### Database Configuration\n\nWhen installing and configuring Solid Queue and Solid Cache, `enlitenment` will use a separate SQLite database for each. You can define the names for the those databases using the `*_DB` environment variables:\n\n| Variable    | Default    |\n| :---        | :---:      |\n| `QUEUE_DB`  | `\"queue\"`  |\n| `CACHE_DB`  | `\"cache\"`  |\n| `CABLE_DB`  | `\"cable\"`  |\n| `ERRORS_DB` | `\"errors\"` |\n\nThese database names will be used in the `config/database.yml` file to define the new database configurations as well as in the Solid Queue/Cache/Cable/Errors configuration files to ensure that both gems understand that they are supposed to read and write from these separate SQLite databases.\n\n### Web Dashboards\n\nThe script will also install and configure any related web dashboards for the components. Solid Queue uses the separate [Mission Control — Jobs](https://github.com/rails/mission_control-jobs) gem for its web dashboard, but Litestream and Solid Errors come with their own web dashboards. You can configure the route path that each will be mounted at via the `*_ROUTE` environment variables:\n\n| Variable           | Default         |\n| :---               | :---:           |\n| `JOBS_ROUTE`       | `\"/jobs\"`       |\n| `LITESTREAM_ROUTE` | `\"/litestream\"` |\n| `ERRORS_ROUTE`     | `\"/errors\"`     |\n\nIt is important that each web dashboard has at least basic security measures in place. But the different components provide different ways to secure their web dashboards. For Solid Queue, the Mission Control — Jobs gem allows you to configure the controller that the gem inherits from. For Litestream and Solid Errors, you can set a password that will be required via basic HTTP authentication to access the web dashboards. For all three, however, you could simply secure the dashboards by updating the `config/routes.rb` file to restrict access to the web dashboards under a route constraint, like:\n\n```ruby\nauthenticate :user, -\u003e (user) { user.admin? } do\n  mount SolidErrors::Engine, at: \"/errors\"\n  mount Litestream::Engine, at: \"/litestream\"\n  mount MissionControl::Jobs::Engine, at: \"/jobs\"\nend\n```\n\nBut, to ensure that the generated code is secure by default, the script provides the following environment variables to control the basic security measures that the gems provide:\n\n| Variable              | Default             |\n| :---                  | :---:               |\n| `JOBS_CONTROLLER`     | `\"AdminController\"` |\n| `LITESTREAM_PASSWORD` | `\"lite$tr3am\"`      |\n| `ERRORS_PASSWORD`     | `\"3rr0r$\"`          |\n\nFor the `JOBS_CONTROLLER` in particular, if you do not have an `AdminController` defined in your project, the script will instead generate a `MissionControl::BaseController` for you with HTTP basic authentication enabled. This is simply to ensure that you cannot accidently expose the Mission Control dashboard to the public.\n\n## Solid Gems\n\nIf you want to confirm that the Solid gems have been installed and configured correctly, you can run the following commands in the Rails console and verify that the output matches the following:\n\n```\n\u003e ActionCable.server.config.cable['adapter']\n=\u003e \"solid_cable\"\n\u003e Rails.application.config.cache_store\n=\u003e :solid_cache_store\n\u003e Rails.application.config.active_job.queue_adapter\n=\u003e :solid_queue\n```\n\n## Reporting issues\n\nIf you run into issues running the script, please [open an issue](https://github.com/fractaledmind/enlitenment/issues/new). When detailing your problem, please ensure that you provide the (relevant) contents of the following files as they were **before** you ran the script:\n\n```\n├── config\n    ├── application.rb\n    ├── database.yml\n    ├── puma.rb\n    └── routes.rb\n```\n\nAlso, provide a git diff with the problematic diffs. This will allow us to not just improve the script, but write a regression test for this scenario so that the script never has your particular problem again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffractaledmind%2Fenlitenment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffractaledmind%2Fenlitenment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffractaledmind%2Fenlitenment/lists"}