Skip to content

Commit 7360431

Browse files
authored
Merge pull request #44 from petehayes102/master
Total rewrite using Tokio and Futures
2 parents e644673 + 1f20055 commit 7360431

File tree

167 files changed

+2300
-19742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+2300
-19742
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Cargo.lock
2-
.pkg/
31
/target/
2+
**/*.rs.bk
3+
Cargo.lock

.travis.yml

Lines changed: 14 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,20 @@ rust:
33
- stable
44
- beta
55
- nightly
6-
sudo: false
7-
8-
addons:
9-
apt:
10-
sources:
11-
- sourceline: 'ppa:chris-lea/libsodium'
12-
- sourceline: 'deb http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main'
13-
- sourceline: 'deb-src http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main'
14-
packages:
15-
- libcurl4-openssl-dev
16-
- libelf-dev
17-
- libdw-dev
18-
- binutils-dev
19-
- libsodium-dev
20-
21-
before_script:
22-
- |
23-
export PATH=$HOME/.local/bin:$PATH
24-
export LIBRARY_PATH=$HOME/lib
25-
export LD_LIBRARY_PATH=$HOME/lib
26-
export PKG_CONFIG_PATH=$HOME/lib/pkgconfig
27-
28-
curl -sSOL https://github.com/zeromq/libzmq/releases/download/v4.2.0/zeromq-4.2.0.tar.gz
29-
tar zxf zeromq-4.2.0.tar.gz
30-
cd zeromq-4.2.0
31-
./autogen.sh
32-
./configure --prefix=$HOME --with-libsodium
33-
make && make install
34-
cd ..
35-
36-
curl -sSOL https://github.com/zeromq/czmq/releases/download/v4.0.1/czmq-4.0.1.tar.gz
37-
tar zxf czmq-4.0.1.tar.gz
38-
cd czmq-4.0.1
39-
./configure --prefix=$HOME
40-
make && make install
41-
cd $TRAVIS_BUILD_DIR
42-
6+
matrix:
7+
allow_failures:
8+
- rust: nightly
9+
cache: cargo
4310
script:
44-
- cargo build --verbose
45-
- cargo test --verbose
46-
- |
47-
ln -s "$HOME/lib/libczmq.so.4" target/debug
48-
ln -s "$HOME/lib/libzmq.so.5" target/debug
49-
50-
cd bindings
51-
52-
for VER in 5 7
53-
do
54-
cd "php$VER"
55-
ln -s ../c include
56-
phpize
57-
./configure --with-inapi=../../target/debug
58-
make
59-
TEST_PHP_ARGS="-q" make test || exit 1
60-
cd ..
61-
done
62-
63-
cd ..
64-
11+
- cargo build --verbose --all
12+
- cargo test --verbose --all
13+
- cargo doc --verbose --all --no-deps
14+
deploy:
15+
provider: pages
16+
skip_cleanup: true
17+
local_dir: $TRAVIS_BUILD_DIR/target/doc
18+
github_token: $GITHUB_TOKEN
19+
on:
20+
branch: master
6521
env:
6622
- TRAVIS_CARGO_NIGHTLY_FEATURE=""

AUTHORS

Lines changed: 0 additions & 1 deletion
This file was deleted.

COPYRIGHT

Lines changed: 0 additions & 41 deletions
This file was deleted.

Cargo.toml

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,7 @@
1-
[package]
2-
name = "intecture-api"
3-
version = "0.3.2"
4-
authors = [ "Peter Hayes <peter.hayes@betweenlines.co.uk>" ]
5-
license = "MPL-2.0"
6-
description = "API component for Intecture infrastructure. Intecture is the developer friendly, multi-lingual configuration management tool."
7-
keywords = ["intecture", "api"]
8-
homepage = "https://intecture.io"
9-
repository = "https://github.com/intecture/api"
10-
build = "build.rs"
11-
12-
[features]
13-
default = ["remote-run"]
14-
# Run API endpoints against the local machine
15-
local-run = []
16-
# Run API endpoints against a remote agent
17-
remote-run = ["czmq"]
18-
19-
[dev-dependencies]
20-
tempdir = "0.3"
21-
22-
[dependencies]
23-
lazy_static = "0.2"
24-
libc = "0.2"
25-
mustache = "0.8"
26-
regex = "0.2"
27-
rustc-serialize = "0.3"
28-
serde = "0.9"
29-
serde_derive = "0.9"
30-
serde_json = "0.9"
31-
tempfile = "2.1"
32-
zfilexfer = "0.0.2"
33-
hostname = "0.1"
34-
czmq = { version = "0.1", optional = true }
35-
pnet = "0.16"
36-
37-
[lib]
38-
name = "inapi"
39-
crate_type = ["rlib", "dylib"]
1+
[workspace]
2+
members = [
3+
"agent",
4+
"bindings",
5+
"core",
6+
"proj",
7+
]

Makefile

Lines changed: 0 additions & 69 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,16 @@
1-
# Intecture [![Build Status](https://travis-ci.org/intecture/api.svg?branch=master)](https://travis-ci.org/intecture/api) [![Coverage Status](https://coveralls.io/repos/github/Intecture/api/badge.svg?branch=master)](https://coveralls.io/github/Intecture/api?branch=master) [![Gitter](https://badges.gitter.im/Join/%20Chat.svg)](https://gitter.im/intecture/Lobby)
1+
# Intecture APIs [![Build Status](https://travis-ci.org/intecture/api.svg?branch=master)](https://travis-ci.org/intecture/api) [![Coverage Status](https://coveralls.io/repos/github/Intecture/api/badge.svg?branch=master)](https://coveralls.io/github/Intecture/api?branch=master) [![Gitter](https://badges.gitter.im/Join\%20Chat.svg)](https://gitter.im/intecture/Lobby)
22

3-
Intecture is a developer friendly, language agnostic configuration management tool for server systems.
3+
**Intecture is an API for managing your servers. Visit [intecture.io](https://intecture.io).**
44

5-
* Extensible support for virtually any programming language
6-
* Standard programming interface. No DSL. No magic.
7-
* Rust API library (and bindings for popular languages)
5+
---
86

9-
You can find out more at [intecture.io](https://intecture.io).
7+
Intecture's APIs (_cough_ and a binary) are the heart and soul of Intecture. Check out each component's `README.md` for details:
108

11-
## Installation
9+
- [core](core/) - The core API that does all the heavy lifting
10+
- [bindings](bindings/) - Rust FFI and language bindings
11+
- [proj](proj/) - Helpers and boilerplate for building Intecture projects
12+
- [agent](agent/) - Tiny daemon that exposes the core API as a service (for your hosts!)
1213

13-
The best way to get up and running is by using the Intecture installer:
14+
## What's new?
1415

15-
```
16-
$ curl -sSf https://get.intecture.io/ | sh -s -- api
17-
```
18-
19-
For other installation options and dependencies, see the [Intecture book](https://intecture.io/book/rust/ch05-02-01-reference-api-installation.html).
20-
21-
#### Uninstallation
22-
23-
```
24-
$ curl -sSf https://get.intecture.io/ | sh -s -- -u api
25-
```
26-
27-
## Contributing
28-
29-
Dude! Awesome. Have a look at [`CONTRIBUTING.md`](CONTRIBUTING.md) for details.
30-
31-
## Support
32-
33-
- For any bugs, feature requests etc., please ticket them on GitHub.
34-
- You can ask questions and chat on our [Gitter channel](https://gitter.im/intecture/Lobby).
35-
- For enterprise support and consulting, please email <mailto:support@intecture.io>.
16+
Check out [RELEASES.md](RELEASES.md) for details.

RELEASES.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 0.4.0 (in progress)
2+
3+
Version 0.4 is a complete rewrite of Intecture's core API. If we had been running a stable release (i.e. 1.0), this version would be version 2.0, but sadly we have to go with the far less dramatic 0.4 :(
4+
5+
Anyway, there are some big headlines in this release:
6+
7+
- **Hello Tokio!** This is an exciting change to our socket API, as we bid a fond farewell to ZeroMQ. The change to Tokio will bring loads of benefits, such as substantially reducing our non-Rust dependencies, and introducing strongly typed messaging between servers and clients. This will make our communications more robust and less open to exploitation. Woo hoo!
8+
- **Asynchronous endpoints with `Futures`!** This is another huge change to the API, allowing us to multitask our configurations. It will also pave the way for a streaming API, which has been sorely lacking in Intecture until now.
9+
- **Greater emphasis on composability.** Each endpoint (formerly called _primitives_) is organised into a collection of _providers_ that will (you guessed it) provide target-specific implementations of the endpoint. Users will be able to select an endpoint provider manually or let the system choose the best provider for the target platform.
10+
- **Separation of duties.** In the previous versions of Intecture, the API had been organised into a single project, making it cluttered and unwieldy. For the next release, things like the FFI, language bindings and project boilerplate will be moved into separate child projects under the same Cargo workspace.

agent/Cargo.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = "intecture_agent"
3+
version = "0.4.0"
4+
authors = [ "Pete Hayes <pete@intecture.io>" ]
5+
license = "MPL-2.0"
6+
description = "Tiny daemon that exposes Intecture's API as a service"
7+
homepage = "https://intecture.io"
8+
repository = "https://github.com/intecture/api"
9+
documentation = "https://intecture.io/rust/inapi/"
10+
keywords = ["intecture", "agent"]
11+
categories = ["servers"]
12+
readme = "README.md"
13+
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
14+
15+
[badges]
16+
travis-ci = { repository = "intecture/api" }
17+
18+
[dependencies]
19+
clap = "2.26"
20+
env_logger = "0.4"
21+
error-chain = "0.11"
22+
futures = "0.1"
23+
intecture_api = { version = "0.4.0", path = "../core" }
24+
serde = "1.0"
25+
serde_derive = "1.0"
26+
serde_json = "1.0"
27+
tokio-proto = "0.1"
28+
tokio-service = "0.1"
29+
toml = "0.4"

agent/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Agent
2+
3+
Intecture Agent is a tiny daemon that exposes Intecture's core API as a service. This service should be running on each of your hosts to allow Intecture to manage them remotely. To connect to a remote host, use the `host::remote::Plain` type from [core](../core/).
4+
5+
## Usage
6+
7+
To run the agent, simply execute the `intecture_agent` binary, remembering to pass it a socket address to listen on.
8+
9+
For example, to listen to localhost on port 7101, run:
10+
11+
```sh
12+
intecture_agent --address localhost:7101
13+
```
14+
15+
More likely though you'll want to listen on your public interface so that Intecture can talk to the host remotely. In this case you should specify the host's IP address, or use `0.0.0.0` to listen on all interfaces.
16+
17+
## Config file
18+
19+
You can also store agent parameters in a configuration file. The file must be in TOML format, and can live anywhere on your server. It should look like this:
20+
21+
```toml
22+
address = "0.0.0.0:7101"
23+
```
24+
25+
Once you've created a config file, you can start the agent by passing it the file path:
26+
27+
```sh
28+
intecture_agent --config agent.toml
29+
```

0 commit comments

Comments
 (0)