prun-ops 0.3.1 → 0.3.2

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: 611578094a2a464881d040c4198a388ea290a325cd12226addc6821bc99b75e9
4
+ data.tar.gz: f7a716870e424f577ad27df87b86588a13a1fabbc45158066dfa944fe5cc3c99
5
5
  SHA512:
6
- metadata.gz: f5a71ab8a859f032d2c1a66221b57ecb432f86e8c9b32efb1d0fe183528d46f1b488c8dedf51d4b0f23e379000814990687dacf2891b2b82e0b511d35e38c99e
7
- data.tar.gz: d6b9fef0e7589eeca85c0ffd4e952c71fc1c0964dbbfcea1bb79751297da844be127a94e974b0cb732ae18e56233dde9dfff4bab75dfef13bb8716f69c3ea8a0
6
+ metadata.gz: 284f0a9aea2ae885ac64871bdbf98ea121d8184623df22c3e58cba73c66690881bb6fe769d6fe771db0871375ff7103836bdfaf849782279e8a32879c1d0453a
7
+ data.tar.gz: 6ceac8d461ad1896e53a3557363f857bf2ac46c5d7e3b763f42f4193858eadb2af0b6c7e2169fb8fb7787b98b4b65d58ef468d5d78d61a8e99f040791238fb02
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module PrunOps
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
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.2
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-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler