How to create new rails app in Rails droplet and run it

I recently set up a Ruby on Rails Droplet and I added Bootstrap to it so it would look nice. Then I was trying to add esbuild as the javascript bundler. I don’t know what the default one is. I kept getting errors whenever I tried to install it. I would comment out one thing and other errors would appear. I decided to just create a new Rails project with esbuild and bootstrap added by default. Normally I use “rails server” to run it but the droplet uses systemctl or whatever to make it so the server is always running in the background and I can do other things while it’s running (which is pretty cool). If someone could help me figure out how to install/add esbuild or set up the systemctl thing so I can run my new project that would be very helpful. I don’t know if I can edit this after I submit it or if I should include the errors that I’m getting now.

I would like to have it where the server is running in the background so I can do other things as well. How would I configure systemctl to do that?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
June 5, 2023


As of Rails 7, it uses esbuild as its default JavaScript bundler. If you’re using an older version of Rails, you can add esbuild by adding the esbuild-rails gem to your Gemfile. Then, run bundle install.

Here is a basic setup:

  1. Add gem 'esbuild-rails' to your Gemfile.
  2. Run bundle install to install the new gem.
  3. Run ./bin/esbuild in your terminal to check if esbuild is correctly set up.
  4. Replace javascript_pack_tag with javascript_esbuild_tag in your views.

Systemd is a system and service manager for Linux. You can use it to keep your Rails server running in the background, automatically start it at boot, and restart it if it crashes.

Here’s a basic example of how you can create a systemd service for your Rails app:

Create a new service file. Replace myapp with your application’s name:

  1. sudo nano /etc/systemd/system/myapp.service

Add the following content to the file. Replace /path/to/your/app with the path to your Rails application and myapp with your application’s name:

Description=My Rails App

ExecStart=/usr/local/bin/bundle exec rails s -b


Save and close the file.

Enable the service so it starts at boot:

sudo systemctl enable myapp

Start the service:

sudo systemctl start myapp

You can check the status of your service at any time with systemctl status myapp.

This setup assumes you have installed Ruby, Rails, and Bundler system-wide. If you’re using a version manager like rbenv or rvm, you’ll need to adjust the ExecStart line to source the correct Ruby version.

These steps should get you started. However, there could be other factors causing the issues you’re seeing, and without the specific error messages, it’s difficult to provide a more accurate solution. If these steps don’t resolve your issues, it might be helpful to post the exact errors you’re getting.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel