my-ruby-deployer 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/my-ruby-deployer.rb +55 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd0330fe5840899f6a649f4e5e9ce04039ba883b599d76de530fafea9f703a80
4
- data.tar.gz: 4ac3a19b11c83ffefe2f266b991eff09b1e46a3a349a2e46e6bf65360cd9bac1
3
+ metadata.gz: 9c7008336f0a352aea0d52cd7ee276ce2a639c4e3050bb88e94b709382055a10
4
+ data.tar.gz: 961b17db58794b68f79c8c249eae314226e3dddfe7decb1dd5fab0ca85670c97
5
5
  SHA512:
6
- metadata.gz: 0a6d27889df5a4b81fefc6ef188f21aba08147e903bee5da21fa50ae746bf59af275a932b8b0a63e6763d9640c3a1545680dc8c3214c014dbb764a703059544f
7
- data.tar.gz: 3f553255065000e8cd4aaed5b9cdb1d85698ab5dd634f13dd39eb3283c802516b96488e24c44641b25ecd45dad55b1ac591b429dd0642542edd4c404df914882
6
+ metadata.gz: f79b6e018e37823038939f1b2d84cfd976a52d03715ffc61033c2608297817c98ca1e48544283e21b855985807c84193388f09e0033cb9c44ad9687cd42859af
7
+ data.tar.gz: c13af499354d8371e553f5de98f0b4a36903ced7aee4e52d52d6076f6360e1ea6fc092c1bf9c7b936e3b54874cdb6be4260ddc41cd9675ad8e3cdb3820f68c1c
@@ -86,6 +86,61 @@ module BlackStack
86
86
  s = routine_name || self.deployment_routine
87
87
  BlackStack::Deployer::run_routine(self.name, s, l);
88
88
  end
89
+
90
+ # stop all the processes who run in this node
91
+ def stop(output_file='~/deployment.log')
92
+ s = '
93
+ echo "" >>'+output_file+' 2>&1
94
+ echo "-------------------------------------------------------------------------" >>'+output_file+' 2>&1
95
+ echo "Stopping at: `date`" >>'+output_file+' 2>&1
96
+
97
+ # Activate RVM
98
+ echo ""
99
+ echo "Killing processes '+self.parameters[:code_folder]+'..." >>'+output_file+' 2>&1
100
+ ps ax | grep "'+self.parameters[:code_folder]+'" | grep -v postgres | grep -v grep | cut -b1-7 | xargs -t kill -9 >>'+output_file+' 2>&1
101
+ '
102
+ self.ssh.exec!(s)
103
+ end
104
+
105
+ # execute all the processes who run in this node
106
+ def start(output_file='~/deployment.log')
107
+ s = '
108
+ echo "" >>'+output_file+' 2>&1
109
+ echo "-------------------------------------------------------------------------" >>'+output_file+' 2>&1
110
+ echo "Starting at: `date`" >>'+output_file+' 2>&1
111
+
112
+ # Activate RVM
113
+ echo ""
114
+ echo "Activating RVM..." >>'+output_file+' 2>&1
115
+ source /etc/profile.d/rvm.sh >>'+output_file+' 2>&1
116
+
117
+ # Activate Ruby 3.1.2
118
+ echo ""
119
+ echo "Activate Ruby 3.1.2..." >>'+output_file+' 2>&1
120
+ rvm --default use 3.1.2 >>'+output_file+' 2>&1
121
+
122
+ # Set RUBYLIB
123
+ echo ""
124
+ echo "Set RUBYLIB..." >>'+output_file+' 2>&1
125
+ export RUBYLIB='+self.parameters[:rubylib]+' >>'+output_file+' 2>&1
126
+
127
+ # Change directory to RUBYLIB
128
+ echo ""
129
+ echo "Change directory to RUBYLIB..." >>'+output_file+' 2>&1
130
+ cd $RUBYLIB >>'+output_file+' 2>&1'
131
+
132
+ self.parameters[:processes].each { |p|
133
+ s += '
134
+ # Change directory to RUBYLIB
135
+ echo ""
136
+ echo "Run '+p+'..." >>'+output_file+' 2>&1
137
+ ruby $RUBYLIB/'+p+' 2>>'+output_file+' 1>>/dev/null &
138
+ '
139
+ }
140
+
141
+ self.ssh.exec!(s)
142
+ end
143
+
89
144
  end # module NodeModule
90
145
 
91
146
  # define attributes and methods of a deployer routine
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my-ruby-deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-28 00:00:00.000000000 Z
11
+ date: 2024-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blackstack-nodes