capistrano-addon-fm 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bd77cf936fe7b355ceef1d43344d55af39f0040afaebdc441154e2571df8280
4
- data.tar.gz: 6430cd5a453b92599abe528d09fdac247719f1bcca27a9d6e8ed93fd42aecef3
3
+ metadata.gz: 5701d4dd587e45f260c6d05bded677f6e2885b1ef22f0d7b75f2a8997149c95b
4
+ data.tar.gz: f19ab3fb1ba5e7b83afcd908e863023b3effcb19e4becb66a4b69a035957396b
5
5
  SHA512:
6
- metadata.gz: c6e61dc7bab5dfe662f80b1ecc857c9f4241bf2f8ade82f42122ef3676edd221411fd4de924ccd4de553ff513b450ce5f26a0a8e0c9de298d8a09d2bb417dfa4
7
- data.tar.gz: d7f8490624c7f01adbb261cc159e335f27c87aa42fc140e1b96c6fa94dc0466120ce4a8cc215542e2b4de32796926de01ebd696bd10a5143dc5f2e253c73d311
6
+ metadata.gz: 2e57f2376477429d2557d52de9c75eacf4bfff991040a41f6c417e1c790ca8cd6243ac89e2130af361f0a10c7bdf5dae26d93bab8446ce02c7356c21b03ab523
7
+ data.tar.gz: 772dea6e4d0fed85789331725dd40bd8b80bedb14fda966d08711abd7078992a394371fde20d4e5412d46f3251255fd06360a1255d3be7f6672e07bcf6e9f305
data/CHANGELOG.md CHANGED
@@ -1,9 +1,21 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.1.3] - 2025-08-26
5
+ ### Added
6
+ - fix env-with-secrets : fix release_path (latest)
7
+ - add `cap fm:readme` task that will output addon readme file
8
+ - add `cap fm:readme:tasks` task that will output addon readme file - only tasks part
9
+ - improved readme.md docs
10
+
11
+ ## [0.1.2] - 2025-02-18
12
+ ### Added
13
+ - fix env-with-secrets; add missing php-fpm README text
14
+
4
15
  ## [0.1.1] - 2025-02-18
5
16
  ### Added
6
17
  - add php-fpm tasks
7
- ## [0.1.0] - 2025-02-18
18
+
19
+ ## [0.1.0] - 2025-02-17
8
20
  ### Added
9
21
  - add generic tasks - documented in README.md
data/README.md CHANGED
@@ -17,6 +17,8 @@ require 'capistrano/addon/fm'
17
17
  ## Usage
18
18
 
19
19
  ### this will add new tasks for `cap` command
20
+ #### addon related commands (no stage needed):
21
+ cap fm:readme Will output this readme file
20
22
  new tasks (example run: cap prod TASK - replace 'prod' with your stage (devel/local/etc))
21
23
  #### supervisor related commands:
22
24
  cap prod supervisor:start Will run supervisorctl `start all`
