https://github.com/fly-apps/rqlite
https://github.com/fly-apps/rqlite
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fly-apps/rqlite
- Owner: fly-apps
- Created: 2020-12-05T15:41:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-25T17:16:36.000Z (over 5 years ago)
- Last Synced: 2024-11-17T00:26:55.726Z (over 1 year ago)
- Language: Shell
- Size: 3.91 KB
- Stars: 6
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example: private rqlite
## Setup
- Create a Fly app with:
```toml
[experimental]
private_network = true
[[mounts]]
source = "data"
destination = "/data"
```
- Create a volume:
```
flyctl volumes create data --region
```
- Deploy:
```
flyctl deploy
```
- Add 2 more volumes:
```
flyctl volumes create data --region
flyctl volumes create data --region
```
- Scale:
```
flyctl scale count 3
```
## Usage
Use a rqlite-compatible client to connect within your private network to `your-rqlite-app-name.internal:4001`.
### Read-only, locally replicated, database
In a different app with private networking on also, you can inject the `rqlited` binary and start it in read-only mode:
```
export PRIVATE_NET_IP=`getent hosts fly-local-6pn | cut -d ' ' -f1`
rqlited \
-join http://your-rqlite-app-name.internal:4001 \
-http-addr "0.0.0.0:4001" -http-adv-addr "[$PRIVATE_NET_IP]:4001" \
-raft-addr "0.0.0.0:4002" -raft-adv-addr "[$PRIVATE_NET_IP]:4002" \
-raft-non-voter=true
-on-disk \
/data/db
```
Use a standard sqlite database connector to connect to your disk database at `/data/db/db.sqlite`.
**WARNING**: ^^ this is for a read-only database only! Do not write to this database.