bard 1.3.6 → 1.3.8

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: 5053dc8c4726e144736e568b70eaccff71dc0f6dced2d87c9d5dc3e18ded0906
4
- data.tar.gz: a350973b973785621969f862e981dada65e46a1bacbe7bdabb30c5ab188c1779
3
+ metadata.gz: ea4935b4438e88255e247667738c3cbda39e10d9eff5d45b2320ddb4e67b9ed7
4
+ data.tar.gz: 9c1056031159a162b53754c6ffbd5d1503458fd6830305ada0c999dc00719a07
5
5
  SHA512:
6
- metadata.gz: a87bf99bf8b8374906254753fae5b18a7374d2f51c5e6fe3c3841828807f12b61233dc205a7a9ea11ee9a4f91e5bb0b9ff61395240fc30ef7fd4ef2ce763f8d7
7
- data.tar.gz: 371d04cb10632a937c7a65a761498df299f06a26a7d7d05e0c6f8cf941fadf5a99581c64e07d235bccc2c029e5ad67fa948dfe0d24c1094094ef5c1824bde5bb
6
+ metadata.gz: 72e4f854810fa2d248a46e50b60c0524e53cd2082cc7d62826acf28fad50660168323a1092030d8fe81db8ff586f4ce9b814ef8400b75d2700074e792426133f
7
+ data.tar.gz: 195647d9dadee0966500ab3828404282f83ccaa612978495b20408a01d9b37b48e25d9a896deecbf640bea7128630c480196fb76090b0301253de6a688ea99c0
@@ -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
@@ -21,9 +21,12 @@ file ".gitignore", <<~GITIGNORE
21
21
  # Ignore master key for decrypting credentials and more.
22
22
  /config/master.key
23
23
 
24
- /db/*.sqlite3
24
+ # Ignore database dumps
25
25
  /db/data.*
26
26
 
27
+ # Ignore storage (uploaded files in development and any SQLite databases).
28
+ /storage/*
29
+
27
30
  # Ignore Syncthing
28
31
  .stfolder/
29
32
 
@@ -107,6 +110,8 @@ insert_into_file "config/database.yml", <<~YAML, after: "database: storage/test.
107
110
  database: storage/staging.sqlite3
108
111
  YAML
109
112
 
113
+ gsub_file "config/environments/production.rb", / (config\.logger.+STDOUT.*)$/, ' # \1'
114
+
110
115
  after_bundle do
111
116
  run "bard install"
112
117
  run "bin/setup"
@@ -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
- desc "provision [ssh_url]", "takes an optional ssh url to a raw ubuntu 22.04 install, and readies it in the shape of :production"
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
- Bard::Provision.call(config, ssh_url.dup) # dup unfreezes the string for later mutation
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
+
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "1.3.6"
2
+ VERSION = "1.3.8"
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.3.6
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-13 00:00:00.000000000 Z
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