@@ -57,11 +59,11 @@ new tasks (example run: cap prod TASK - replace 'prod' with your stage (devel/lo
57
59
  cap prod system:disk_space: all|df|zfs|btrfs
58
60
  cap prod system:connections:count: total|per_address|via_ss
59
61
  #### env-with-secrets:
60
- cap env:upload Will upload .env file to server and decrypt
61
- cap env:upload:diff Will run `diff` command to server's .env versus local .env - decrypted
62
- cap env:local:encrypt_file Will encrypt `cap-secrets-LOCAL.txt` to `ap-secrets.enc.b64`
63
- cap env:local:decrypt_file Will decrypt `ap-secrets.enc.b64` into `cap-secrets-LOCAL.txt`
64
- cap env:local:secrets cat `cap-secrets-LOCAL.txt`
62
+ cap prod env:upload Will upload .env file to server and decrypt
63
+ cap prod env:upload:diff Will run `diff` command to server's .env versus local .env - decrypted
64
+ cap prod env:local:encrypt_file Will encrypt `cap-secrets-LOCAL.txt` to `ap-secrets.enc.b64`
65
+ cap prod env:local:decrypt_file Will decrypt `ap-secrets.enc.b64` into `cap-secrets-LOCAL.txt`
66
+ cap prod env:local:secrets cat `cap-secrets-LOCAL.txt`
65
67
  #### custom related commands:
66
68
  cap prod cat:env Run `cat /var/www/*/*/.env`
67
69
  cap prod empty_file:check Run `la -lah on nginx, fpm, laravel and var/www/*/current/logs/*`
@@ -0,0 +1 @@
1
+ set :stage, :'fm-addon-stage'
@@ -42,6 +42,7 @@ namespace "env" do
42
42
  base64_file = fetch(:file_to_decrypt, fetch(:default_file_to_decrypt))
43
43
  encrypted_file = base64_file.gsub('.b64', '')
44
44
  decrypted_file_tmp = "cap-secrets-tmp.txt"
45
+ latest_release_path = "#{shared_path.sub(/shared$/, 'releases')}/#{capture("ls -1 #{shared_path.sub(/shared$/, 'releases')} | sort -r | head -n 1").strip}"
45
46
 
46
47
  # Read the .env file
47
48
  env_file = capture(:cat, "#{shared_path}/.env.tmp")
@@ -50,7 +51,7 @@ namespace "env" do
50
51
  encryption_key = File.read(encryption_key_file).strip
51
52
 
52
53
  # Decode and decrypt cap-secrets.enc.b64 into a temporary file cap-secrets-tmp.txt
53
- execute "base64 -d #{release_path}/#{base64_file} > #{shared_path}/#{encrypted_file} && openssl enc -aes-256-cbc -d -pbkdf2 -in #{shared_path}/#{encrypted_file} -out #{shared_path}/#{decrypted_file_tmp} -pass pass:#{encryption_key}"
54
+ execute "base64 -d #{latest_release_path}/#{base64_file} > #{shared_path}/#{encrypted_file} && openssl enc -aes-256-cbc -d -pbkdf2 -in #{shared_path}/#{encrypted_file} -out #{shared_path}/#{decrypted_file_tmp} -pass pass:#{encryption_key}"
54
55
 
55
56
  # Read the secrets from the temporary cap-secrets-tmp.txt file
56
57
  secrets = {}
@@ -136,7 +137,7 @@ namespace "env" do
136
137
  use_local_path = fetch(:local_path, fetch(:default_local_path))
137
138
  Dir.chdir(use_local_path) do
138
139
  file = fetch(:file_to_encrypt, fetch(:default_file_to_encrypt))
139
- puts "Contents of file #{use_local_path}/#{file}:\n\n"
140
+ puts "Contents of file #{use_local_path}#{file}:\n\n"
140
141
  system("cat #{file}")
141
142
  end
142
143
  end
@@ -3,7 +3,7 @@
3
3
  module Capistrano
4
4
  module Addon
5
5
  module Fm
6
- VERSION = "0.1.2"
6
+ VERSION = "0.1.3"
7
7
  end
8
8
  end
9
9
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  require_relative "fm/version"
4
4
 
5
+ load File.expand_path("fm/stages/fm-addon-stage.rb", __dir__)
6
+ # set :stage, :'fm-addon-stage' unless fetch(:stage, nil)
7
+
5
8
  # Load all .rake files from the tasks directory
6
9
  Dir.glob(File.expand_path("./fm/tasks/**/*.rake", __dir__)).each { |r| load r }
7
10
 
@@ -13,3 +16,27 @@ module Capistrano
13
16
  end
14
17
  end
15
18
  end
19
+
20
+ namespace 'fm' do
21
+ task 'readme' do
22
+ run_locally do
23
+ gem_root = File.expand_path('../../../', __dir__)
24
+ Dir.chdir(gem_root) do
25
+ system('cat readme.md')
26
+ end
27
+ end
28
+ end
29
+ task 'readme:tasks' do
30
+ run_locally do
31
+ gem_root = File.expand_path('../../../', __dir__)
32
+ Dir.chdir(gem_root) do
33
+ system("awk '
34
+ /^## Usage$/ { print; in_section=1; next }
35
+ /^## Configuration$/ { exit }
36
+ in_section { print }
37
+ ' README.md
38
+ ")
39
+ end
40
+ end
41
+ end
42
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-addon-fm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florin Motoc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-18 00:00:00.000000000 Z
11
+ date: 2025-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -38,6 +38,7 @@ files:
38
38
  - Rakefile
39
39
  - lib/capistrano/addon.rb
40
40
  - lib/capistrano/addon/fm.rb
41
+ - lib/capistrano/addon/fm/stages/fm-addon-stage.rb
41
42
  - lib/capistrano/addon/fm/tasks/custom.rake
42
43
  - lib/capistrano/addon/fm/tasks/env-with-secrets.rake
43
44
  - lib/capistrano/addon/fm/tasks/fpm.rake