Commit Graph

24 Commits

Author SHA1 Message Date
taitus
84a88ee1fb Remove overridden puma.service.erb template
We remove our custom puma.service.erb template located at
lib/capistrano/templates, as the upstream capistrano3-puma gem (v6.2.0)
now supports all the adjustments we previously needed.

This template was originally copied and modified in
PR #5842 (Bump capistrano3-puma from 5.2.0 to 6.0.0),
with the following relevant changes:

1. WatchdogSec=0
We disabled systemd's watchdog feature by setting WatchdogSec=0.
This is now covered upstream since v6.1.0 via:
> <% if fetch(:puma_systemd_watchdog_sec) && fetch(:puma_systemd_watchdog_sec) > 0 %>
> WatchdogSec=<%= fetch(:puma_systemd_watchdog_sec) %>
> <% end %>

To preserve the same behavior, we now explicitly set:
> set :puma_systemd_watchdog_sec, 0
in config/deploy.rb, instead of relying on the template override.

2. SyslogIdentifier=puma
In our custom template, we replaced the default line:
> SyslogIdentifier=<%= fetch(:puma_service_unit_name) %>
with:
> SyslogIdentifier=puma

This was done to avoid introducing a new config variable
in the installer. However, now that we want to remove the overridden template,
we must accept the default behavior from the gem:
> set :puma_service_unit_name, -> { "puma_#{fetch(:application)}_#{fetch(:stage)}" }

As a result, the generated SyslogIdentifier will change from "puma" to something
like "puma_consul_staging".

The only implication is that we'll open a PR in the installer
to replace the hardcoded "puma" with the dynamic default,
so everything stays consistent.

Another option would be to override puma_service_unit_name
with "puma" to keep the SyslogIdentifier exactly as before.
However, this would also affect the names of the systemd services and sockets
(e.g., puma.service instead of puma_consul_staging.service),
which may lead to conflicts or require manual cleanup steps like disabling
and removing the old units. For now, we prefer to avoid that.

3. After=network.target
We had removed the "syslog.target" from the "After=" directive,
as we didn't depend on syslog.

However, keeping "After=syslog.target network.target" does not negatively impact us,
since Puma logs to files directly using StandardOutput=append:....
So we can also adopt the default value from template here.

4. ExecStart
In version 6.2.0, a small change was made to the template logic for the ExecStart line.
This change does not affect us. Since we don't define puma_use_login_shell,
the behavior remains exactly the same as before.

With these changes already supported in the gem, we no longer need
a local copy of the puma service template.
2025-07-07 15:05:01 +02:00
taitus
d1693f06fc Keep After=network.target in Puma systemd unit
We keep After=network.target instead of the new default
After=syslog.target network.target introduced in capistrano3-puma 6.0.0.

Our Puma service doesn't depend on syslog availability because it writes
logs directly to files using:

> StandardOutput=append:...
> StandardError=append:...

So the syslog.target dependency is unnecessary in our case.
2025-06-02 15:38:34 +02:00
taitus
b99d2e43bb Keep SyslogIdentifier=puma for compatibility
We keep using SyslogIdentifier=puma instead of the default
value from capistrano3-puma 6.0.0, which is based on
puma_service_unit_name (usually "<app>_puma_<env>").

This avoids introducing a new config variable in the installer
and is enough for our current use case, where we don't run
multiple environments on the same server.
2025-06-02 15:38:34 +02:00
taitus
7712e7a3cf Set WatchdogSec=0 in Puma systemd unit template
The original template sets WatchdogSec=10, which causes systemd to kill
Puma if it remains silent for more than 10 seconds.

This commit changes WatchdogSec to 0 in our custom puma.service.erb,
disabling the watchdog feature. This prevents unwanted restarts and
avoids errors like:
> consul_puma_staging.service: Failed with result 'watchdog'
2025-06-02 15:38:34 +02:00
taitus
034ecfeacd Copy Puma systemd unit template from capistrano3-puma
This commit copies the default puma.service.erb template from the
capistrano3-puma gem into lib/capistrano/templates. This allows us to
customize the generated systemd unit file during deploy.

