Skip to content

Commit

Permalink
Merge pull request #167 from picodata/166-fix_role_naming
Browse files Browse the repository at this point in the history
Fix incorrect role names when using tabs and spaces in the genin file
  • Loading branch information
Kasen authored Sep 19, 2024
2 parents 7b8c2c8 + b26192f commit bba224a
Show file tree
Hide file tree
Showing 29 changed files with 1,845 additions and 1,319 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ node_modules
/deploy/terraform.tfstate.backup
./*.genin.yml
./*.genin.yaml
!/configs/*.yaml
!/configs/*.yml
!/docs/examples/*
/tests/.*
.geninstate
73 changes: 73 additions & 0 deletions configs/cluster.genin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
# List of replicasets as an array
topology:
- name: router
# How many masters we want, by default equal 1
replicasets_count: 1
# Array of roles for this instance
roles:
- router
- failover-coordinator
- name: storage
# How many masters we want, by default equal 1
replicasets_count: 2
# Number of replicas in replicaset, default 0
replication_factor: 2
# Array of roles for this instance
roles:
- storage
# List of regions, datacenters, and servers
hosts:
- name: datacenter-1
# Config with arbitrary key-values pairs
config:
# Specify http port to start counting from
http_port: 8081
# Specify binary port to start counting from
binary_port: 3031
# List of regions, datacenters, and servers
hosts:
- name: server-1
# Config with arbitrary key-values pairs
config:
# Specify http port to start counting from
http_port: 8081
# Specify binary port to start counting from
binary_port: 3031
# Host or instance address (maybe IP or URI)
address: 192.168.16.11
- name: server-2
# Config with arbitrary key-values pairs
config:
# Specify http port to start counting from
http_port: 8081
# Specify binary port to start counting from
binary_port: 3031
# Host or instance address (maybe IP or URI)
address: 192.168.16.12
# Failover management options
failover:
# Failover mode (stateful, eventual, disabled)
mode: stateful
# What is serve failover (stateboard, stateful)
state_provider: stateboard
# Params for chosen in state_provider failover type
stateboard_params:
# Uri on which the stateboard will be available
uri: "192.168.16.11:4401"
# Stateboard password
password: password
# Vars similar to those configured in the cartridge inventory
vars:
# Username under which the ansible will connect to the servers
ansible_user: ansible
# Ansible user password
ansible_password: ansible
# Application name
cartridge_app_name: myapp
# Cookie for connecting to the administrative console of the instances
cartridge_cluster_cookie: myapp-cookie
# Path to the application package
cartridge_package_path: /tmp/myapp.rpm
# Indicates if vshard must be bootstrapped on the cluster
cartridge_bootstrap_vshard: true
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const DEFAULT_STATEBOARD_PORT: u16 = 4401;
const DEFAULT_HTTP_PORT: u16 = 8081;
const DEFAULT_BINARY_PORT: u16 = 3031;

const DEFAULT_CFG_NAME: &str = "cluster.genin.yml";
const DEFAULT_CFG: &[u8] = include_bytes!("../configs/cluster.genin.yml");

fn main() -> Result<(), Box<dyn std::error::Error>> {
task::run_v2()?;
Ok(())
Expand Down
2 changes: 0 additions & 2 deletions src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ pub trait Validate {
type Error: fmt::Debug + ToString;

fn validate(bytes: &[u8]) -> Result<Self::Type, Self::Error>;

fn whole_block(bytes: &[u8]) -> String;
}

trait AsError {
Expand Down
19 changes: 0 additions & 19 deletions src/task/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,6 @@ pub(super) fn read() -> ArgMatches {
"Used to overwrite the output file, whether \
or not it exists.",
),
Arg::new("failover-mode")
.long("failover-mode")
.short('m')
.action(ArgAction::Set)
.default_value("stateful")
.help("(string): failover mode (stateful, eventual, disabled)"),
Arg::new("failover-state-provider")
.long("failover-state-provider")
.short('F')
.action(ArgAction::Set)
.default_value("stateboard")
.help("(string): failover state provider (etcd2, stateboard, disabled)"),
Arg::new("print")
.long("print")
.short('p')
.action(ArgAction::Set)
.default_values(["colorized", "ports"])
.num_args(1..=3)
.help("(list, optional): cluster print output option"),
Arg::new("quiet")
.long("quiet")
.short('q')
Expand Down
Loading

0 comments on commit bba224a

Please sign in to comment.