smartmachine 1.2.2 → 1.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 399cf5ca8bd944f129d3731d93be76cf46ba86e3f25b97b5110ee42dc8650430
|
4
|
+
data.tar.gz: 2b0166c466312def05a5ee8930bf3943c0f31e3a224d582caeee878c68e43a8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1f029f440a058a7185f315137f2e2544fb3898ef21d3bffb7792f50350d1b7d476c3c116d7ebec2790a2fb8f0c11cc1151558b6fc42db37edfdf55688bb8f4d
|
7
|
+
data.tar.gz: d667cfb03e650d7f9497a6be4b816b3c2eb0c70e85760987746fdd083d9f2bc3496b48ff1d65df667934e6065b8dfa5355e27c48820bc72cfb3e578506c4267e
|
@@ -80,13 +80,9 @@ module SmartMachine
|
|
80
80
|
libdb-dev \
|
81
81
|
uuid-dev && \
|
82
82
|
# ruby on rails
|
83
|
-
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
|
84
|
-
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
|
85
83
|
apt-get update && \
|
86
84
|
apt-get install -y --no-install-recommends \
|
87
85
|
tzdata \
|
88
|
-
nodejs \
|
89
|
-
yarn \
|
90
86
|
libmariadb-dev \
|
91
87
|
libvips42 \
|
92
88
|
ffmpeg \
|
@@ -109,44 +105,6 @@ module SmartMachine
|
|
109
105
|
|
110
106
|
format(file)
|
111
107
|
end
|
112
|
-
|
113
|
-
# These swapfile methods can be used (after required modification), when you need to make swapfile for more memory.
|
114
|
-
# def self.create_swapfile
|
115
|
-
# # Creating swapfile for bundler to work properly
|
116
|
-
# unless system("sudo swapon -s | grep -ci '/swapfile'", out: File::NULL)
|
117
|
-
# print "-----> Creating swap swapfile ... "
|
118
|
-
# system("sudo install -o root -g root -m 0600 /dev/null /swapfile", out: File::NULL)
|
119
|
-
# system("sudo dd if=/dev/zero of=/swapfile bs=1k count=2048k", [:out, :err] => File::NULL)
|
120
|
-
# system("sudo mkswap /swapfile", out: File::NULL)
|
121
|
-
# system("sudo sh -c 'echo \"/swapfile none swap sw 0 0\" >> /etc/fstab'", out: File::NULL)
|
122
|
-
# system("echo 10 | sudo tee /proc/sys/vm/swappiness", out: File::NULL)
|
123
|
-
# system("sudo sed -i '/^vm.swappiness = /d' /etc/sysctl.conf", out: File::NULL)
|
124
|
-
# system("echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf", out: File::NULL)
|
125
|
-
# puts "done"
|
126
|
-
#
|
127
|
-
# print "-----> Starting swap swapfile ... "
|
128
|
-
# if system("sudo swapon /swapfile", out: File::NULL)
|
129
|
-
# puts "done"
|
130
|
-
# end
|
131
|
-
# end
|
132
|
-
# end
|
133
|
-
#
|
134
|
-
# def self.destroy_swapfile
|
135
|
-
# if system("sudo swapon -s | grep -ci '/swapfile'", out: File::NULL)
|
136
|
-
# print "-----> Stopping swap swapfile ... "
|
137
|
-
# if system("sudo swapoff /swapfile", out: File::NULL)
|
138
|
-
# system("sudo sed -i '/^vm.swappiness = /d' /etc/sysctl.conf", out: File::NULL)
|
139
|
-
# system("echo 60 | sudo tee /proc/sys/vm/swappiness", out: File::NULL)
|
140
|
-
# puts "done"
|
141
|
-
#
|
142
|
-
# print "-----> Removing swap swapfile ... "
|
143
|
-
# system("sudo sed -i '/^\\/swapfile/d' /etc/fstab", out: File::NULL)
|
144
|
-
# if system("sudo rm /swapfile", out: File::NULL)
|
145
|
-
# puts "done"
|
146
|
-
# end
|
147
|
-
# end
|
148
|
-
# end
|
149
|
-
# end
|
150
108
|
end
|
151
109
|
end
|
152
110
|
end
|
@@ -173,6 +173,66 @@ module SmartMachine
|
|
173
173
|
system("alias bundler='bundler _#{bundler_version}_'")
|
174
174
|
logger.info "Using bundler v" + bundler_version + "\n"
|
175
175
|
|
176
|
+
# Install nodejs
|
177
|
+
nodejs_version = `sed -n '/node/{p;n}' package.json`.strip.split(":").last&.strip&.delete_prefix('"')&.delete_suffix(',')&.delete_suffix('"')
|
178
|
+
if nodejs_version.nil? || nodejs_version.empty?
|
179
|
+
logger.error "Could not find nodejs version. Have you specified it explicitly in package.json with engines field and run yarn install?\n"
|
180
|
+
return false
|
181
|
+
end
|
182
|
+
|
183
|
+
unless system(user_bash("node -v"), [:out, :err] => File::NULL) && `#{user_bash('node -v')}`.strip&.delete_prefix('v') == nodejs_version
|
184
|
+
logger.info "Installing nodejs v#{nodejs_version}\n"
|
185
|
+
|
186
|
+
Open3.popen2e(user_bash("asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git")) do |stdin, stdout_and_stderr, wait_thr|
|
187
|
+
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
188
|
+
end
|
189
|
+
Open3.popen2e(user_bash("asdf plugin update nodejs")) do |stdin, stdout_and_stderr, wait_thr|
|
190
|
+
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
191
|
+
end
|
192
|
+
Open3.popen2e(user_bash("asdf install nodejs #{nodejs_version}")) do |stdin, stdout_and_stderr, wait_thr|
|
193
|
+
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
194
|
+
end
|
195
|
+
Open3.popen2e(user_bash("asdf local nodejs #{nodejs_version}")) do |stdin, stdout_and_stderr, wait_thr|
|
196
|
+
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
197
|
+
end
|
198
|
+
|
199
|
+
unless `#{user_bash('node -v')}`.strip&.delete_prefix('v') == nodejs_version
|
200
|
+
logger.error "Could not install nodejs with version #{nodejs_version}. Please try another valid version that asdf supports.\n"
|
201
|
+
return false
|
202
|
+
end
|
203
|
+
end
|
204
|
+
logger.info "Using nodejs v" + `#{user_bash('node -v')}`.strip&.delete_prefix('v') + "\n"
|
205
|
+
|
206
|
+
# Install yarn
|
207
|
+
yarn_version = `sed -n '/yarn/{p;n}' package.json`.strip.split(":").last&.strip&.delete_prefix('"')&.delete_suffix(',')&.delete_suffix('"')
|
208
|
+
if yarn_version.nil? || yarn_version.empty?
|
209
|
+
logger.error "Could not find yarn version. Have you specified it explicitly in package.json with engines field and run yarn install?\n"
|
210
|
+
return false
|
211
|
+
end
|
212
|
+
|
213
|
+
unless system(user_bash("yarn -v"), [:out, :err] => File::NULL) && `#{user_bash('yarn -v')}`.strip == yarn_version
|
214
|
+
logger.info "Installing yarn v#{yarn_version}\n"
|
215
|
+
|
216
|
+
Open3.popen2e(user_bash("asdf plugin add yarn https://github.com/twuni/asdf-yarn.git")) do |stdin, stdout_and_stderr, wait_thr|
|
217
|
+
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
218
|
+
end
|
219
|
+
Open3.popen2e(user_bash("asdf plugin update yarn")) do |stdin, stdout_and_stderr, wait_thr|
|
220
|
+
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
221
|
+
end
|
222
|
+
Open3.popen2e(user_bash("asdf install yarn #{yarn_version}")) do |stdin, stdout_and_stderr, wait_thr|
|
223
|
+
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
224
|
+
end
|
225
|
+
Open3.popen2e(user_bash("asdf local yarn #{yarn_version}")) do |stdin, stdout_and_stderr, wait_thr|
|
226
|
+
stdout_and_stderr.each { |line| logger.info "#{line}" }
|
227
|
+
end
|
228
|
+
|
229
|
+
unless `#{user_bash('yarn -v')}`.strip == yarn_version
|
230
|
+
logger.error "Could not install yarn with version #{yarn_version}. Please try another valid version that asdf supports.\n"
|
231
|
+
return false
|
232
|
+
end
|
233
|
+
end
|
234
|
+
logger.info "Using yarn v" + `#{user_bash('yarn -v')}`.strip + "\n"
|
235
|
+
|
176
236
|
set_logger_formatter_arrow
|
177
237
|
|
178
238
|
return true
|
@@ -161,5 +161,47 @@ module SmartMachine
|
|
161
161
|
]
|
162
162
|
run_on_machine(commands: commands)
|
163
163
|
end
|
164
|
+
|
165
|
+
# These swapfile methods can be used (after required modification), when you need to make swapfile for more memory.
|
166
|
+
# def self.create_swapfile
|
167
|
+
# # Creating swapfile for bundler to work properly
|
168
|
+
# unless system("sudo swapon -s | grep -ci '/swapfile'", out: File::NULL)
|
169
|
+
# print "-----> Creating swap swapfile ... "
|
170
|
+
# system("sudo install -o root -g root -m 0600 /dev/null /swapfile", out: File::NULL)
|
171
|
+
# system("sudo dd if=/dev/zero of=/swapfile bs=1k count=2048k", [:out, :err] => File::NULL)
|
172
|
+
# system("sudo mkswap /swapfile", out: File::NULL)
|
173
|
+
# system("sudo sh -c 'echo \"/swapfile none swap sw 0 0\" >> /etc/fstab'", out: File::NULL)
|
174
|
+
# system("echo 10 | sudo tee /proc/sys/vm/swappiness", out: File::NULL)
|
175
|
+
# system("sudo sed -i '/^vm.swappiness = /d' /etc/sysctl.conf", out: File::NULL)
|
176
|
+
# system("echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf", out: File::NULL)
|
177
|
+
# system("echo 50 | sudo tee /proc/sys/vm/vfs_cache_pressure", out: File::NULL)
|
178
|
+
# system("sudo sed -i '/^vm.vfs_cache_pressure = /d' /etc/sysctl.conf", out: File::NULL)
|
179
|
+
# system("echo vm.vfs_cache_pressure = 50 | sudo tee -a /etc/sysctl.conf", out: File::NULL)
|
180
|
+
# puts "done"
|
181
|
+
#
|
182
|
+
# print "-----> Starting swap swapfile ... "
|
183
|
+
# if system("sudo swapon /swapfile", out: File::NULL)
|
184
|
+
# puts "done"
|
185
|
+
# end
|
186
|
+
# end
|
187
|
+
# end
|
188
|
+
#
|
189
|
+
# def self.destroy_swapfile
|
190
|
+
# if system("sudo swapon -s | grep -ci '/swapfile'", out: File::NULL)
|
191
|
+
# print "-----> Stopping swap swapfile ... "
|
192
|
+
# if system("sudo swapoff /swapfile", out: File::NULL)
|
193
|
+
# system("sudo sed -i '/^vm.swappiness = /d' /etc/sysctl.conf", out: File::NULL)
|
194
|
+
# system("echo 100 | sudo tee /proc/sys/vm/vfs_cache_pressure", out: File::NULL)
|
195
|
+
# system("echo 60 | sudo tee /proc/sys/vm/swappiness", out: File::NULL)
|
196
|
+
# puts "done"
|
197
|
+
#
|
198
|
+
# print "-----> Removing swap swapfile ... "
|
199
|
+
# system("sudo sed -i '/^\\/swapfile/d' /etc/fstab", out: File::NULL)
|
200
|
+
# if system("sudo rm /swapfile", out: File::NULL)
|
201
|
+
# puts "done"
|
202
|
+
# end
|
203
|
+
# end
|
204
|
+
# end
|
205
|
+
# end
|
164
206
|
end
|
165
207
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- plainsource
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -417,8 +417,8 @@ licenses:
|
|
417
417
|
metadata:
|
418
418
|
homepage_uri: https://github.com/plainsource/smartmachine
|
419
419
|
bug_tracker_uri: https://github.com/plainsource/smartmachine/issues
|
420
|
-
changelog_uri: https://github.com/plainsource/smartmachine/releases/tag/v1.2.
|
421
|
-
source_code_uri: https://github.com/plainsource/smartmachine/tree/v1.2.
|
420
|
+
changelog_uri: https://github.com/plainsource/smartmachine/releases/tag/v1.2.3
|
421
|
+
source_code_uri: https://github.com/plainsource/smartmachine/tree/v1.2.3
|
422
422
|
post_install_message:
|
423
423
|
rdoc_options: []
|
424
424
|
require_paths:
|