Note that we are also removing the `:puma_conf` variable from `config/deploy.rb`,
as the new ExecStart line in the systemd template (based on capistrano3-puma 6.0.0)
does not rely on a separate Puma config file. The command now directly invokes:

  ExecStart=<%= expanded_bundle_command %> exec puma -e <%= fetch(:puma_env) %>

This replaces the older format used in 5.2.0:

  ExecStart=<%= expanded_bundle_command %> exec --keep-file-descriptors puma -C <%= fetch(:puma_conf) %>

which required explicitly setting the Puma config path.
2025-06-02 15:33:36 +02:00
Javi Martín
b36e659f4e Use puma instead of unicorn
Puma is the server we use in the development environment, so this way we
don't need to maintain two servers. Furthermore, puma seems to offer a
few advantages over unicorn (like multithreading) and no disadvantages.
2019-10-12 16:50:49 +02:00
Javi Martín
94a7e13dce Update capistrano's restart unicorn task
Our current unicorn task wasn't working in some cases. We also had a
version in the `capistrano` branch, which was the one we recommended.
However, that version assumed RVM, a certain ruby version and a certain
deploy folder were used. This version uses `bundle exec` and variables
like `release_path`, so it does not depend on any specific
configuration.

Even if we're replacing unicorn with puma, I wanted to make this change
in case we need it as a reference in the future.
2019-10-10 21:01:42 +02:00
decabeza
f0305e36a6 Replace capistrano task restart file 2019-04-24 14:04:01 +02:00
Julian Herrero
002e16ce30 Use double quotes in lib/ 2019-03-15 10:29:07 +01:00
voodoorai2000
d0dbb16d72 Add unicorn restart task to deploy namespace 2018-09-21 18:11:21 +02:00
voodoorai2000
e3c6fc77c6 Update Unicorn restart task
We are using a simple unicorn.rb file in the Installer, which requires a different way of restarting the server

This task is still a little limited and hackish but it does the job for now 😌

We are killing any existing unicorn process and starting unicorn. It checks for existing processes in both the standard consul folder and in the capistrano `current` folder, and skipping any exception if unicorn was not running.
2018-09-21 15:39:56 +02:00
Angel Perez
c643656067 Add Capistrano task to automate maintenance mode 2017-11-17 13:11:17 -04:00
rgarcia
012d5297ed removes capistrano template configuration 2017-05-04 01:21:08 +02:00
Juanjo Bazán
1e0ac137bb removes beta testers functionality 2015-10-29 13:19:00 +01:00
Juanjo Bazán
31788ff7eb changes capistrano task description 2015-10-15 16:40:34 +02:00
kikito
12bf3856c1 adds a capistrano task to clear memcached easily 2015-09-07 13:15:56 +02:00
rgarcia
ebddcfa1d0 cleans up delayed_jobs for capistrano 2015-09-04 00:27:14 +02:00
rgarcia
feaf4465f3 adds capistrano tasks and hooks for delayed_jobs 2015-09-03 23:26:28 +02:00
rgarcia
a82eac8e16 adds capistrano task to upload secrets.yml 2015-09-01 20:12:44 +02:00
rgarcia
e80fe261c8 removes old assets when deploying 2015-09-01 15:34:27 +02:00
rgarcia
358f8cc392 symlink beta-testers file after a deploy 2015-08-31 14:03:08 +02:00
rgarcia
d0fa2a3ae6 adds capistrano task to upload beta tester list 2015-08-29 15:54:17 +02:00
rgarcia
c39657cf5c fixes capistrano unicorn restart task 2015-08-21 17:06:35 +02:00
Manuel Maldonado
4b501ee46b Capistrano recipe 2015-08-12 01:36:42 +02:00