bard 1.3.7 → 1.3.8
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 +4 -4
- data/lib/bard/cli/command.rb +6 -0
- data/lib/bard/cli/new_rails_template.rb +2 -0
- data/lib/bard/cli/provision.rb +25 -2
- data/lib/bard/provision/swapfile.rb +21 -0
- data/lib/bard/provision.rb +0 -7
- data/lib/bard/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea4935b4438e88255e247667738c3cbda39e10d9eff5d45b2320ddb4e67b9ed7
|
4
|
+
data.tar.gz: 9c1056031159a162b53754c6ffbd5d1503458fd6830305ada0c999dc00719a07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72e4f854810fa2d248a46e50b60c0524e53cd2082cc7d62826acf28fad50660168323a1092030d8fe81db8ff586f4ce9b814ef8400b75d2700074e792426133f
|
7
|
+
data.tar.gz: 195647d9dadee0966500ab3828404282f83ccaa612978495b20408a01d9b37b48e25d9a896deecbf640bea7128630c480196fb76090b0301253de6a688ea99c0
|
data/lib/bard/cli/command.rb
CHANGED
@@ -7,8 +7,14 @@ class Bard::CLI::Command < SimpleDelegator
|
|
7
7
|
@description = description
|
8
8
|
end
|
9
9
|
|
10
|
+
def self.option *args, **kwargs
|
11
|
+
@option_args = args
|
12
|
+
@option_kwargs = kwargs
|
13
|
+
end
|
14
|
+
|
10
15
|
def self.setup cli
|
11
16
|
cli.desc @command, @description
|
17
|
+
cli.option *@option_args, **@option_kwargs if @option_args || @option_kwargs
|
12
18
|
# put in local variables so next block can capture it
|
13
19
|
command_class = self
|
14
20
|
method = @method
|
@@ -110,6 +110,8 @@ insert_into_file "config/database.yml", <<~YAML, after: "database: storage/test.
|
|
110
110
|
database: storage/staging.sqlite3
|
111
111
|
YAML
|
112
112
|
|
113
|
+
gsub_file "config/environments/production.rb", / (config\.logger.+STDOUT.*)$/, ' # \1'
|
114
|
+
|
113
115
|
after_bundle do
|
114
116
|
run "bard install"
|
115
117
|
run "bin/setup"
|
data/lib/bard/cli/provision.rb
CHANGED
@@ -2,9 +2,32 @@ require "bard/cli/command"
|
|
2
2
|
require "bard/provision"
|
3
3
|
|
4
4
|
class Bard::CLI::Provision < Bard::CLI::Command
|
5
|
-
|
5
|
+
STEPS = %w[
|
6
|
+
SSH
|
7
|
+
User
|
8
|
+
AuthorizedKeys
|
9
|
+
Apt
|
10
|
+
MySQL
|
11
|
+
Repo
|
12
|
+
MasterKey
|
13
|
+
RVM
|
14
|
+
App
|
15
|
+
Passenger
|
16
|
+
Data
|
17
|
+
HTTP
|
18
|
+
LogRotation
|
19
|
+
Swapfile
|
20
|
+
Deploy
|
21
|
+
]
|
22
|
+
|
23
|
+
desc "provision [ssh_url] --steps=all", "takes an optional ssh url to a raw ubuntu 22.04 install, and readies it in the shape of :production"
|
24
|
+
option :steps, type: :array, default: STEPS
|
6
25
|
def provision ssh_url=config[:production].ssh
|
7
|
-
|
26
|
+
options[:steps].each do |step|
|
27
|
+
require "bard/provision/#{step.downcase}"
|
28
|
+
# dup unfreezes the string for later mutation
|
29
|
+
Bard::Provision.const_get(step).call(config, ssh_url.dup)
|
30
|
+
end
|
8
31
|
end
|
9
32
|
end
|
10
33
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# setup swapfile
|
2
|
+
|
3
|
+
class Bard::Provision::Swapfile < Bard::Provision
|
4
|
+
def call
|
5
|
+
print "Swapfile:"
|
6
|
+
|
7
|
+
provision_server.run! <<~BASH
|
8
|
+
if [ ! -f /swapfile ]; then
|
9
|
+
sudo fallocate -l $(grep MemTotal /proc/meminfo | awk '{print $2}')K /swapfile
|
10
|
+
fi
|
11
|
+
sudo chmod 600 /swapfile
|
12
|
+
sudo swapon --show | grep -q '/swapfile' || sudo mkswap /swapfile
|
13
|
+
sudo swapon --show | grep -q '/swapfile' || sudo swapon /swapfile
|
14
|
+
grep -q '/swapfile none swap sw 0 0' /etc/fstab || echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
|
15
|
+
BASH
|
16
|
+
|
17
|
+
puts " ✓"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
data/lib/bard/provision.rb
CHANGED
@@ -2,13 +2,6 @@ module Bard
|
|
2
2
|
class Provision < Struct.new(:config, :ssh_url)
|
3
3
|
def self.call(...) = new(...).call
|
4
4
|
|
5
|
-
def call
|
6
|
-
%w[SSH User AuthorizedKeys Apt MySQL Repo MasterKey RVM App Passenger Data HTTP LogRotation Deploy].each do |step|
|
7
|
-
require "bard/provision/#{step.downcase}"
|
8
|
-
self.class.const_get(step).call(*values)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
5
|
private
|
13
6
|
|
14
7
|
def server
|
data/lib/bard/version.rb
CHANGED
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.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- lib/bard/provision/repo.rb
|
177
177
|
- lib/bard/provision/rvm.rb
|
178
178
|
- lib/bard/provision/ssh.rb
|
179
|
+
- lib/bard/provision/swapfile.rb
|
179
180
|
- lib/bard/provision/user.rb
|
180
181
|
- lib/bard/server.rb
|
181
182
|
- lib/bard/version.rb
|