This commit is contained in:
Mahmut Bulut 2020-02-11 02:44:47 +01:00
parent a2d8108174
commit b1b1c13231
16 changed files with 250 additions and 14 deletions

12
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: bastion
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay:
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

20
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,20 @@
<!--
Thank you for reporting an issue.
This issue tracker is for bugs and issues found within Bastion.
Please fill in as much of the template below as you're able.
Version: Versions of `artillery` subcrates respectively. Like `artillery-core = 0.1.0`.
Platform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)
Subsystem: if known, please specify affected core module name
If possible, please provide code that demonstrates the problem, keeping it as
simple and free of external dependencies as you are able.
-->
* **Version**:
* **Platform**:
* **Subsystem**:
<!-- Enter your issue details below this comment. -->

24
.github/ISSUE_TEMPLATE/1-bug-report.md vendored Normal file
View File

@ -0,0 +1,24 @@
---
name: "\U0001F41B Bug report"
about: Create a report to help us improve
---
<!--
Thank you for reporting a possible bug in Bastion.
Please fill in as much of the template below as you can.
Version: Versions of `artillery` subcrates respectively. Like `artillery-core = 0.1.0`.
Platform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)
Subsystem: if known, please specify affected core module name
If possible, please provide code that demonstrates the problem, keeping it as
simple and free of external dependencies as you can.
-->
* **Version**:
* **Platform**:
* **Subsystem**:
<!-- Please provide more details below this comment. -->

View File

@ -0,0 +1,20 @@
---
name: "\U0001F680 Feature request"
about: Suggest an idea for this project
---
<!--
Thank you for suggesting an idea to make Artillery better.
Please fill in as much of the template below as you're able.
-->
**Is your feature request related to a problem? Please describe.**
Please describe the problem you are trying to solve.
**Describe the solution you'd like**
Please describe the desired behavior.
**Describe alternatives you've considered**
Please describe alternative solutions or features you have considered.

44
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,44 @@
<!--
Thank you for your pull request. Please provide a description above and review
the requirements below.
Bug fixes and new features should include tests and possibly benchmarks.
Contributors guide: https://github.com/bastion-rs/.github/blob/master/CONTRIBUTING.md
-->
##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->
- [ ] tests are passing with `cargo test`.
- [ ] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [ ] commit message is clear
<!--
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
-->

80
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,80 @@
name: CI
on: [push, pull_request]
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
toolchain:
- x86_64-pc-windows-msvc
- x86_64-pc-windows-gnu
- i686-pc-windows-msvc
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
version:
- stable
- nightly
include:
- toolchain: x86_64-pc-windows-msvc
os: windows-latest
- toolchain: x86_64-pc-windows-gnu
os: windows-latest
- toolchain: i686-pc-windows-msvc
os: windows-latest
- toolchain: x86_64-unknown-linux-gnu
os: ubuntu-latest
- toolchain: x86_64-apple-darwin
os: macOS-latest
name: ${{ matrix.version }} - ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-${{ matrix.toolchain }}
default: true
- name: check nightly
if: matrix.version == 'nightly'
uses: actions-rs/cargo@v1
with:
command: check
args: --all --benches --bins --examples --tests
- name: check stable
if: matrix.version == 'stable'
uses: actions-rs/cargo@v1
with:
command: check
args: --all --bins --examples --tests
- name: tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
check_fmt_and_docs:
name: Checking fmt and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
components: rustfmt
- name: fmt
run: cargo fmt --all -- --check
- name: doc
run: cargo doc

16
.github/workflows/clippy.yml vendored Normal file
View File

