Commandline works fine:
# doas -u apps sh -c 'cd /home/apps/coolest_app_ever ; /home/apps/.gem/bin/bundle exec
/home/apps/.gem/bin/pumactl --config-file /home/apps/coolest_app_ever/config/puma.rb start'
Puma starting in single mode...
* Version 4.3.3 (ruby 2.6.6-p146), codename: Mysterious Traveller
* Min threads: 0, max threads: 16
* Environment: production
* Listening on tcp://127.0.0.1:8003
* Listening on ssl://127.0.0.1:8004?key=config/ssl/coolest_app_ever.key&cert=config/ssl/coolest_app_ever.crt
Use Ctrl-C to stop
#!/bin/sh
# http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/infrastructure/templates/rc.template?rev=1.12&content-type=text/x-cvsweb-markup
# Define PATH explicitly to give Bundler access to already installed gems (doesn't work)
daemon="doas -u apps sh -c 'cd /home/apps/coolest_app_ever ; export PATH=/home/apps/.gem/bin/:/bin:/usr/bin:
/usr/local/bin ; env ; /home/apps/.gem/bin/bundle exec /home/apps/.gem/bin/pumactl --config-file
/home/apps/coolest_app_ever/config/puma.rb'"
rc_bg=YES
. /etc/rc.d/rc.subr
rc_start() {
${rcexec} "${daemon} start"
}
[...]
rc_cmd $1
# rcctl -d start coolest_app_ever
doing _rc_parse_conf
doing _rc_quirks
coolest_app_ever_flags empty, using default ><
doing _rc_parse_conf /var/run/rc.d/coolest_app_ever
doing _rc_quirks
doing rc_check
LOGNAME=apps
DOAS_USER=apps
HOME=/home/apps
OLDPWD=/home/apps
PWD=/home/apps/coolest_app_ever
PATH=/home/apps/.gem/bin/:/bin:/usr/bin:/usr/local/bin
SHELL=/usr/local/bin/zsh
TERM=xterm
USER=apps
Could not find rake-13.0.1 in any of the sources
Run `bundle install` to install missing gems.
coolest_app_ever
doing rc_start
doing _rc_wait start
doing rc_check
LOGNAME=apps
LOGNAME=apps
DOAS_USER=apps
HOME=/home/apps
OLDPWD=/home/apps
PWD=/home/apps/coolest_app_ever
PATH=/home/apps/.gem/bin/:/bin:/usr/bin:/usr/local/bin
SHELL=/usr/local/bin/zsh
TERM=xterm
USER=apps
DOAS_USER=apps
HOME=/home/apps
OLDPWD=/home/apps
PWD=/home/apps/coolest_app_ever
PATH=/home/apps/.gem/bin/:/bin:/usr/bin:/usr/local/bin
SHELL=/usr/local/bin/zsh
TERM=xterm
USER=apps
Could not find rake-13.0.1 in any of the sources
Could not find rake-13.0.1 in any of the sources
Run `bundle install` to install missing gems.
Run `bundle install` to install missing gems.
doing _rc_rm_runfile
(failed)