mina-deploy / mina-version_managers Goto Github PK
View Code? Open in Web Editor NEWMina plugin for version manager tasks
Home Page: https://rubygems.org/gems/mina-version_managers
License: MIT License
Mina plugin for version manager tasks
Home Page: https://rubygems.org/gems/mina-version_managers
License: MIT License
Hello,
I'd like to request some kind of abstraction to execute the right interpreter server-side.
The problem I'm trying to fix is the following (from one of my current projects):
namespace :systemd do
set :service_name, -> { fetch(:application_name) }
desc 'Install systemd unit'
task :setup do
command %{mkdir -p "$HOME/.config/systemd/user"}
end
unit_file = <<-UNIT.gsub(/^ {6}/, '').strip
[Unit]
Description=Rails application server: #{fetch(:service_name)}
After=network.target
[Service]
Type=simple
Environment=RAILS_ENV=#{fetch(:rails_env)}
EnvironmentFile=-#{fetch(:shared_path)}/.env
WorkingDirectory=#{fetch(:current_path)}
ExecStart=-/usr/bin/env #{'rbenv exec ' if fetch(:rbenv_path)}bundle exec puma --bind "unix://#{fetch(:shared_path)}/tmp/sockets/puma.sock" --config "#{fetch(:current_path)}/config/puma.rb" --control-url "unix://#{fetch(:shared_path)}/tmp/sockets/pumactl.sock" --pidfile "#{fetch(:shared_path)}/tmp/pids/puma.pid" --state "#{fetch(:shared_path)}/tmp/sockets/puma.state" --quiet
Restart=always
SyslogIdentifier=#{fetch(:service_name)}
[Install]
WantedBy=multi-user.target
UNIT
command %{echo #{Shellwords.escape(unit_file)} > "$HOME/.config/systemd/user/#{fetch(:service_name)}.service"}
command %{systemctl --user daemon-reload}
command %{systemctl --user enable #{fetch(:service_name)}.service}
end
…
In case anyone's wondering: this unit doesn't use Type=notify
or socket activation because of incompatibility with JRuby.
As you can tell, I had to hack around to ensure the ExecStart
command line ends up being something like:
ExecStart=-/usr/bin/env rbenv exec bundle exec puma <bunch of options>
If I switch to another version manager, I would have to rewrite this too. It'd be nice if I could write:
ExecStart=-#{fetch(:ruby_prefix)} puma <bunch of options>"
…and that this would automatically work for rbenv, chruby, asdf, …
In addition:
Thanks for your consideration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.