Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update launchpad backend #4017

Merged
merged 11 commits into from
May 4, 2022
9 changes: 7 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,13 @@ workflows:
- run-integration-tests:
filters:
branches:
ignore: gh-pages
ignore:
gh-pages
launchpad_such_wow # TODO: Remove this filter once the branch is merged into development
- run-ffi-integration-tests:
filters:
branches:
ignore: gh-pages
ignore:
gh-pages
launchpad_such_wow # TODO: Remove this filter once the branch is merged into development

2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
- main
- ci-*
pull_request:
branches-ignore:
- 'launchpad_such_wow' # TODO: Remove this filter once the branch is merged into development
types:
- opened
- reopened
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/rfc_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
- development
pull_request:
types: [opened]
branches-ignore:
- 'launchpad_such_wow' # TODO: Remove this filter once the branch is merged into development

name: Test RFC Docs

Expand Down
76 changes: 41 additions & 35 deletions applications/launchpad/backend/assets/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Config for launchpad v0.0.2
[common]
# Config for launchpad v1.0.0
[base_node]
network = "dibbler"
grpc_address = "/ip4/0.0.0.0/tcp/18142"
override_from = "dibbler"

[base_node.storage]
track_reorgs = true

[dibbler.base_node]
identity_file = "/var/tari/base_node/config/dibbler/tari_base_node_id.json"

[igor.base_node]
network = "igor"
base_node_identity_file = "/var/tari/base_node/config/igor/base_node_id.json"

[base_node.p2p]
auxiliary_tcp_listener_address = "/dns4/base_node/tcp/18189"

[base_node.p2p.transport]
type = "tor"

[base_node.p2p.transport.tor]
control_auth = "password=tari"
socks_address_override = "/dns4/tor/tcp/9050"
control_address = "/dns4/tor/tcp/9051"

[base_node.p2p.transport.tcp]
listener_address = "/dns4/base_node/tcp/18189"

[dibbler.p2p.seeds]
dns_seeds = ["seeds.dibbler.tari.com"]
Expand All @@ -24,58 +51,39 @@ peer_seeds = [
"544ed2baed414307e119d12894e27f9ddbdfa2fd5b6528dc843f27903e951c30::/ip4/13.40.189.176/tcp/18189"
]

[base_node]
network = "dibbler"
grpc_address = "/ip4/0.0.0.0/tcp/18142"

[base_node.storage]
track_reorgs = true

[dibbler.base_node]
identity_file = "/var/tari/base_node/config/dibbler/tari_base_node_id.json"

[igor.base_node]
network = "igor"
base_node_identity_file = "/var/tari/base_node/config/igor/base_node_id.json"

[base_node.p2p.transport]
tor.control_auth = "password=tari"
#tcp.listener_address = "/dns4/base_node/tcp/18189"
tor.socks_address_override = "/dns4/tor/tcp/9050"
tor.control_address = "/dns4/tor/tcp/9051"


[wallet]
override_from = "dibbler"
db_file = "wallet/wallet.dat"
grpc_address = "/ip4/0.0.0.0/tcp/18143"
password = "tari"
use_libtor = false

[wallet.p2p]

[wallet.p2p.transport]
type = "tor"
tor.control_auth = "password=tari"
tor.control_address = "/dns4/tor/tcp/9051"
tor.socks_address_override = "/dns4/tor/tcp/9050"

[wallet.p2p.transport.tor]
control_auth = "password=tari"
socks_address_override = "/dns4/tor/tcp/9050"
control_address = "/dns4/tor/tcp/9051"

[wallet.p2p.transport.tcp]
listener_address = "/dns4/wallet/tcp/18188"

[dibbler.wallet]
network = "dibbler"
#use_libtor = false
#tor_onion_port = 18141

[igor.wallet]
network = "igor"
#use_libtor = false
#tor_onion_port = 18141

[miner]
base_node_grpc_address = "/dns4/base_node/tcp/18142"
wallet_grpc_address = "/dns4/wallet/tcp/18143"
base_node_addr = "/dns4/base_node/tcp/18142"
wallet_addr = "/dns4/wallet/tcp/18143"
mine_on_tip_only = true
num_mining_threads = 1

