litestream 0.2.0-x86_64-linux → 0.3.0-x86_64-linux
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c5db6756ac15b40e5160d8d6d16d08bc7692ec77396b6ea1496d38de7410a43
|
4
|
+
data.tar.gz: '057389a26d3421fbe1f0a2cd00befc50b47cb668ffdbe6363cf307d97b74374a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7bf1931b7cfd07c08d8b6599933718b17ef7f64b71b7ca51bcccba6839faf2f294d09620f5aa56ca921da494c2b0fed54349ba65086b8025038981a1a56e556
|
7
|
+
data.tar.gz: 7fb4e0682c14aec733b9a009a4993c0eae65c57484134bd645f0f5c85e7c23eeb31017fbed8386a2b8ece82e44d5ef109e273d89032c564e527b74a92e76c659
|
data/README.md
CHANGED
@@ -82,6 +82,37 @@ Again, however, you can take full manual control over the replication process an
|
|
82
82
|
|
83
83
|
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
84
|
|
85
|
+
### Using in development
|
86
|
+
|
87
|
+
By default, installing the gem does not update your `Procfile.dev` file, and so Litestream will not be started in development. If you would like to test that your configuration is properly setup, you can manually add the `litestream:replicate` rake task to your `Procfile.dev` file. Just copy the `litestream` definition from the production `Procfile`. Then, in order to have a replication bucket for Litestream to point to, you can use a Docker instance of [MinIO](https://min.io/). MinIO is an S3-compatible object storage server that can be run locally. You can run a MinIO server with the following command:
|
88
|
+
|
89
|
+
```sh
|
90
|
+
docker run -p 9000:9000 -p 9001:9001 minio/minio server /data --console-address ":9001"
|
91
|
+
```
|
92
|
+
|
93
|
+
This gets us up and running quickly but it will only persist the data for as long as the Docker container is running, which is fine for local development testing.
|
94
|
+
|
95
|
+
To simplify local development, you can add this command to your `Procfile.dev` file as well. This would allow you to start a MinIO server and a Litestream replication process in your local development environment with the single `bin/dev` command.
|
96
|
+
|
97
|
+
Once you have a MinIO server running, you can create a bucket for Litestream to use. You can do this by visiting the MinIO console at [http://localhost:9001](http://localhost:9001) and logging in with the default credentials of `minioadmin` and `minioadmin`. Once logged in, you can create a bucket named `mybkt` by clicking the `+` button in the bottom right corner of the screen. You can then use the following configuration in your `config/initializers/litestream.rb` file:
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
Litestream.configure do |config|
|
101
|
+
config.database_path = ActiveRecord::Base.connection_db_config.database
|
102
|
+
config.replica_url = "s3://mybkt.localhost:9000/"
|
103
|
+
config.replica_key_id = "minioadmin"
|
104
|
+
config.replica_access_key = "minioadmin"
|
105
|
+
end
|
106
|
+
```
|
107
|
+
|
108
|
+
With Litestream properly configured and the MinIO server and Litestream replication process running, you should see something like the following in your terminal logs when you start the `bin/dev` process:
|
109
|
+
|
110
|
+
```sh
|
111
|
+
time=YYYY-MM-DDTHH:MM:SS level=INFO msg=litestream version=v0.3.xx
|
112
|
+
time=YYYY-MM-DDTHH:MM:SS level=INFO msg="initialized db" path=/path/to/your/app/storage/development.sqlite3
|
113
|
+
time=YYYY-MM-DDTHH:MM:SS level=INFO msg="replicating to" name=s3 type=s3 sync-interval=1s bucket=mybkt path="" region=us-east-1 endpoint=http://localhost:9000
|
114
|
+
```
|
115
|
+
|
85
116
|
## Development
|
86
117
|
|
87
118
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/litestream/commands.rb
CHANGED
@@ -73,12 +73,12 @@ module Litestream
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def self.replicate
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
76
|
+
if Litestream.configuration
|
77
|
+
ENV["LITESTREAM_DATABASE_PATH"] = Litestream.configuration.database_path
|
78
|
+
ENV["LITESTREAM_REPLICA_URL"] = Litestream.configuration.replica_url
|
79
|
+
ENV["LITESTREAM_ACCESS_KEY_ID"] = Litestream.configuration.replica_key_id
|
80
|
+
ENV["LITESTREAM_SECRET_ACCESS_KEY"] = Litestream.configuration.replica_access_key
|
81
|
+
end
|
82
82
|
|
83
83
|
system(executable, "replicate", "--config", Rails.root.join("config", "litestream.yml").to_s)
|
84
84
|
end
|
@@ -1,8 +1,38 @@
|
|
1
|
-
|
1
|
+
# Use this hook to configure the litestream-ruby gem.
|
2
|
+
# All configuration options will be available as environment variables, e.g.
|
3
|
+
# config.database_path becomes LITESTREAM_DATABASE_PATH
|
4
|
+
# This allows you to configure Litestream using Rails encrypted credentials,
|
5
|
+
# or some other mechanism where the values are only avaialble at runtime.
|
2
6
|
|
3
7
|
Litestream.configure do |config|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
# An example of using Rails encrypted credentials to configure Litestream.
|
9
|
+
# litestream_credentials = Rails.application.credentials.litestream
|
10
|
+
#
|
11
|
+
# The absolute or relative path to a SQLite database file.
|
12
|
+
# Litestream will monitor this file for changes and replicate them to the
|
13
|
+
# any of the configured replicas specified for this database in the
|
14
|
+
# `litestream.yml` configuration file.
|
15
|
+
# When using SQLite as your database engine for ActiveRecord, you should always
|
16
|
+
# set this to the path of your SQLite database file. You can do so using Rails'
|
17
|
+
# existing knowledge of the database path.
|
18
|
+
# config.database_path = ActiveRecord::Base.connection_db_config.database
|
19
|
+
|
20
|
+
# Short-hand form of specifying a replica location.
|
21
|
+
# When using S3, a value will look like "s3://mybkt.litestream.io/db"
|
22
|
+
# Litestream also supports Azure Blog Storage, Backblaze B2, DigitalOcean Spaces,
|
23
|
+
# Scaleway Object Storage, Google Cloud Storage, Linode Object Storage, and
|
24
|
+
# any SFTP server.
|
25
|
+
# In this example, we are using Rails encrypted credentials to store the URL to
|
26
|
+
# our storage provider bucket.
|
27
|
+
# config.replica_url = litestream_credentials.replica_url
|
28
|
+
|
29
|
+
# Replica-specific authentication key.
|
30
|
+
# Litestream needs authentication credentials to access your storage provider bucket.
|
31
|
+
# In this example, we are using Rails encrypted credentials to store the access key ID.
|
32
|
+
# config.replica_key_id = litestream_credentials.replica_key_id
|
33
|
+
|
34
|
+
# Replica-specific secret key.
|
35
|
+
# Litestream needs authentication credentials to access your storage provider bucket.
|
36
|
+
# In this example, we are using Rails encrypted credentials to store the secret access key.
|
37
|
+
# config.replica_access_key = litestream_credentials.replica_access_key
|
8
38
|
end
|
data/lib/litestream/version.rb
CHANGED
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Stephen Margheim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
101
|
+
rubygems_version: 3.5.1
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Integrate Litestream with the RubyGems infrastructure.
|