Skip to content

Commit cbc19f6

Browse files
authored
Merge pull request #53 from CoLearn-Dev/default-params
Add default params for usability
2 parents d4b9852 + 6317624 commit cbc19f6

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "colink-server"
3-
version = "0.3.3"
3+
version = "0.3.4"
44
edition = "2021"
55

66
[dependencies]

README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CoLink provides a unified interface for the user, storage, communication, and co
44

55
## Preparations
66

7-
### Generate mTLS certificates
7+
### Generate mTLS certificates (optional)
88
The CoLink server and the clients uses mTLS to communicate. In the repo, we included a set of [example certificates](https://github.com/CoLearn-Dev/colink-integration-test-dev/tree/main/example-tls/test-cert). **Please DO NOT use the example certificates in a production environment.**
99

1010
To generate the corresponding certificates for mTLS, you can use OpenSSL or CFSSL.
@@ -16,13 +16,13 @@ To generate the corresponding certificates for mTLS, you can use OpenSSL or CFSS
1616
- [mTLS](https://developers.cloudflare.com/cloudflare-one/identity/devices/mutual-tls-authentication/)
1717
- [GitHub repo](https://github.com/cloudflare/cfssl)
1818

19-
### Set up RabbitMQ
19+
### Set up RabbitMQ (optional)
2020
- [Download and Installation](https://www.rabbitmq.com/download.html)
2121
- [Enable Management API](https://www.rabbitmq.com/management.html)
2222
- [Example Configuration](https://github.com/CoLearn-Dev/colink-integration-test-dev/blob/main/example-rabbitmq/rabbitmq.conf)
2323

2424
## Start CoLink server
25-
CoLink server requires a [message queue](#set-up-rabbitmq) as its building block. When starting the CoLink server, we need to specify MQ's URI and management API here.
25+
CoLink server requires a message queue (RabbitMQ or Redis Stream) as its building block. When starting the CoLink server, we can specify MQ's URI and management API here (the default MQ is a built-in Redis). **Note: Redis mode does not support TLS for now. Please use RabbitMQ in production environments.**
2626

2727
Use the following command to start the CoLink server
2828
```
@@ -33,17 +33,21 @@ cargo run -- --address <address> --port <port> --mq-uri <mq uri> --mq-api <mq ap
3333
For the details about the parameters, please check [here](src/main.rs#L7).
3434

3535
### Example
36+
Minimal
37+
```bash
38+
cargo run
39+
```
3640
Without TLS
3741
```bash
38-
cargo run -- --address 127.0.0.1 --port 8080 --mq-uri amqp://guest:guest@localhost:5672 --mq-api http://guest:guest@localhost:15672/api --core-uri http://127.0.0.1:8080
42+
cargo run -- --address 127.0.0.1 --port 2021 --mq-uri amqp://guest:guest@localhost:5672 --mq-api http://guest:guest@localhost:15672/api --core-uri http://127.0.0.1:2021
3943
```
4044
TLS
4145
```bash
42-
cargo run -- --address 127.0.0.1 --port 8080 --mq-uri <mq uri> --mq-api <mq api> --cert <path to server-fullchain.pem> --key <path to server-key.pem> --inter-core-ca <path to ca.pem>
46+
cargo run -- --address 127.0.0.1 --port 2021 --mq-uri <mq uri> --mq-api <mq api> --cert <path to server-fullchain.pem> --key <path to server-key.pem> --inter-core-ca <path to ca.pem>
4347
```
4448
mTLS
4549
```bash
46-
cargo run -- --address 127.0.0.1 --port 8080 --mq-uri <mq uri> --mq-api <mq api> --cert <path to server-fullchain.pem> --key <path to server-key.pem> --ca <path to ca.pem> --inter-core-ca <path to ca.pem> --inter-core-cert <path to client.pem> --inter-core-key <path to client-key.pem>
50+
cargo run -- --address 127.0.0.1 --port 2021 --mq-uri <mq uri> --mq-api <mq api> --cert <path to server-fullchain.pem> --key <path to server-key.pem> --ca <path to ca.pem> --inter-core-ca <path to ca.pem> --inter-core-cert <path to client.pem> --inter-core-key <path to client-key.pem>
4751
```
4852

4953
## Test the server

src/main.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ use std::path::PathBuf;
77
struct CommandLineArgs {
88
/// Address of CoLink server
99
// short and long flags (-d, --debug) will be deduced from the field's name
10-
#[arg(short, long, env = "COLINK_SERVER_ADDRESS")]
10+
#[arg(
11+
short,
12+
long,
13+
env = "COLINK_SERVER_ADDRESS",
14+
default_value = "127.0.0.1"
15+
)]
1116
address: String,
1217

1318
/// Port of CoLink server
14-
#[arg(short, long, env = "COLINK_SERVER_PORT")]
19+
#[arg(short, long, env = "COLINK_SERVER_PORT", default_value = "2021")]
1520
port: u16,
1621

1722
/// URI of MQ (AMQP or Redis)
@@ -27,7 +32,11 @@ struct CommandLineArgs {
2732
mq_prefix: String,
2833

2934
/// URI of CoLink server
30-
#[arg(long, env = "COLINK_SERVER_CORE_URI")]
35+
#[arg(
36+
long,
37+
env = "COLINK_SERVER_CORE_URI",
38+
default_value = "http://127.0.0.1:2021"
39+
)]
3140
core_uri: Option<String>,
3241

3342
/// Path to server certificate.

user_init_config.template.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ value = "true"
88
operator_num = 1
99

1010
[registry]
11-
operator_num = 1
11+
operator_num = 0 # Disabled by default. If you wanted to connect to others, change it to 1.
1212
start_after = [ "policy_module", "remote_storage" ]
1313
[[registry.create_entry]]
1414
key_name = "_registry:init:default_registry_addr"

0 commit comments

Comments
 (0)