@ -0,0 +1,16 @@
on: pull_request
name: Clippy Check
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,11 +1,31 @@
Artillery
============
Artillery is a distributed carrier protocol for Bastion.
Artillery is a cluster management & distributed data protocol.
It contains the modules below:
* `artillery-ddata`: Used for distributed data replication
* `artillery-core`: Contains leader election and epidemic protocol for broadcasting
* `artillery-core`: Contains:
* `cluster`: Prepared self-healing cluster structures
* `epidemic`: Infection style clustering
* `service_discovery`: Service discovery types
* `mdns`: MDNS based service discovery
* `udp_anycast`: UDP Anycast based service discovery
* `artillery-hierman`: Supervision hierarchy management layer (aka Bastion's core carrier protocol)
We need a logo here. Cannons are shooting from bastions… Maybe… That was just an idea.
## Examples
Below you can find examples to learn Artillery.
You can also take a look at the [Core Examples](https://github.com/bastion-rs/artillery/tree/master/artillery-core/examples).
### Launching a local AP Cluster
To spawn a local AP cluster at any size you can use the command below in the root directory of the project:
```bash
$ deployment-tests/cluster-mdns-ap-test.sh -s 50
```
Argument `-s` defines the amount of nodes in the cluster.
To shut down the cluster either use:
```bash
$ killall cball_mdns_sd_infection
```
or kill processes one by one to see that cluster is self-healing.

View File

@ -19,7 +19,7 @@ use once_cell::sync::{Lazy, OnceCell};
use std::sync::mpsc::channel;
use std::thread;
use chrono::Duration;
use artillery_core::service_discovery::multicast::prelude::*;
use artillery_core::service_discovery::udp_anycast::prelude::*;
use artillery_core::constants::*;
use artillery_core::epidemic::prelude::*;

View File

@ -1,4 +1,4 @@
use crate::service_discovery::multicast::prelude::*;
use crate::service_discovery::udp_anycast::prelude::*;
use crate::epidemic::prelude::*;
#[derive(Default)]

View File

@ -13,7 +13,7 @@ impl Default for MDNSServiceDiscoveryConfig {
SocketAddr::from(([127, 0, 0, 1], CONST_INFECTION_PORT));
Self {
reply_ttl: Duration::from_millis(10),
reply_ttl: Duration::from_secs(120),
local_service_addr
}
}

View File

@ -1,2 +1,2 @@
pub mod multicast;
pub mod udp_anycast;
pub mod mdns;

View File

@ -1,7 +1,7 @@
use crate::errors::*;
use crate::service_discovery::multicast::discovery_config::MulticastServiceDiscoveryConfig;
use crate::service_discovery::multicast::state::MulticastServiceDiscoveryState;
use crate::service_discovery::multicast::state::{ServiceDiscoveryReply, ServiceDiscoveryRequest};
use crate::service_discovery::udp_anycast::discovery_config::MulticastServiceDiscoveryConfig;
use crate::service_discovery::udp_anycast::state::MulticastServiceDiscoveryState;
use crate::service_discovery::udp_anycast::state::{ServiceDiscoveryReply, ServiceDiscoveryRequest};
use cuneiform_fields::arch::ArchPadding;
use std::sync::mpsc;
use std::sync::mpsc::{channel, Sender, Receiver};
@ -23,7 +23,7 @@ impl MulticastServiceDiscovery {
MulticastServiceDiscoveryState::event_loop(&mut internal_rx, poll, state)
.expect("Failed to create event loop");
})
.expect("cannot start multicast service discovery state thread");
.expect("cannot start udp_anycast service discovery state thread");
Ok(Self {
comm: ArchPadding::new(internal_tx),
@ -48,7 +48,7 @@ impl MulticastServiceDiscovery {
Ok(self.comm.send(ServiceDiscoveryRequest::SetBroadcastListen(listen))?)
}
/// Explore the network to find nodes using multicast SD.
/// Explore the network to find nodes using udp_anycast SD.
pub fn seek_peers(&self) -> Result<()> {
Ok(self.comm.send(ServiceDiscoveryRequest::SeekPeers)?)
}

View File

@ -1,6 +1,6 @@
use crate::constants::*;
use crate::errors::*;
use crate::service_discovery::multicast::discovery_config::MulticastServiceDiscoveryConfig;
use crate::service_discovery::udp_anycast::discovery_config::MulticastServiceDiscoveryConfig;
use bastion_utils::math::random;
use cuneiform_fields::arch::ArchPadding;
use mio::net::UdpSocket;
@ -210,7 +210,7 @@ impl MulticastServiceDiscoveryState {
}
if !state.running {
debug!("Stopping artillery multicast service discovery evloop");
debug!("Stopping artillery udp_anycast service discovery evloop");
break;
}