-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' into build_dockers_test1
- Loading branch information
Showing
272 changed files
with
10,543 additions
and
830 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
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
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,47 @@ | ||
[package] | ||
name = "tari_swarm_daemon" | ||
version.workspace = true | ||
edition.workspace = true | ||
authors.workspace = true | ||
repository.workspace = true | ||
license.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
tari_core = { workspace = true } # Used for VN registration signature | ||
tari_common = { workspace = true } # Needed for the Network enum (-_-) | ||
tari_common_types = { workspace = true } | ||
tari_crypto = { workspace = true } | ||
tari_shutdown = { workspace = true } | ||
tari_engine_types = { workspace = true } | ||
minotari_node_grpc_client = { workspace = true } | ||
minotari_wallet_grpc_client = { workspace = true } | ||
tari_validator_node_client = { workspace = true } | ||
|
||
anyhow = { workspace = true } | ||
async-trait = { workspace = true } | ||
axum = { workspace = true, features = ["multipart"] } | ||
axum-jrpc = { workspace = true } | ||
clap = { workspace = true, features = ["derive"] } | ||
fern = { workspace = true, features = ["colored"] } | ||
futures = { workspace = true } | ||
humantime = { workspace = true } | ||
include_dir = { workspace = true } | ||
json5 = { workspace = true } | ||
lockfile = "0.4.0" | ||
log = { workspace = true } | ||
mime_guess = { workspace = true } | ||
reqwest = { workspace = true, features = ["json"] } | ||
serde = { workspace = true, features = ["derive"] } | ||
serde_json = { workspace = true } | ||
thiserror = { workspace = true } | ||
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "signal", "process", "time", "fs"] } | ||
toml = "0.8.12" | ||
tonic = { workspace = true } | ||
tower-http = { workspace = true, features = ["fs"] } | ||
url = { workspace = true } | ||
|
||
[target.'cfg(unix)'.dependencies] | ||
nix = { version = "0.28.0", default-features = false, features = ["signal"] } | ||
|
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,56 @@ | ||
// Copyright 2024 The Tari Project | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
use std::{env, fs, process::Command}; | ||
|
||
fn exit_on_ci() { | ||
if option_env!("CI").is_some() { | ||
std::process::exit(1); | ||
} | ||
} | ||
|
||
const BUILD: &[(&str, &str)] = &[("./webui", "build")]; | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
println!("cargo:rerun-if-changed=./webui/src"); | ||
|
||
// Ensure that dist path exists | ||
fs::create_dir_all("./webui/dist")?; | ||
fs::File::create("./webui/dist/.gitkeep")?; | ||
|
||
if env::var("CARGO_FEATURE_TS").is_ok() { | ||
println!("cargo:warning=The web ui is not being compiled when we are generating typescript types/interfaces."); | ||
return Ok(()); | ||
} | ||
|
||
let npm = if cfg!(windows) { "npm.cmd" } else { "npm" }; | ||
|
||
for (target, build_cmd) in BUILD { | ||
if let Err(error) = Command::new(npm).arg("ci").current_dir(target).status() { | ||
println!("cargo:warning='npm ci' error : {:?}", error); | ||
exit_on_ci(); | ||
} | ||
match Command::new(npm).args(["run", build_cmd]).current_dir(target).output() { | ||
Ok(output) if !output.status.success() => { | ||
println!("cargo:warning='npm run build' exited with non-zero status code"); | ||
println!("cargo:warning=Output: {}", String::from_utf8_lossy(&output.stdout)); | ||
println!("cargo:warning=Error: {}", String::from_utf8_lossy(&output.stderr)); | ||
exit_on_ci(); | ||
break; | ||
}, | ||
Err(error) => { | ||
println!("cargo:warning='npm run build' error : {:?}", error); | ||
println!("cargo:warning=The web ui will not be included!"); | ||
exit_on_ci(); | ||
break; | ||
}, | ||
_ => {}, | ||
} | ||
} | ||
|
||
// Ensure that .gitkeep exists | ||
// This is a hack because the build removes .gitkeep | ||
fs::File::create("./webui/dist/.gitkeep")?; | ||
|
||
Ok(()) | ||
} |
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,48 @@ | ||
# Docker Build Notes | ||
|
||
Create a folder ```sources``` and build a docker image. | ||
|
||
```bash | ||
mkdir sources | ||
cd sources | ||
git clone https://github.com/tari-project/tari.git | ||
git clone https://github.com/tari-project/tari-dan.git | ||
git clone https://github.com/tari-project/tari-connector.git | ||
cp -v applications/tari_swarm/docker/cross-compile-aarch64.sh . | ||
docker build -f applications/tari_swarm/docker/tari_swarm.Dockerfile \ | ||
-t local/tari-swarm . | ||
``` | ||
|
||
# Targeted testing and cross platform builds | ||
|
||
```bash | ||
docker build -f tari_swarm/docker_rig/tari_swarm.Dockerfile \ | ||
-t local/tari-swarm-tari-dan --target=builder-tari-dan . | ||
``` | ||
|
||
or | ||
|
||
```bash | ||
docker buildx build -f tari_swarm/docker_rig/tari_swarm.Dockerfile \ | ||
-t local/tari-swarm-tari-dan-arm64 --target=builder-tari-dan \ | ||
--platform linux/arm64 . | ||
``` | ||
|
||
# Docker Testing Notes | ||
|
||
Launching the docker image with local ports redirected to docker container ports 18000 to 19000 | ||
|
||
```bash | ||
docker run --rm -it -p 18000-19000:18000-19000 \ | ||
quay.io/tarilabs/tari-swarm | ||
``` | ||
|
||
Using the folder ```sources```, builds can be done with | ||
the docker image. | ||
|
||
```bash | ||
docker run --rm -it -p 18000-19000:18000-19000 \ | ||
-v $PWD/sources/:/home/tari/sources-build \ | ||
quay.io/tarilabs/tari-swarm:development_20230704_790dbea \ | ||
/bin/bash | ||
``` |
29 changes: 29 additions & 0 deletions
29
applications/tari_swarm_daemon/docker/cross-compile-aarch64.sh
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,29 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Move all cross-compiling steps into a single script | ||
# Hardcoded ARM64 envs for cross-compiling on x86_64 | ||
# | ||
|
||
set -e | ||
|
||
export BUILD_TARGET="aarch64-unknown-linux-gnu/" | ||
export RUST_TARGET="--target=aarch64-unknown-linux-gnu" | ||
#export ARCH=${ARCH:-generic} | ||
export ARCH=generic | ||
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc | ||
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc | ||
export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ | ||
export BINDGEN_EXTRA_CLANG_ARGS="--sysroot /usr/aarch64-linux-gnu/include/" | ||
export RUSTFLAGS="-C target_cpu=$ARCH" | ||
export ROARING_ARCH=$ARCH | ||
rustup target add aarch64-unknown-linux-gnu | ||
rustup toolchain install stable-aarch64-unknown-linux-gnu --force-non-host | ||
|
||
# Check for Debian | ||
if [ -f "/etc/debian_version" ] ; then | ||
dpkg --add-architecture arm64 | ||
apt-get update | ||
apt-get install -y pkg-config libssl-dev:arm64 | ||
export AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu/openssl/ | ||
export PKG_CONFIG_ALLOW_CROSS=1 | ||
fi |
Oops, something went wrong.