litestream 0.3.1-arm64-darwin → 0.3.3-arm64-darwin

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: 9f24c528ea8633c9dc0fe7ca0a52f6851dd8fcb1a157210c08b6577ab91907db
4
- data.tar.gz: a02fb8e4920b667e9c71c442c63d8a1bd5fe68048e8b4af2367d031955de4b54
3
+ metadata.gz: 39f5751dd238303fd70e98087d37e08c98d62697efe0df0715959eb5ded32ed0
4
+ data.tar.gz: ca0707ceb8dda436cc01650ea812c7ca42b22516dec78e4475a264f7ab3d5ae6
5
5
  SHA512:
6
- metadata.gz: 89e19d10cd5db81452136d9826ddc50e28e39d1a34f3c47e682a00e0253b3b320c9bf6eae06644f73c275798a8cfdfcef74024d4d2bb2786e994fbee7a08eebe
7
- data.tar.gz: 06be04211bdc22b3e2f2c860647be330e9628ffd75de4c058382aee0254f157c53719fdbb97002628e0e16a081db8a7e1daa3989cec1e3e6a9399667f4957ab7
6
+ metadata.gz: 1c284c21e39d48c0aa3ef27896d3b40be4988a542e01d238132a9ea381e2466ab6a4f3e3f04ab233c52c8bb1fc84fb62088c12e2933a277e6ed09897f985d42e
7
+ data.tar.gz: 57cf1e0217444fa58cf71966d146e947b1e32e42427a0547a6949d16fcd4a7d294b66972b93c5f82e7d09dc761af87c0fbdb3db997a824e5d937b98172b95f86
data/README.md CHANGED
@@ -76,9 +76,23 @@ However, if you need manual control over the Litestream configuration, you can m
76
76
 
77
77
  ### Replication
78
78
 
79
- By default, the gem will create or append to a `Procfile` to start the Litestream process via the gem's provided `litestream:replicate` rake task. This rake task will automatically load the configuration file and set the environment variables before starting the Litestream process.
79
+ By default, the gem will create or append to a `Procfile` to start the Litestream process via the gem's provided `litestream:replicate` rake task. This rake task will automatically load the configuration file and set the environment variables before starting the Litestream process. You can also execute this rake task yourself:
80
80
 
81
- Again, however, you can take full manual control over the replication process and simply run the `litestream replicate --config config/litestream.yml` command to start the Litestream process. Since the gem installs the native executable via Bundler, the `litestream` command will be available in your `PATH`.
81
+ ```shell
82
+ bin/rails litestream:replicate
83
+ # or
84
+ bundle exec rake litestream:replicate
85
+ ```
86
+
87
+ If you need to pass arguments through the rake task to the underlying `litestream` command, that can be done with argument forwarding:
88
+
89
+ ```shell
90
+ bin/rails litestream:replicate -- -exec "foreman start"
91
+ ```
92
+
93
+ This example utilizes the `-exec` option available on [the `replicate` command](https://litestream.io/reference/replicate/) which provides basic process management, since Litestream will exit when the child process exits. In this example, we only launch our collection of Rails application processes (like Rails and SolidQueue, for example) after the Litestream replication process is ready.
94
+
95
+ The rake task is the recommended way to interact with the Litestream replication process in your Rails application or Ruby project. But, you _can_ take full manual control over the replication process and simply run the `litestream replicate --config config/litestream.yml` command to start the Litestream process. Since the gem installs the native executable via Bundler, the `litestream` command will be available in your `PATH`.
82
96
 
83
97
  The full set of commands available to the `litestream` executable are covered in Litestream's [command reference](https://litestream.io/reference/). Currently, only the `replicate` command is provided as a rake task by the gem.
84
98
 
@@ -72,7 +72,7 @@ module Litestream
72
72
  exe_file
73
73
  end
74
74
 
75
- def self.replicate
75
+ def self.replicate(argv = {})
76
76
  if Litestream.configuration
77
77
  ENV["LITESTREAM_DATABASE_PATH"] = Litestream.configuration.database_path
78
78
  ENV["LITESTREAM_REPLICA_URL"] = Litestream.configuration.replica_url
@@ -80,7 +80,18 @@ module Litestream
80
80
  ENV["LITESTREAM_SECRET_ACCESS_KEY"] = Litestream.configuration.replica_access_key
81
81
  end
82
82
 
83
- system(executable, "replicate", "--config", Rails.root.join("config", "litestream.yml").to_s)
83
+ args = {
84
+ "--config" => Rails.root.join("config", "litestream.yml").to_s
85
+ }.merge(argv).to_a.flatten.compact
86
+
87
+ command = [executable, "replicate", *args]
88
+ puts command.inspect
89
+
90
+ # To release the resources of the Ruby process, just fork and exit.
91
+ # The forked process executes litestream and replaces itself.
92
+ if fork.nil?
93
+ exec(*command)
94
+ end
84
95
  end
85
96
  end
86
97
  end
@@ -8,11 +8,11 @@ module Litestream
8
8
  source_root File.expand_path("templates", __dir__)
9
9
 
10
10
  def copy_config_file
11
- template "litestream.yml", "config/litestream.yml"
11
+ template "config.yml", "config/litestream.yml"
12
12
  end
13
13
 
14
14
  def copy_initializer_file
15
- template "litestream.rb", "config/initializers/litestream.rb"
15
+ template "initializer.rb", "config/initializers/litestream.rb"
16
16
  end
17
17
 
18
18
  def create_or_update_procfile
@@ -9,7 +9,7 @@ module Litestream
9
9
  require_relative "generators/litestream/install_generator"
10
10
  end
11
11
 
12
- # Load the `litestream:env` Rake task into the host Rails app
12
+ # Load the `litestream:*` Rake task into the host Rails app
13
13
  rake_tasks do
14
14
  load "tasks/litestream_tasks.rake"
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Litestream
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -14,8 +14,15 @@ namespace :litestream do
14
14
  true
15
15
  end
16
16
 
17
- desc ""
17
+ desc "Start a process to monitor and continuously replicate the SQLite databases defined in your configuration file"
18
18
  task replicate: :environment do
19
- Litestream::Commands.replicate
19
+ options = {}
20
+ if (separator_index = ARGV.index("--"))
21
+ ARGV.slice(separator_index + 1, ARGV.length)
22
+ .map { |pair| pair.split("=") }
23
+ .each { |opt| options[opt[0]] = opt[1] || nil }
24
+ end
25
+
26
+ Litestream::Commands.replicate(options)
20
27
  end
21
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: litestream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Stephen Margheim
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-21 00:00:00.000000000 Z
11
+ date: 2024-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -69,8 +69,8 @@ files:
69
69
  - lib/litestream.rb
70
70
  - lib/litestream/commands.rb
71
71
  - lib/litestream/generators/litestream/install_generator.rb
72
- - lib/litestream/generators/litestream/templates/litestream.rb
73
- - lib/litestream/generators/litestream/templates/litestream.yml
72
+ - lib/litestream/generators/litestream/templates/config.yml
73
+ - lib/litestream/generators/litestream/templates/initializer.rb
74
74
  - lib/litestream/railtie.rb
75
75
  - lib/litestream/upstream.rb
76
76
  - lib/litestream/version.rb