From 95db71be6169ab31e92290a8cdf0ea21120a87f4 Mon Sep 17 00:00:00 2001 From: notplants Date: Mon, 6 Dec 2021 17:49:04 +0100 Subject: [PATCH 1/2] deploy_binary.sh --- .cargo/config | 4 ++++ .gitignore | 1 + deploy_binary.sh | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 .cargo/config create mode 100644 deploy_binary.sh diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 0000000..f28e890 --- /dev/null +++ b/.cargo/config @@ -0,0 +1,4 @@ +[target.x86_64-unknown-linux-musl] +linker = "x86_64-unknown-linux-musl-gcc" +objcopy = { path ="x86_64-unknown-linux-musl-objcopy" } +strip = { path ="x86_64-unknown-linux-musl-strip" } \ No newline at end of file diff --git a/.gitignore b/.gitignore index f8794c1..2ea090b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ ns_tests/*.key ns_tests/* .DS_Store bash +.idea diff --git a/deploy_binary.sh b/deploy_binary.sh new file mode 100644 index 0000000..7a34720 --- /dev/null +++ b/deploy_binary.sh @@ -0,0 +1,5 @@ + + +VERSION=0.1.0 +scp -i ~/.ssh/do_rsa2 target/x86_64-unknown-linux-musl/release/peach-dyndns-server root@147.182.177.135:/srv/files.commoninternet.net/peach-dyndns-server_${VERSION}_Linux_x86_64 + From d4d9ab3f9ff149836387999981885975d2bf6784 Mon Sep 17 00:00:00 2001 From: notplants Date: Sat, 18 Dec 2021 10:34:55 -0500 Subject: [PATCH 2/2] Add examples to README --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 16 ++++++++++++++-- cross_compile.sh | 2 ++ deploy_binary.sh | 2 +- src/lib.rs | 6 ++---- 6 files changed, 21 insertions(+), 9 deletions(-) create mode 100755 cross_compile.sh mode change 100644 => 100755 deploy_binary.sh diff --git a/Cargo.lock b/Cargo.lock index 77dd3ff..d7492c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1051,7 +1051,7 @@ dependencies = [ [[package]] name = "peach-dyndns-server" -version = "0.1.0" +version = "0.1.2" dependencies = [ "clap-log-flag", "clap-verbosity-flag", diff --git a/Cargo.toml b/Cargo.toml index 9eba1b6..5f46757 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "peach-dyndns-server" -version = "0.1.0" +version = "0.1.2" authors = ["Michael Williams ", "Max Fowler "] edition = "2018" diff --git a/README.md b/README.md index 4d47f66..4c30dda 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,23 @@ staging is deployed to /srv/peachcloud/peach-dyndns-server/dev-peach-dyndns ## Test -test peach-dyndns server is running, +# ping ``` -curl http://localhost:8000 +curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "ping", "id":1 }' 127.0.0.1:3002 ``` +# register_domain +``` +curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "register_domain", "params" : {"domain": "mirage.dyn.peachcloud.org" }, "id":1 }' 127.0.0.1:3002 +``` + +# is_domain_available +``` +curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0", "method": "is_domain_available", "params" : {"domain": "mirage.dyn.peachcloud.org" }, "id":1 }' 127.0.0.1:3002 +``` + + + test peach-bind9 is running, ``` nslookup blue.dyn.peachcloud.org ns.peachcloud.org diff --git a/cross_compile.sh b/cross_compile.sh new file mode 100755 index 0000000..59d5a1c --- /dev/null +++ b/cross_compile.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +cargo build --release --target=x86_64-unknown-linux-musl diff --git a/deploy_binary.sh b/deploy_binary.sh old mode 100644 new mode 100755 index 7a34720..091f2f3 --- a/deploy_binary.sh +++ b/deploy_binary.sh @@ -1,5 +1,5 @@ -VERSION=0.1.0 +VERSION=0.1.2 scp -i ~/.ssh/do_rsa2 target/x86_64-unknown-linux-musl/release/peach-dyndns-server root@147.182.177.135:/srv/files.commoninternet.net/peach-dyndns-server_${VERSION}_Linux_x86_64 diff --git a/src/lib.rs b/src/lib.rs index 2b0e477..df0d4dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,11 +72,9 @@ pub fn run() -> Result<(), BoxError> { let http_server = env::var("PEACH_DYNDNS_SERVER").unwrap_or_else(|_| "127.0.0.1:3001".to_string()); - info!("Starting JSON-RPC server on {}.", http_server); + info!("Starting JSON-RPC server on {}", http_server); let server = ServerBuilder::new(io) - .cors(DomainsValidation::AllowOnly(vec![ - AccessControlAllowOrigin::Null, - ])) + .cors(DomainsValidation::Disabled) .start_http( &http_server .parse()