litestream 0.2.0-x86_64-darwin → 0.3.0-x86_64-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: b23ace1583cc1f70cb4e86d05762dedd415530f8f2d6e8725730a6602fe3582e
4
- data.tar.gz: 3628916497bfc379f6a54df34b2979c67077bb1e2bf43a1a62dc3222d2cdc372
3
+ metadata.gz: 22e9241293f614e50155fb188655fba10083e2d6caf17b853591de45a5be4ee1
4
+ data.tar.gz: 674b18dfd9b00f946a5b09d4a16b1732d13d39e3031fd9eff87d5122ae4c2c63
5
5
  SHA512:
6
- metadata.gz: e5e44dee7e00de45d94f04ec7939387a070c8ce94b9c0509c5456efc080620f3d19f8abcaaec4afc202110f3e010249a7eb6c6142ae47219762fc2410b417652
7
- data.tar.gz: b439d6594e7ae2069b7b6119018377a6bed320a60225d9bf49ee3c6a6261e9efa2b63d8561867f2274d09b58c7e90b9929aef3bd7d2b056b2a55fae3c316ce30
6
+ metadata.gz: 1a97ad8901ea586bc80ee174ba603c8fdc8a297796363855b29d408a17458701fc650e1408a3ee764b7014acb775b97b6195009afe7649f83da3158551c8e5ba
7
+ data.tar.gz: 1c57a62eb76fd3175d81a791dd9f02e8ea2d4da0a57fd4223155c4aa20c227edf338a5a0276d9ae2ec2333436cad574497f5fa6b06ef71b9058eba60b8c98c83
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.
@@ -73,12 +73,12 @@ module Litestream
73
73
  end
74
74
 
75
75
  def self.replicate
76
- return if Litestream.configuration.nil?
77
-
78
- ENV["LITESTREAM_DATABASE_PATH"] = Litestream.configuration.database_path
79
- ENV["LITESTREAM_REPLICA_URL"] = Litestream.configuration.replica_url
80
- ENV["LITESTREAM_ACCESS_KEY_ID"] = Litestream.configuration.replica_key_id
81
- ENV["LITESTREAM_SECRET_ACCESS_KEY"] = Litestream.configuration.replica_access_key
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
- litestream_credentials = Rails.application.credentials.litestream
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
- config.database_path = ActiveRecord::Base.connection_db_config.database
5
- config.replica_url = litestream_credentials.replica_url
6
- config.replica_key_id = litestream_credentials.replica_key_id
7
- config.replica_access_key = litestream_credentials.replica_access_key
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
@@ -1,3 +1,7 @@
1
+ # This is the actual configuration file for litestream.
2
+ # Edit this file as needed to configure your needs for litestream repication.
3
+ #
4
+ # For more details, see: https://litestream.io/reference/config/
1
5
  dbs:
2
6
  - path: $LITESTREAM_DATABASE_PATH
3
7
  replicas:
@@ -1,3 +1,3 @@
1
1
  module Litestream
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  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.2.0
4
+ version: 0.3.0
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: 2023-12-11 00:00:00.000000000 Z
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.4.19
101
+ rubygems_version: 3.5.1
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Integrate Litestream with the RubyGems infrastructure.