roda-templates/README.md
2024-09-05 23:23:57 -05:00

49 lines
1.3 KiB
Markdown

# roda-templates
For the single file app template, really the only file you need is the config.ru and run it with puma.
## Setup
### Prereq installs
Will need ruby; install it via package manager or a ruby manager like rbenv/ruby-build. Will need the roda gem, and then an application server such as puma (recommended), gunicorn, or passenger. My examples will use system ruby and puma.
#### Option 1: System wide packages
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 ruby ruby-rack puma
sudo gem install roda
```
#### Option 2: Bundler
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
```
## Run it
In the project root directory:
```
puma
```
This default to development mode. Run it in production mode with:
```
RACK_ENV=production puma
```
For development, just run it like that. For production, probably want to set up a systemd service.
### 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.