Pregunta

Before I start the process of building something from scratch I was curious if anyone else had come across a way of providing a first-time configuration wizard for a Rails application that allows the user (sysadmin) to configure aspects of the application such as the ActiveRecord configuration and the ActionMailer setup (SMTP, sender etc).

We'd like to provide a clean easy way for new installs to get setup, rather than asking clients to edit files, or run scripts on the command line.

Essentially you should be able to download the application, extract it, start it, and when you access it via the browser you're guided through the initial setup steps.

My question isn't so much around how to do this, but more has anyone already done this. My quick search for gems, plugins etc around this idea didn't turn up much.

Edit/Clarification

To clarify the scenario - this is to support "shrink-wrapped" products that are downloaded and installed on-premises by the customer's sys admin.

The first time they access our application after deploying it behind their firewall we want a friendly way of configuring the specific settings for their install, such as database etc.

An example of such a process is JIRA's setup wizard:

https://confluence.atlassian.com/display/JIRA/Running+the+Setup+Wizard

This isn't for reating new rails applications, or systemising our development process.

¿Fue útil?

Solución

I like Rails Templater a lot. It is a command line tool to build a rails app. It asks you questions like "Would you like to use rspec? Pry instead of IRB?"
I have created a fork that adds authentication, twitter bootstrap and backbone.js and some other options. It is pretty easy to hack on if you have specific needs. I use it all the time and I would hate not having it.
It is of course a command line app and not usable via the browser but maybe it will still fit your needs. Or the codebase could be integrated into a client web application.

Update after comment
You may be able to bootstrap a sqlite database so the app can boot, then just using a form or a wizard to set up something that writes your database.yml and other configs, maybe by means of thor (makes appending/replacing text in files simple and is part of rails). You would need to somehow restart the rails app and migrate the database. You could keep the pg or mysql2 gem (or both) in your Gemfile or again use thor to edit them from your wizard/form.

I also recommend using rails_config as Michael suggested. With the above solution.

If I had more time to think about the problem, I may come up with something cleaner but this is how I would do it if I had to right now.

Otros consejos

http://railswizard.org/ lets you select which gems to use. It's a very innovative use of the ui and the isotope gem to select the components. Similarly another viewpoint is this top 10 list: http://blog.teamtreehouse.com/10-must-have-ruby-gems

You'll never find a definitive list of gems as need change from person to person and over time, e.g. which database your company uses and which is the 'current' best authentication gem are both variable.

For configuration specific settings you can make the configuration less of a chore by using practices that reduce it. For example the database.yml file is usually one of the 'must be edited locally' files. Our approach for this to to exclude database.yml from source control by putting its name in our .gitignore file. We add an database.yml.example file which we copy locally to database.yml and in that file we use anchors (&) and references (*) as detailed here: http://blog.geekdaily.org/2010/08/advanced-yaml-tricking-out-your-databaseyml.html

More options for configuring other variables for each environment: http://kpumuk.info/ruby-on-rails/flexible-application-configuration-in-ruby-on-rails/

The rails config gem may also help you as detailed here: How to define custom configuration variables in rails

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top