
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
capistrano-simple_systemd
Advanced tools
Capistrano tasks to control mutiple services with systemd
Add this line to your application's Gemfile:
gem 'capistrano-simple_systemd'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-simple_systemd
Add this line to your Capfile:
require "capistrano/simple_systemd"
Service files are defined as ERB templates ending with .service.erb
in config/systemd
.
Sample erb template
[Unit]
Description=SMS Service
After=network.target
[Service]
Type=simple
User=deploy
Environment=RACK_ENV=<%= fetch(:stage) %>
WorkingDirectory=<%= current_path %>
ExecStart=<%= "#{fetch(:home_dir)}/.rvm/bin/rvm #{fetch(:rvm_ruby_version)} do bundle exec #{current_path}/bin/sms_service"%>
TimeoutSec=10
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sms-service
[Install]
WantedBy=multi-user.target
PLEASE NOTE: Currently only files with the .service.erb
extension are considered as service file templates. Others like .target.erb
aren't supported yet
The following tasks are provided out of the box
cap systemd:reload-daemons # run sudo systemctl daemon-reload
cap systemd:upload # upload all provided service files
cap systemd:remove # remove all provided service files
cap systemd:enable # enable all provided service files
cap systemd:disable # disable all provided service files
The following tasks will be created for each service template detected in the config/systemd
directory
cap systemd:{service}:disable
cap systemd:{service}:enable
cap systemd:{service}:reload
cap systemd:{service}:reload-or-restart
cap systemd:{service}:restart
cap systemd:{service}:start
cap systemd:{service}:stop
cap systemd:{service}:upload
cap systemd:{service}:remove
Where service
is the base name of the service template.
For example, placing puma.service.erb
in the template directory will yield the following tasks
cap systemd:puma:disable
cap systemd:puma:enable
cap systemd:puma:reload
cap systemd:puma:reload-or-restart
cap systemd:puma:restart
cap systemd:puma:start
cap systemd:puma:stop
cap systemd:puma:upload
cap systemd:puma:remove
Run
cap {stage} systemd:upload
Or
cap {stage} setup
to compile and upload the service files. Service files will be prefixed with whichever value is in service_file_prefix
and uploaded to /etc/systemd/system
. The variable service_file_prefix
by default is set to whatever is in the application
configuration variable.
So if application
is set to paypoint
then puma.service.erb
will be uploaded to /etc/systemd/system/paypoint-puma.service
.
service_file_prefix
can be configured. E.g.
set :service_file_prefix, 'paypoint-app'
Services are enabled after upload by invoking systemd:{service}:enable
. This behaviour can be disabled by setting enable_services_after_upload
to false.
set :enable_services_after_upload, false
All contributions are welcome. Improvements are especially welcome. To contribute
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that capistrano-simple_systemd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.