prun-ops 0.3.1 → 0.3.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: 18f2c5330be90923eaf33001d28259a793106d1f6fb29422e63a62cc542c51fd
4
- data.tar.gz: 67c617c200371c58e64467ea47edebdcd62f7cddde771d9b64f210ce2d00723e
3
+ metadata.gz: 206bf28d664f34f2b4a8a445208f153cf8a3d0997035e511686edc419b4ed843
4
+ data.tar.gz: a35e887797566338c0b4b333854d5612356520de96b6a54254512cad20498a23
5
5
  SHA512:
6
- metadata.gz: f5a71ab8a859f032d2c1a66221b57ecb432f86e8c9b32efb1d0fe183528d46f1b488c8dedf51d4b0f23e379000814990687dacf2891b2b82e0b511d35e38c99e
7
- data.tar.gz: d6b9fef0e7589eeca85c0ffd4e952c71fc1c0964dbbfcea1bb79751297da844be127a94e974b0cb732ae18e56233dde9dfff4bab75dfef13bb8716f69c3ea8a0
6
+ metadata.gz: 814f97e9446729737268609f01cd86d7454be4f3bfab7c7f8f9396279d1560a81f038f2a24163cbd092262d209cdd8e075a1b65a255aa6f10d1ddb833124c9df
7
+ data.tar.gz: 38656a3d1bb311a2efdd76c48ffa6ae8f132a15dbd75bb8d4142c07b0a46badca136fa0bb8126bc67421f5dbc6051a3ff2afac2cf1a1563dc7878f62e7376ca4
data/README.md CHANGED
@@ -49,6 +49,28 @@ Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
49
49
  Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
50
50
  ```
51
51
 
52
+ In order to configure RVM and PUMA you have here the params:
53
+
54
+ ```ruby
55
+ set :rvm_ruby_version, "ruby-3.2.2"
56
+ set :rvm_custom_path, "/usr/share/rvm"
57
+
58
+
59
+ #PUMA:
60
+ # Run 'cap production puma:systemd:config' to setup teh linux service
61
+
62
+ # set :puma_threads, [4, 16]
63
+ # set :puma_workers, 0
64
+ set :puma_service_unit_type, "notify"
65
+ set :puma_access_log, "#{release_path}/log/puma.access.log"
66
+ set :puma_error_log, "#{release_path}/log/puma.error.log"
67
+ set :puma_bind, "tcp://0.0.0.0:3000"
68
+ # set :puma_conf, "#{shared_path}/puma.rb"
69
+ # set :puma_state, "#{shared_path}/tmp/pids/puma.state"
70
+ # set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
71
+ # set :puma_preload_app, true
72
+ ```
73
+
52
74
  Notice that you are adding all prun-ops tasks with the line `require 'capistrano/prun-ops'`
53
75
 
54
76
  Your config/deploy/production.rb:
@@ -82,7 +104,7 @@ Secondary tasks:
82
104
  - `cap [stg] nginx:[start|stop|restart]` start/stop nginx
83
105
  - `cap [stg] nodejs:install` install node
84
106
  - `cap [stg] redis:install` install redis server
85
- - `cap [stg] app:prepare`(DEPRECATED) create init scripts
107
+ - `cap [stg] puma:install` install puma server
86
108
  - `cap [stg] app:db_prepare`(DEPRECATED) database first load
87
109
  - `cap [stg] nginx:cert` create SSL certificates with [Let's Encrypt](https://letsencrypt.org/) and confiture nginx
88
110
  - `cap [stg] nginx:ssl`(DEPRECATED) configure nginx with SSL certificates
@@ -265,3 +287,7 @@ require 'capistrano/prun-ops'
265
287
  ### v0.2.8
266
288
 
267
289
  - Bastion command
290
+
291
+ ### v0.3.3
292
+
293
+ - Including Cred to easy manage encrypted credentials
@@ -1,17 +1,5 @@
1
1
  namespace :app do
2
2
 
3
- task :prepare do
4
- on roles(:app) do
5
- template 'app_init.sh', "/etc/init.d/#{fetch :application}"
6
- execute <<-EOBLOCK
7
- sudo thin config -C /etc/thin/#{fetch :application}.yml -c /var/www/#{fetch :application}/current -l log/thin.log -e #{fetch :stage} --servers 1 --port 3000
8
- sudo chmod a+x /etc/init.d/#{fetch :application}
9
- sudo update-rc.d #{fetch :application} defaults
10
- sudo systemctl daemon-reload
11
- EOBLOCK
12
- end
13
- end
14
-
15
3
  task :db_prepare do
16
4
  on roles(:app) do
17
5
  invoke 'deploy:starting'
@@ -25,7 +25,7 @@ namespace :postgres do
25
25
  execute <<-EOBLOCK
26
26
  sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /etc/postgresql/#{version}/main/postgresql.conf
27
27
  sudo sed -i "s/local all all peer/local all all md5/" /etc/postgresql/#{version}/main/pg_hba.conf
28
- sudo sed -i "s/host all all 127.0.0.1/32 md5/host all all all md5/" /etc/postgresql/#{version}/main/pg_hba.conf
28
+ sudo sed -i "s/host all all 127.0.0.1/32 scram-sha-256/host all all all scram-sha-256/" /etc/postgresql/#{version}/main/pg_hba.conf
29
29
  sudo sed -i "s/ssl = on/ssl = off/" /etc/postgresql/#{version}/main/postgresql.conf
30
30
  sudo service postgresql restart
31
31
  EOBLOCK
@@ -36,6 +36,8 @@ namespace :postgres do
36
36
  EOBLOCK
37
37
  execute <<-EOBLOCK
38
38
  sudo -u postgres psql -c "create database #{database};"
39
+ sudo -u postgres psql -c "grant all privileges on database #{database} to #{username};"
40
+ sudo -u postgres psql -c "alter user #{username} with superuser;"
39
41
  EOBLOCK
40
42
 
41
43
  invoke 'postgres:restart'
@@ -9,7 +9,7 @@ def template(template_name, target_path)
9
9
  file = File.read("lib/capistrano/config/templates/#{template_name}.erb")
10
10
  end
11
11
 
12
- template = ERB.new file, nil, "%"
12
+ template = ERB.new file, nil, trim_mode: "%"
13
13
  rendered = template.result(binding)
14
14
  tmp_file = "/tmp/#{SecureRandom.hex}.#{template_name}"
15
15
  upload! StringIO.new(rendered), tmp_file
data/lib/cred.rb ADDED
@@ -0,0 +1,7 @@
1
+ class Cred
2
+ def self.[](name)
3
+ env_result = Rails.application.credentials.dig(Rails.env.to_sym, name)
4
+ return Rails.application.credentials.dig(name) unless env_result
5
+ env_result
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module PrunOps
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/prun-ops.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "prun-ops/version"
2
+ require "cred"
2
3
 
3
4
  module PrunOps
4
5
  require 'prun-ops/railitie' if defined?(Rails)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prun-ops
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Lebrijo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-03 00:00:00.000000000 Z
11
+ date: 2024-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,6 +156,7 @@ files:
156
156
  - lib/capistrano/diagnosis.rake
157
157
  - lib/capistrano/git.rake
158
158
  - lib/capistrano/prun-ops.rb
159
+ - lib/cred.rb
159
160
  - lib/prun-ops.rb
160
161
  - lib/prun-ops/railitie.rb
161
162
  - lib/prun-ops/version.rb