Not logged in. Login

Rails Development Mode Configuration

Rails Dependencies

Rails has a bunch of Ubuntu package dependencies you'll need installed: ruby-dev, sqlite3, libsqlite3-dev, zlib1g-dev, nodejs, build-essential.

With those, you can gem install bundler --conservative to get bundler installed to actually start with your app.

App Setup

For the application itself, you probably want to to the setup and execution as the vagrant user, not root. You can set the user and working directory for a command like this:

execute 'some command' do
  user 'ubuntu'
  cwd '/home/ubuntu/project/blog'
  command 'some_command'
end

You will need to install the Rails bundle (possibly with the byebug GEM commented out) and migrate the database, as you would have done manually .

To run the server, you have to have webrick listen to external ports, and go into the background to let Chef finish. The command will be like this:

./bin/rails server -d -b 0.0.0.0

You can do this in your Chef recipe for development (but it isn't a very good way to run something for production, since it won't restart if the server reboots).

Initial Data

You can put initial data in db/seeds.rb and load it with the command rake db:seed as part of your recipe. That way, you can start with more than just a completely empty database.

See Populating the Database with seeds.rb for more info.

Updated Mon Aug. 30 2021, 07:36 by ggbaker.