bard 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 588cdbfd25f55995fcc7a63da8cca7d8ca0f85aa0493e707e42b0684a09814d4
4
- data.tar.gz: 3936e7c7ff76faec65b7865641ad271c78b5f1e1d1f0e76cab72d2c59c83ff42
3
+ metadata.gz: 30b53e09f78ef39dcc713fd006c886d507a4d935178cb7de92c478cb4aaee7cc
4
+ data.tar.gz: 057d81fda808b9a8d31f08bbffb898f208dda6013fb625bc7a2fc39aacf5a26d
5
5
  SHA512:
6
- metadata.gz: a30e2048f3c2d8c64c5f2d83babce66b0c008145cab3bfa2e1fa7685edb710b75ca204258bb946f8361d99a43af8f52c468eae24af41222f5d69479e5b6f667b
7
- data.tar.gz: 642c7e6c47280b94f3b21439534b7b932debea8ecb72704f3a34ca241cbace3094c5f59ed521f3b412d818a5929e0d331eba44a36c816f5f85b00e1611d066c1
6
+ metadata.gz: 3f8cc746753d1c33ca28917892635c0379890314ba6e1e3f65a620b9e8688774f3c82c4b0b1c9aa44e527daddb2b9ea1e2fcda4bf5707a5082c2141cdd6323f1
7
+ data.tar.gz: 82764e32ae8357c3f020549993d1f6ccff9652fc0aafbee1b1d168c9068d10aaafd62a3ee7e71406428e5ce0bbb515065181ea56295d8aa24bf3713b8ececce7
data/lib/bard/command.rb CHANGED
@@ -23,6 +23,9 @@ module Bard
23
23
  end
24
24
 
25
25
  def run verbose: false, quiet: false
26
+ # no-op if server doesn't really exist
27
+ return true if on.respond_to?(:ssh) && on.ssh == false
28
+
26
29
  if verbose
27
30
  system full_command(quiet: quiet)
28
31
  else
@@ -0,0 +1,25 @@
1
+ # install public keys if missing
2
+
3
+ class Bard::Provision::AuthorizedKeys < Bard::Provision
4
+ def call
5
+ print "Authorized Keys:"
6
+
7
+ KEYS.each do |search_text, full_key|
8
+ provision_server.run! <<~BASH #, quiet: true
9
+ file=~/.ssh/authorized_keys
10
+ if ! grep -F -q "#{search_text}" $file; then
11
+ echo "#{full_key}" >> $file
12
+ fi
13
+ BASH
14
+ end
15
+
16
+ puts " ✓"
17
+ end
18
+
19
+ KEYS = {
20
+ "micah@haku" => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAH235mtpxPQucd0bIgdufo1bR3By2+a+NPHiZS1P7SpI73evN9+hY7ri+gLscPLRWeoy1ig/TbyfN1AqJmfqIaskZdYOdcEQdOum4AwDMY5L6OAq2o5NER047RqDxE6Pjm2nfRVVw2Dz38eeco+ouchCI+sY5pJL/wEZItrCpPjKvwo56uln1rL6Smd4Kh98ZBKTGL8xKs95rNmFdBCCq4eUE28JDgkJAiLDZ/4u2LNrgEr7/brkUieZjaZ4BacBi8EQvyvMWmZ0g2MoG+Ptxn/3K2nd1QqdhfINqHBVCi8UbkP08B0Msif/7Dycuxd7DU9cVZ3RgnhLtbIsQ8HaYVj5yCKB6CuX3lv3H4YKBghBC/TnJD5Nq5xcSYTW0BKKrusCb/OoOk5AUV+BGM1+R70fno8reVEBUlZDkWapHxmqgNnf1byL7Aol/L5SWgyfSLT6b5FjI6g/U+dhaecYY9T9g/GWo+JiwZktc094O0ujlQHoibMY2M0csVfvO9Oc= micah@haku",
21
+ "gubs@Theia.local" => "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApJh0E8ZlaLbMUWGvryAhEBRnnI519ZKz586vdQTuIPlDb9xhe5m3Ys8Fk9LKqJUQNxBV6qCGOXNgNdWySkk2ChmmgDnPfr7/31ZuOAASFbUY0PtaDXUsMVvs1Uu2VhtRU9gSduGonEHG7iBpAuBI23CxU4yPS6o3pv7L9xwnmULes5F9S4/nDvPig15h9byInyHOLDV0XjHFS+2OlSWO/xC8uqH5CdlxXFAmPQ0R69qmILl0rcTPyNMLJGcJGUzb/LMRJX/RDyTpZeJPjH4V+zksQ/4YQ3LWvLrlZL6QLuM285ve4mQa3vBY4WMqNlp4Ig3ZCFOpMKmpvTn7pFUmKw== gubs@Theia.local",
22
+ }
23
+ end
24
+
25
+
@@ -0,0 +1,30 @@
1
+ # install log rotation if missing
2
+
3
+ class Bard::Provision::LogRotation < Bard::Provision
4
+ def call
5
+ print "Log Rotation:"
6
+
7
+ provision_server.run! <<~BASH, quiet: true
8
+ file=/etc/logrotate.d/#{server.project_name}
9
+ if [ ! -f $file ]; then
10
+ sudo tee $file > /dev/null <<EOF
11
+ $(pwd)/log/*.log {
12
+ weekly
13
+ size 100M
14
+ missingok
15
+ rotate 52
16
+ delaycompress
17
+ notifempty
18
+ copytruncate
19
+ create 664 www www
20
+ }
21
+ EOF
22
+ fi
23
+ BASH
24
+
25
+ puts " ✓"
26
+ end
27
+ end
28
+
29
+
30
+
@@ -3,7 +3,7 @@ module Bard
3
3
  def self.call(...) = new(...).call
4
4
 
5
5
  def call
6
- %w[SSH User Apt MySQL Repo MasterKey RVM App Passenger Data HTTP].each do |step|
6
+ %w[SSH User AuthorizedKeys Apt MySQL Repo MasterKey RVM App Passenger Data HTTP LogRotation].each do |step|
7
7
  require "bard/provision/#{step.downcase}"
8
8
  self.class.const_get(step).call(*values)
9
9
  end
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-13 00:00:00.000000000 Z
11
+ date: 2024-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -161,8 +161,10 @@ files:
161
161
  - lib/bard/provision.rb
162
162
  - lib/bard/provision/app.rb
163
163
  - lib/bard/provision/apt.rb
164
+ - lib/bard/provision/authorizedkeys.rb
164
165
  - lib/bard/provision/data.rb
165
166
  - lib/bard/provision/http.rb
167
+ - lib/bard/provision/logrotation.rb
166
168
  - lib/bard/provision/masterkey.rb
167
169
  - lib/bard/provision/mysql.rb
168
170
  - lib/bard/provision/passenger.rb