diff --git a/README.md b/README.md index 36d6cd9..a27ae65 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ Will need ruby; install it via package manager or a ruby manager like rbenv/ruby #### Option 1: System wide packages -With this example, will basically just ignore the project's Gemfile. Debian 12 has a pretty current ruby version, just use it. It will get pulled in as a required package for puma. +With this example, will basically just ignore the project's Gemfile. Debian 12 has a pretty current ruby version so just using it. ``` -sudo apt install puma ruby-rack +sudo apt install ruby ruby-rack puma sudo gem install roda ``` @@ -22,6 +22,7 @@ Run the bundle command from the project's root directory ``` sudo apt install ruby ruby-bundler +bundle config set --local path 'vendor/bundle' bundle install ``` @@ -38,3 +39,7 @@ This default to development mode. Run it in production mode with: ``` RACK_ENV=production puma ``` + +### Run it with systemd in production + +Copy the example myapp.service file to `/etc/systemd/system/` and edit accordingly. The example assumes a user named "myapp" with a group name "myapp", the application files are in `/opt/myapp/`, and puma is the system puma. diff --git a/myapp.service b/myapp.service new file mode 100644 index 0000000..ff766c0 --- /dev/null +++ b/myapp.service @@ -0,0 +1,17 @@ +[Unit] +Description=My roda template +After=network.target + +[Service] +User=myapp +Group=myapp +WorkingDirectory=/opt/myapp +Environment=RACK_ENV=production + +ExecStart=/usr/bin/puma +TimeoutStopSec=300 +KillMode=mixed +Restart=on-failure + +[Install] +WantedBy=multi-user.target