[merge_mining_proxy]
#config = "dibbler"
monerod_url = [ # stagenet
"http://stagenet.xmr-tw.org:38081",
"http://stagenet.community.xmr.to:38081",
Expand All @@ -90,5 +98,3 @@ submit_to_origin = true
monerod_username = ""
monerod_password = ""
monerod_use_auth = false


123 changes: 39 additions & 84 deletions applications/launchpad/backend/src/docker/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ use crate::docker::{models::ImageType, TariNetwork};
pub const DEFAULT_MINING_ADDRESS: &str =
"5AJ8FwQge4UjT9Gbj4zn7yYcnpVQzzkqr636pKto59jQcu85CFsuYVeFgbhUdRpiPjUCkA4sQtWApUzCyTMmSigFG2hDo48";

pub const DEFAULT_MONEROD_URL: &str = "http://monero-stagenet.exan.tech:38081";
pub const DEFAULT_MONEROD_URL: &str = "http://stagenet.xmr-tw.org:38081,\
http://stagenet.community.xmr.to:38081,\
http://monero-stagenet.exan.tech:38081,\
http://xmr-lux.boldsuck.org:38081,\
http://singapore.node.xmr.pm:38081";

#[derive(Default, Debug, Serialize, Deserialize)]
pub struct BaseNodeConfig {
Expand Down Expand Up @@ -275,11 +279,11 @@ impl LaunchpadConfig {
/// Return the command line arguments we want for the given container execution.
pub fn command(&self, image_type: ImageType) -> Vec<String> {
match image_type {
ImageType::BaseNode => vec!["--non-interactive-mode".to_string()],
ImageType::Wallet => vec!["--non-interactive-mode".to_string()],
ImageType::BaseNode => self.base_node_cmd(),
ImageType::Wallet => self.wallet_cmd(),
ImageType::XmRig => self.xmrig_cmd(),
ImageType::Sha3Miner => vec![],
ImageType::MmProxy => vec![],
ImageType::Sha3Miner => self.miner_cmd(),
ImageType::MmProxy => self.mm_proxy_cmd(),
ImageType::Tor => self.tor_cmd(),
ImageType::Monerod => self.monerod_cmd(),
ImageType::Frontail => self.frontail_cmd(),
Expand Down Expand Up @@ -313,6 +317,26 @@ impl LaunchpadConfig {
args.into_iter().map(String::from).collect()
}

fn base_node_cmd(&self) -> Vec<String> {
let args = vec!["--non-interactive-mode", "--log-config=/var/tari/config/log4rs.yml"];
args.into_iter().map(String::from).collect()
}

fn wallet_cmd(&self) -> Vec<String> {
let args = vec!["--non-interactive-mode", "--log-config=/var/tari/config/log4rs.yml"];
args.into_iter().map(String::from).collect()
}

fn miner_cmd(&self) -> Vec<String> {
let args = vec!["--log-config=/var/tari/config/log4rs.yml"];
args.into_iter().map(String::from).collect()
}

fn mm_proxy_cmd(&self) -> Vec<String> {
let args = vec!["--log-config=/var/tari/config/log4rs.yml"];
args.into_iter().map(String::from).collect()
}

fn xmrig_cmd(&self) -> Vec<String> {
let args = vec![
"--url=mm_proxy:18081",
Expand Down Expand Up @@ -387,26 +411,10 @@ impl LaunchpadConfig {
}

fn base_node_tor_config(&self, env: &mut Vec<String>) {
env.append(&mut vec![
format!("TARI_BASE_NODE__{}__TRANSPORT=tor", self.tari_network.upper_case()),
format!(
"TARI_BASE_NODE__{}__TOR_CONTROL_AUTH=password={}",
self.tari_network.upper_case(),
self.tor_control_password
),
format!(
"TARI_BASE_NODE__{}__TOR_FORWARD_ADDRESS=/dns4/base_node/tcp/18189",
self.tari_network.upper_case()
),
format!(
"TARI_BASE_NODE__{}__TOR_SOCKS_ADDRESS_OVERRIDE=/dns4/tor/tcp/9050",
self.tari_network.upper_case()
),
format!(
"TARI_BASE_NODE__{}__TOR_CONTROL_ADDRESS=/dns4/tor/tcp/9051",
self.tari_network.upper_case()
),
]);
env.append(&mut vec![format!(
"TARI_BASE_NODE__P2P__TRANSPORT__TOR__CONTROL_AUTH=password={}",
self.tor_control_password
)]);
}

/// Generate the vector of ENVAR strings for the docker environment
Expand All @@ -417,19 +425,9 @@ impl LaunchpadConfig {
env.append(&mut vec![
format!("WAIT_FOR_TOR={}", base_node.delay.as_secs()),
format!(
"TARI_COMMON__{}__DATA_DIR=/blockchain/{}",
self.tari_network.upper_case(),
"TARI_BASE_NODE__DATA_DIR=/blockchain/{}",
self.tari_network.lower_case()
),
format!(
"TARI_BASE_NODE__{}__TCP_LISTENER_ADDRESS=/dns4/base_node/tcp/18189",
self.tari_network.upper_case()
),
format!("TARI_BASE_NODE__{}__GRPC_ENABLED=1", self.tari_network.upper_case()),
format!(
"TARI_BASE_NODE__{}__GRPC_BASE_NODE_ADDRESS=0.0.0.0:18142",
self.tari_network.upper_case()
),
"APP_NAME=base_node".to_string(),
]);
}
Expand All @@ -446,28 +444,10 @@ impl LaunchpadConfig {
"SHELL=/bin/bash".to_string(),
"TERM=linux".to_string(),
format!("TARI_WALLET_PASSWORD={}", config.password),
format!("TARI_WALLET__{}__TRANSPORT=tor", self.tari_network.upper_case()),
format!(
"TARI_WALLET__{}__TOR_CONTROL_AUTH=password={}",
self.tari_network.upper_case(),
"TARI_WALLET__P2P__TRANSPORT__TOR__CONTROL_AUTH=password={}",
self.tor_control_password
),
format!(
"TARI_WALLET__{}__TOR_CONTROL_ADDRESS=/dns4/tor/tcp/9051",
self.tari_network.upper_case()
),
format!(
"TARI_WALLET__{}__TOR_SOCKS_ADDRESS_OVERRIDE=/dns4/tor/tcp/9050",
self.tari_network.upper_case()
),
format!(
"TARI_WALLET__{}__TOR_FORWARD_ADDRESS=/dns4/wallet/tcp/18188",
self.tari_network.upper_case()
),
format!(
"TARI_WALLET__{}__TCP_LISTENER_ADDRESS=/dns4/wallet/tcp/18188",
self.tari_network.upper_case()
),
]);
}
env
Expand Down Expand Up @@ -521,35 +501,10 @@ impl LaunchpadConfig {
format!("WAIT_FOR_TOR={}", config.delay.as_secs() + 6),
"APP_NAME=mm_proxy".to_string(),
"APP_EXEC=tari_merge_mining_proxy".to_string(),
format!(
"TARI_BASE_NODE__{}__GRPC_BASE_NODE_ADDRESS=/dns4/base_node/tcp/18142",
self.tari_network.upper_case()
),
"TARI_WALLET__GRPC_ADDRESS=/dns4/wallet/tcp/18143".to_string(),
format!(
"TARI_MERGE_MINING_PROXY__{}__MONEROD_URL={}",
self.tari_network.upper_case(),
config.monerod_url
),
format!(
"TARI_MERGE_MINING_PROXY__{}__MONEROD_USERNAME={}",
self.tari_network.upper_case(),
config.monero_username
),
format!(
"TARI_MERGE_MINING_PROXY__{}__MONEROD_PASSWORD={}",
self.tari_network.upper_case(),
config.monero_password
),
format!(
"TARI_MERGE_MINING_PROXY__{}__MONEROD_USE_AUTH={}",
self.tari_network.upper_case(),
config.monero_use_auth()
),
format!(
"TARI_MERGE_MINING_PROXY__{}__PROXY_HOST_ADDRESS=0.0.0.0:18081",
self.tari_network.upper_case()
),
format!("TARI_MERGE_MINING_PROXY__MONEROD_URL={}", config.monerod_url),
format!("TARI_MERGE_MINING_PROXY__MONEROD_USERNAME={}", config.monero_username),
format!("TARI_MERGE_MINING_PROXY__MONEROD_PASSWORD={}", config.monero_password),
format!("TARI_MERGE_MINING_PROXY__MONEROD_USE_AUTH={}", config.monero_use_auth()),
]);
}
env
Expand Down
14 changes: 13 additions & 1 deletion applications/launchpad/backend/src/docker/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,22 @@ impl TariWorkspace {
/// It also lets power users customise which version of docker images they want to run in the workspace.
pub fn fully_qualified_image(image: ImageType, registry: Option<&str>, tag: Option<&str>) -> String {
let reg = registry.unwrap_or(DEFAULT_REGISTRY);
let tag = tag.unwrap_or(DEFAULT_TAG);
let tag = Self::arch_specific_tag(tag);
format!("{}/{}:{}", reg, image.image_name(), tag)
}

/// Returns an architecture-specific tag based on the current CPU and the given label. e.g.
/// `arch_specific_tag(Some("v1.0"))` returns `"v1.0-arm64"` on M1 chips, and `v1.0-amd64` on Intel and AMD chips.
pub fn arch_specific_tag(label: Option<&str>) -> String {
let label = label.unwrap_or(DEFAULT_TAG);
let platform = match std::env::consts::ARCH {
"x86_64" => "amd64",
"aarch64" => "arm64",
_ => "unsupported",
};
format!("{}-{}", label, platform)
}

/// Starts the Tari workspace recipe.
///
/// This is an MVP / PoC version that starts everything in one go, but TODO, should really take some sort of recipe
Expand Down
4 changes: 1 addition & 3 deletions applications/launchpad/backend/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@
"shortDescription": "",
"longDescription": "",
"deb": {
"depends": [],
"useBootstrapper": false
"depends": []
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
"entitlements": null
Expand Down
19 changes: 10 additions & 9 deletions applications/launchpad/build_images.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash
source versions.txt
platform=${BUILD_PLATFORM:-amd64}

build_image() {
echo "Building $1 image v$VERSION.."
docker build -f docker_rig/$1 --build-arg ARCH=native --build-arg FEATURES=avx2 --build-arg VERSION=$VERSION $3 $4 -t quay.io/tarilabs/$2:latest ./../..
docker tag quay.io/tarilabs/$2:latest quay.io/tarilabs/$2:$VERSION
docker push quay.io/tarilabs/$2:latest
docker build -f docker_rig/$1 --build-arg ARCH=native --build-arg FEATURES=avx2 --build-arg VERSION=$VERSION $3 $4 -t quay.io/tarilabs/$2:latest-$platform ./../..
docker tag quay.io/tarilabs/$2:latest-$platform quay.io/tarilabs/$2:$VERSION-$platform
docker push quay.io/tarilabs/$2:latest-$platform
docker push quay.io/tarilabs/$2:$VERSION
}

Expand All @@ -17,12 +18,12 @@ build_image tor.Dockerfile tor
build_image monerod.Dockerfile monerod

echo "Building XMRig image v$VERSION (XMRig v$XMRIG_VERSION)"
docker build -f docker_rig/xmrig.Dockerfile --build-arg VERSION=$VERSION --build-arg XMRIG_VERSION=$XMRIG_VERSION -t quay.io/tarilabs/xmrig:latest ./../..
docker tag quay.io/tarilabs/xmrig:latest quay.io/tarilabs/xmrig:$VERSION
docker push quay.io/tarilabs/xmrig:latest
docker build -f docker_rig/xmrig.Dockerfile --build-arg VERSION=$VERSION --build-arg XMRIG_VERSION=$XMRIG_VERSION -t quay.io/tarilabs/xmrig:latest-$platform ./../..
docker tag quay.io/tarilabs/xmrig:latest-$platform quay.io/tarilabs/xmrig:$VERSION-$platform
docker push quay.io/tarilabs/xmrig:latest-$platform
docker push quay.io/tarilabs/xmrig:$VERSION

docker build -f docker_rig/frontail.Dockerfile -t quay.io/tarilabs/frontail ./docker_rig
docker tag quay.io/tarilabs/frontail:latest quay.io/tarilabs/frontail:$VERSION
docker push quay.io/tarilabs/frontail:latest
docker build -f docker_rig/frontail.Dockerfile -t quay.io/tarilabs/frontail:latest-$platform ./docker_rig
docker tag quay.io/tarilabs/frontail:latest-$platform quay.io/tarilabs/frontail:$VERSION-$platform
docker push quay.io/tarilabs/frontail:latest-$platform
docker push quay.io/tarilabs/frontail:$VERSION
Loading