From 6c424bb9beccc73650829a678ebc6081ed777d92 Mon Sep 17 00:00:00 2001 From: Candifloss Date: Mon, 24 Feb 2025 08:03:12 +0000 Subject: [PATCH] Add systemd/sample_ruby_app.service --- systemd/sample_ruby_app.service | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 systemd/sample_ruby_app.service diff --git a/systemd/sample_ruby_app.service b/systemd/sample_ruby_app.service new file mode 100644 index 0000000..e54fef2 --- /dev/null +++ b/systemd/sample_ruby_app.service @@ -0,0 +1,23 @@ +[Unit] +Description=MyApp +After=network.target + +[Service] +Type=simple +User=root + +# App directory +WorkingDirectory=/usr/local/src/my_app + +# Load the rvm environment when `systemctl start` is called +ExecStart=/bin/bash -lc '/usr/local/rvm/rubies/ruby-3.0.2/bin/bundle exec rackup -p 6080 -o 0.0.0.0 -s puma -E production' + +# Restart when the app or service fails +Restart=always + +# Environment variables the service or app must use +Environment=RAILS_ENV=production + +# `Install` is optional for a service, and it's used here because it's required here. +[Install] +WantedBy=multi-user.target \ No newline at end of file