-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document a new declarative configuration approach: local YAML file and etcd config
- Loading branch information
1 parent
7b587a0
commit f1277cb
Showing
41 changed files
with
1,861 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Configuration | ||
|
||
A sample application demonstrating various features related to Tarantool [configuration](https://www.tarantool.io/en/doc/latest/concepts/configuration/). | ||
|
||
## Running | ||
|
||
To run applications placed in [instances.enabled](instances.enabled), go to the `config` directory in the terminal and execute the `tt start` command, for example: | ||
|
||
```console | ||
$ tt start application | ||
``` |
13 changes: 13 additions & 0 deletions
13
doc/code_snippets/snippets/config/instances.enabled/application/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
app: | ||
file: 'myapp.lua' | ||
cfg: | ||
greeting: 'Hello' | ||
|
||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
instances: | ||
instance001: | ||
iproto: | ||
listen: "3301" |
1 change: 1 addition & 0 deletions
1
doc/code_snippets/snippets/config/instances.enabled/application/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
instance001: |
4 changes: 4 additions & 0 deletions
4
doc/code_snippets/snippets/config/instances.enabled/application/myapp.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- myapp.lua -- | ||
local log = require('log').new("myapp") | ||
local config = require('config') | ||
log.info("%s from app, %s!", config:get('app.cfg.greeting'), box.info.name) |
5 changes: 5 additions & 0 deletions
5
doc/code_snippets/snippets/config/instances.enabled/etcd/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
config: | ||
etcd: | ||
endpoints: | ||
- http://localhost:2379 | ||
prefix: /example |
3 changes: 3 additions & 0 deletions
3
doc/code_snippets/snippets/config/instances.enabled/etcd/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
instance001: | ||
instance002: | ||
instance003: |
12 changes: 12 additions & 0 deletions
12
doc/code_snippets/snippets/config/instances.enabled/etcd_full/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
config: | ||
etcd: | ||
endpoints: | ||
- http://localhost:2379 | ||
prefix: /example | ||
username: testuser | ||
password: foobar | ||
ssl: | ||
ca_file: ca.crt | ||
http: | ||
request: | ||
timeout: 3 |
3 changes: 3 additions & 0 deletions
3
doc/code_snippets/snippets/config/instances.enabled/etcd_full/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
instance001: | ||
instance002: | ||
instance003: |
9 changes: 9 additions & 0 deletions
9
doc/code_snippets/snippets/config/instances.enabled/global_scope/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
iproto: | ||
listen: "3301" | ||
|
||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
instances: | ||
instance001: {} |
1 change: 1 addition & 0 deletions
1
doc/code_snippets/snippets/config/instances.enabled/global_scope/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
instance001: |
8 changes: 8 additions & 0 deletions
8
doc/code_snippets/snippets/config/instances.enabled/group_scope/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
groups: | ||
group001: | ||
iproto: | ||
listen: "3301" | ||
replicasets: | ||
replicaset001: | ||
instances: | ||
instance001: {} |
1 change: 1 addition & 0 deletions
1
doc/code_snippets/snippets/config/instances.enabled/group_scope/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
instance001: |
8 changes: 8 additions & 0 deletions
8
doc/code_snippets/snippets/config/instances.enabled/instance_scope/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
instances: | ||
instance001: | ||
iproto: | ||
listen: "3301" |
1 change: 1 addition & 0 deletions
1
doc/code_snippets/snippets/config/instances.enabled/instance_scope/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
instance001: |
8 changes: 8 additions & 0 deletions
8
doc/code_snippets/snippets/config/instances.enabled/replicaset_scope/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
iproto: | ||
listen: "3301" | ||
instances: | ||
instance001: {} |
1 change: 1 addition & 0 deletions
1
doc/code_snippets/snippets/config/instances.enabled/replicaset_scope/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
instance001: |
10 changes: 10 additions & 0 deletions
10
doc/code_snippets/snippets/config/instances.enabled/templating/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
instances: | ||
instance001: | ||
snapshot: | ||
dir: ./var/{{ instance_name }}/snapshots | ||
wal: | ||
dir: ./var/{{ instance_name }}/wals |
1 change: 1 addition & 0 deletions
1
doc/code_snippets/snippets/config/instances.enabled/templating/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
instance001: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
tt: | ||
modules: | ||
# Directory where the external modules are stored. | ||
directory: "modules" | ||
|
||
app: | ||
# Directory that stores various instance runtime | ||
# artifacts like console socket, PID file, etc. | ||
run_dir: "var/run" | ||
|
||
# Directory that stores log files. | ||
log_dir: var/log | ||
|
||
# The maximum size in MB of the log file before it gets rotated. | ||
log_maxsize: 100 | ||
|
||
# The maximum number of days to retain old log files. | ||
log_maxage: 8 | ||
|
||
# The maximum number of old log files to retain. | ||
log_maxbackups: 10 | ||
|
||
# Restart instance on failure. | ||
restart_on_failure: false | ||
|
||
# Directory where write-ahead log (.xlog) files are stored. | ||
wal_dir: "var/lib" | ||
|
||
# Directory where memtx stores snapshot (.snap) files. | ||
memtx_dir: "var/lib" | ||
|
||
# Directory where vinyl files or subdirectories will be stored. | ||
vinyl_dir: "var/lib" | ||
|
||
# Directory that stores binary files. | ||
bin_dir: "bin" | ||
|
||
# Directory that stores Tarantool header files. | ||
inc_dir: "include" | ||
|
||
# Path to directory that stores all applications. | ||
# The directory can also contain symbolic links to applications. | ||
instances_enabled: "instances.enabled" | ||
|
||
# Tarantoolctl artifacts layout compatibility: if set to true tt will not create application | ||
# sub-directories for control socket, pid files, log files, etc.. Data files (wal, vinyl, | ||
# snap) and multi-instance applications are not affected by this option. | ||
tarantoolctl_layout: false | ||
|
||
# Path to file with credentials for downloading Tarantool Enterprise Edition. | ||
# credential_path: /path/to/file | ||
ee: | ||
credential_path: "" | ||
|
||
templates: | ||
# The path to templates search directory. | ||
- path: "templates" | ||
|
||
repo: | ||
# Directory where local rocks files could be found. | ||
rocks: "" | ||
# Directory that stores installation files. | ||
distfiles: "distfiles" |
31 changes: 31 additions & 0 deletions
31
doc/code_snippets/snippets/replication/instances.enabled/auto_leader/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
credentials: | ||
users: | ||
replicator: | ||
password: 'topsecret' | ||
roles: [replication] | ||
|
||
iproto: | ||
advertise: | ||
peer: replicator@ | ||
|
||
replication: | ||
failover: election | ||
|
||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
instances: | ||
instance001: | ||
iproto: | ||
listen: 127.0.0.1:3301 | ||
instance002: | ||
iproto: | ||
listen: 127.0.0.1:3302 | ||
instance003: | ||
iproto: | ||
listen: 127.0.0.1:3303 | ||
|
||
# Load sample data | ||
app: | ||
file: 'data.lua' |
32 changes: 32 additions & 0 deletions
32
doc/code_snippets/snippets/replication/instances.enabled/auto_leader/data.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function create_space() | ||
box.schema.space.create('bands') | ||
box.space.bands:format({ | ||
{ name = 'id', type = 'unsigned' }, | ||
{ name = 'band_name', type = 'string' }, | ||
{ name = 'year', type = 'unsigned' } | ||
}) | ||
box.space.bands:create_index('primary', { parts = { 'id' } }) | ||
end | ||
|
||
function create_sync_space() | ||
box.schema.space.create('bands', { is_sync = true }) | ||
box.space.bands:format({ | ||
{ name = 'id', type = 'unsigned' }, | ||
{ name = 'band_name', type = 'string' }, | ||
{ name = 'year', type = 'unsigned' } | ||
}) | ||
box.space.bands:create_index('primary', { parts = { 'id' } }) | ||
end | ||
|
||
function load_data() | ||
box.space.bands:insert { 1, 'Roxette', 1986 } | ||
box.space.bands:insert { 2, 'Scorpions', 1965 } | ||
box.space.bands:insert { 3, 'Ace of Base', 1987 } | ||
box.space.bands:insert { 4, 'The Beatles', 1960 } | ||
box.space.bands:insert { 5, 'Pink Floyd', 1965 } | ||
box.space.bands:insert { 6, 'The Rolling Stones', 1962 } | ||
box.space.bands:insert { 7, 'The Doors', 1965 } | ||
box.space.bands:insert { 8, 'Nirvana', 1987 } | ||
box.space.bands:insert { 9, 'Led Zeppelin', 1968 } | ||
box.space.bands:insert { 10, 'Queen', 1970 } | ||
end |
3 changes: 3 additions & 0 deletions
3
doc/code_snippets/snippets/replication/instances.enabled/auto_leader/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
instance001: | ||
instance002: | ||
instance003: |
35 changes: 35 additions & 0 deletions
35
doc/code_snippets/snippets/replication/instances.enabled/manual_leader/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
credentials: | ||
users: | ||
replicator: | ||
password: 'topsecret' | ||
roles: [replication] | ||
client: | ||
password: 'secret' | ||
roles: [super] | ||
|
||
iproto: | ||
advertise: | ||
peer: replicator@ | ||
|
||
replication: | ||
failover: manual | ||
|
||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
leader: instance001 | ||
instances: | ||
instance001: | ||
iproto: | ||
listen: 127.0.0.1:3301 | ||
instance002: | ||
iproto: | ||
listen: 127.0.0.1:3302 | ||
instance003: | ||
iproto: | ||
listen: 127.0.0.1:3303 | ||
|
||
# Load sample data | ||
app: | ||
file: 'myapp.lua' |
3 changes: 3 additions & 0 deletions
3
doc/code_snippets/snippets/replication/instances.enabled/manual_leader/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
instance001: | ||
instance002: | ||
instance003: |
32 changes: 32 additions & 0 deletions
32
doc/code_snippets/snippets/replication/instances.enabled/manual_leader/myapp.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function create_space() | ||
box.schema.space.create('bands') | ||
box.space.bands:format({ | ||
{ name = 'id', type = 'unsigned' }, | ||
{ name = 'band_name', type = 'string' }, | ||
{ name = 'year', type = 'unsigned' } | ||
}) | ||
box.space.bands:create_index('primary', { parts = { 'id' } }) | ||
end | ||
|
||
function create_sync_space() | ||
box.schema.space.create('bands', { is_sync = true }) | ||
box.space.bands:format({ | ||
{ name = 'id', type = 'unsigned' }, | ||
{ name = 'band_name', type = 'string' }, | ||
{ name = 'year', type = 'unsigned' } | ||
}) | ||
box.space.bands:create_index('primary', { parts = { 'id' } }) | ||
end | ||
|
||
function load_data() | ||
box.space.bands:insert { 1, 'Roxette', 1986 } | ||
box.space.bands:insert { 2, 'Scorpions', 1965 } | ||
box.space.bands:insert { 3, 'Ace of Base', 1987 } | ||
box.space.bands:insert { 4, 'The Beatles', 1960 } | ||
box.space.bands:insert { 5, 'Pink Floyd', 1965 } | ||
box.space.bands:insert { 6, 'The Rolling Stones', 1962 } | ||
box.space.bands:insert { 7, 'The Doors', 1965 } | ||
box.space.bands:insert { 8, 'Nirvana', 1987 } | ||
box.space.bands:insert { 9, 'Led Zeppelin', 1968 } | ||
box.space.bands:insert { 10, 'Queen', 1970 } | ||
end |
28 changes: 28 additions & 0 deletions
28
doc/code_snippets/snippets/replication/instances.enabled/master_master/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
credentials: | ||
users: | ||
replicator: | ||
password: 'topsecret' | ||
roles: [replication] | ||
|
||
iproto: | ||
advertise: | ||
peer: replicator@ | ||
|
||
replication: | ||
failover: off | ||
|
||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
instances: | ||
instance001: | ||
database: | ||
mode: rw | ||
iproto: | ||
listen: 127.0.0.1:3301 | ||
instance002: | ||
database: | ||
mode: rw | ||
iproto: | ||
listen: 127.0.0.1:3302 |
2 changes: 2 additions & 0 deletions
2
doc/code_snippets/snippets/replication/instances.enabled/master_master/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
instance001: | ||
instance002: |
Oops, something went wrong.