-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean up API clients, work on cross-builds of binaries + container im…
…ages
- Loading branch information
Showing
26 changed files
with
225 additions
and
149 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[workspace] | ||
|
||
resolver = "2" | ||
members = ["zeronsd", "central-api", "service-api", "tests"] | ||
members = ["zeronsd", "tests", "zerotier-api"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM nixos/nix:latest AS builder | ||
|
||
COPY . /tmp/build | ||
WORKDIR /tmp/build | ||
|
||
RUN nix \ | ||
--extra-experimental-features "nix-command flakes" \ | ||
--option filter-syscalls false \ | ||
build | ||
|
||
RUN mkdir /tmp/nix-store-closure | ||
RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure | ||
|
||
FROM scratch | ||
|
||
WORKDIR / | ||
|
||
# Copy /nix/store | ||
COPY --from=builder /tmp/nix-store-closure /nix/store | ||
COPY --from=builder /tmp/build/result/bin/zeronsd /bin/zeronsd | ||
CMD ["/bin/zeronsd"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ pkgs, cargo-package, ... }: | ||
|
||
pkgs.dockerTools.buildImage { | ||
name = cargo-package.name; | ||
tag = cargo-package.version; | ||
created = "now"; | ||
|
||
copyToRoot = pkgs.buildEnv { | ||
name = "zeronsd-image-root"; | ||
paths = with pkgs; [ zeronsd zerotierone dockerTools.caCertificates ]; | ||
pathsToLink = [ "/bin" "/etc" ]; | ||
}; | ||
|
||
config = { | ||
Cmd = [ "/bin/zeronsd" ]; | ||
WorkingDir = "/var/lib/zeronsd"; | ||
Volumes = { "/var/lib/zeronsd" = {}; }; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,33 @@ | ||
VERSION := shell("toml get zeronsd/Cargo.toml package.version") | ||
DOCKER_TAG := "zeronsd:" + VERSION | ||
|
||
version: | ||
@echo {{VERSION}} | ||
|
||
build: | ||
nix build | ||
|
||
build-image: | ||
nix build .#container | ||
docker load < result | ||
docker tag {{DOCKER_TAG}} zeronsd:latest | ||
|
||
dns-ip network: | ||
@sudo zerotier-cli -j listnetworks \ | ||
resolve network name: | ||
nix run nixpkg#dig @$(zerotier-cli -j listnetworks \ | ||
| jq -r \ | ||
'.[] | select(.id == "{{network}}") \ | ||
| .dns.servers \ | ||
| select(.[] | test("\\d+\\.\\d+\\.\\d+\\.\\d+")) \ | ||
| last' | ||
| last') \ | ||
{{name}} | ||
|
||
run network config="./config.yaml" token="./.central.token": build | ||
file {{config}} | ||
sudo docker load < result | ||
sudo docker run \ | ||
--net=host \ | ||
--init \ | ||
-v {{config}}:/var/lib/zeronsd/config.yaml \ | ||
-v {{token}}:/var/lib/zeronsd/central.token \ | ||
-v /var/lib/zerotier-one:/var/lib/zerotier-one \ | ||
zeronsd:latest \ | ||
zerotier/{{DOCKER_TAG}} \ | ||
zeronsd start -c /var/lib/zeronsd/config.yaml {{network}} |
Oops, something went wrong.