capistrano-systemd-ng 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/LICENSE +2 -1
- data/README.md +42 -2
- data/lib/capistrano/systemd/multiservice/system_service.rb +1 -1
- data/lib/capistrano/systemd/multiservice/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb84da1ac6f33cc067142d9dd9348c7815583319ca23e64c2e90f1c30799810f
|
4
|
+
data.tar.gz: 293ed348d3871183e49ae5ce4ab4c7bed5ba31c7734306c4f50b3c8aff7fd61e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c742af5b9d483b4a8ae1e439bce8bf59cc6236e8a8a98de56e9d7f4935966006aa2a9599ef9edd4fb66d3acac4b5eff590fd98256a13314801b80fd5a493edc
|
7
|
+
data.tar.gz: 8b7a28307b5bbe1edf285cb7838e961dd76c9c3ead8981c9d29c53751475dc918ac1d92d9eeaed92cf980751793fd0976b59fa3acbeb31e5f5fdebc52e552f92
|
data/.github/workflows/ci.yml
CHANGED
data/LICENSE
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2023 Gaspard d'Hautefeuille, Danil Pismenny
|
4
|
+
Copyright (c) 2016-2022 YAMADA Tsuyoshi
|
4
5
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# capistrano-systemd-ng
|
2
2
|
|
3
|
-
[](https://rubygems.org/gems/capistrano-systemd-ng) [](https://github.com/HLFH/capistrano-systemd-ng/actions/workflows/ci.yml)
|
4
4
|
|
5
5
|
This gem adds capistrano tasks to control multiple services with systemd.
|
6
6
|
This gem supports capistrano > 3.17.0.
|
@@ -23,7 +23,13 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
|
26
|
+
Please activate the Capistrano `app`role in `config/deploy/staging.rb`and/or `config/deploy/production.rb`:
|
27
|
+
```
|
28
|
+
role :app, %w{deploy@example.com}
|
29
|
+
```
|
30
|
+
Replace `example.com` by the domain name used by your server.
|
31
|
+
|
32
|
+
And add these lines to your Capfile:
|
27
33
|
|
28
34
|
```ruby
|
29
35
|
require "capistrano/systemd/multiservice"
|
@@ -83,6 +89,40 @@ If using the user service type services will be installed in your users home dir
|
|
83
89
|
Systemd commands on those services can be run by passing a `--user` flag, e.g. ```systemctl --user list-unit-files```
|
84
90
|
Nothing else in setup should require change and Capistrano tasks should remain the same as when installing system services.
|
85
91
|
|
92
|
+
Example of user service in `config/systemd/passenger.service.erb`:
|
93
|
+
```
|
94
|
+
[Unit]
|
95
|
+
Description=Passenger Standalone Application Server for <%= fetch(:application) %>
|
96
|
+
After=network.target
|
97
|
+
|
98
|
+
[Service]
|
99
|
+
Type=forking
|
100
|
+
Environment=RAILS_ENV=<%= fetch(:rails_env) %>
|
101
|
+
Environment=PWD=<%= current_path %>
|
102
|
+
WorkingDirectory=<%= current_path %>
|
103
|
+
PIDFile=/run/passenger/devopsy.pid
|
104
|
+
ExecStart=/home/deploy/.asdf/bin/asdf exec bundle exec passenger start -d --pid-file /run/passenger/devopsy.pid -e production -p 3002 --instance-registry-dir /run/passenger
|
105
|
+
ExecStop=/home/deploy/.asdf/bin/asdf exec bundle exec passenger stop --pid-file /run/passenger/devopsy.pid
|
106
|
+
PrivateTmp=yes
|
107
|
+
|
108
|
+
[Install]
|
109
|
+
WantedBy=default.target
|
110
|
+
```
|
111
|
+
For user services, the target should be `default.target`, not `multi-user.target`.
|
112
|
+
And no `User` or `Group` should be mentioned to avoid errors.
|
113
|
+
|
114
|
+
It is in `config/deploy.rb` that you should have the user set, and for that example:
|
115
|
+
```
|
116
|
+
set :user, "deploy"
|
117
|
+
after 'deploy:publishing', 'systemd:passenger:restart'
|
118
|
+
```
|
119
|
+
|
120
|
+
And in the `Capfile`, you should have these:
|
121
|
+
```
|
122
|
+
require "capistrano/systemd/multiservice"
|
123
|
+
install_plugin Capistrano::Systemd::MultiService.new_service("passenger", service_type: "user")
|
124
|
+
```
|
125
|
+
|
86
126
|
## Capistrano Tasks
|
87
127
|
|
88
128
|
With `install_plugin Capistrano::Systemd::MultiService.new_service("example1")`,
|
@@ -77,7 +77,7 @@ module Capistrano
|
|
77
77
|
|
78
78
|
def setup
|
79
79
|
fetch(:"#{prefix}_units_src").zip(fetch(:"#{prefix}_units_dest")).each do |src, dest|
|
80
|
-
buf = StringIO.new(ERB.new(File.read(src),
|
80
|
+
buf = StringIO.new(ERB.new(File.read(src), trim_mode: '-', eoutvar: '@output_buffer').result(binding))
|
81
81
|
setup_service buf, src, dest
|
82
82
|
end
|
83
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-systemd-ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gaspard d'Hautefeuille
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-06-
|
12
|
+
date: 2023-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|