litestream 0.3.1-x86_64-darwin → 0.3.3-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/lib/litestream/commands.rb +13 -2
- data/lib/litestream/generators/litestream/install_generator.rb +2 -2
- data/lib/litestream/railtie.rb +1 -1
- data/lib/litestream/version.rb +1 -1
- data/lib/tasks/litestream_tasks.rake +9 -2
- metadata +4 -4
- /data/lib/litestream/generators/litestream/templates/{litestream.yml → config.yml} +0 -0
- /data/lib/litestream/generators/litestream/templates/{litestream.rb → initializer.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00647a209b5a0e901a8fac0c3e86b27d880479fe9af05dda02d9c6a8af1e073b
|
4
|
+
data.tar.gz: 2ea3f1d5c06707550dc99923ceb8259b81984dc159c9a6edec661a4b063effc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e6e4e494a0552c3f0969f8bbb294e4176544485c9b58a277fe39b732ba5277e35c39194c3ed6d2dc2e5bef94de1edc95b14251f5aad9dfd72e62187bcbd7362
|
7
|
+
data.tar.gz: bc578ed44bb4903098984baac438a465d3d85409e28c8bcdb9f26d49e63f6cff1a885fdbdaedc73685e4919245cb21195afb97dc68dab236496b86e1a9c154fb
|
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
|
-
|
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
|
|
data/lib/litestream/commands.rb
CHANGED
@@ -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
|
-
|
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 "
|
11
|
+
template "config.yml", "config/litestream.yml"
|
12
12
|
end
|
13
13
|
|
14
14
|
def copy_initializer_file
|
15
|
-
template "
|
15
|
+
template "initializer.rb", "config/initializers/litestream.rb"
|
16
16
|
end
|
17
17
|
|
18
18
|
def create_or_update_procfile
|
data/lib/litestream/railtie.rb
CHANGED
@@ -9,7 +9,7 @@ module Litestream
|
|
9
9
|
require_relative "generators/litestream/install_generator"
|
10
10
|
end
|
11
11
|
|
12
|
-
# Load the `litestream
|
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
|
data/lib/litestream/version.rb
CHANGED
@@ -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
|
-
|
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.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: x86_64-darwin
|
6
6
|
authors:
|
7
7
|
- Stephen Margheim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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/
|
73
|
-
- lib/litestream/generators/litestream/templates/
|
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
|
File without changes
|
File without changes
|