Skip to content

Commit

Permalink
Merge pull request #65 from AvadoDServer/0.1.91
Browse files Browse the repository at this point in the history
0.1.91
  • Loading branch information
sponnet authored May 5, 2024
2 parents 59f24e5 + 8ba071f commit 4ceb26c
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 111 deletions.
46 changes: 3 additions & 43 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,10 @@ ARG VERSION
WORKDIR /
RUN wget https://github.com/ava-labs/avalanchego/releases/download/$VERSION/avalanchego-linux-amd64-$VERSION.tar.gz
RUN tar zxvf avalanchego-linux-amd64-$VERSION.tar.gz
#RUN ls -l
RUN mkdir -p /app
RUN mv avalanchego-$VERSION/* /app
RUN echo "contents of /app in builder"
#RUN ls -l /app

# FROM --platform=linux/amd64 node:16-buster as build-deps-wallet

# RUN apt-get update && apt-get install -y openssl

# # Download initial SSL certs
# RUN mkdir -p /etc/nginx/certs/
# RUN wget -O /etc/nginx/certs/my.ava.do.crt http://iso.ava.do/my.ava.do.crt
# RUN wget -O /etc/nginx/certs/my.ava.do.key http://iso.ava.do/my.ava.do.key

# # build wallet UI
# WORKDIR /usr/src/app/wallet
# RUN npm -v
# RUN git clone https://github.com/ava-labs/avalanche-wallet.git
# RUN cd avalanche-wallet
# WORKDIR /usr/src/app/wallet/avalanche-wallet
# RUN yarn install

# # Patch the endpoint to that it connects to AVADO by default
# COPY files/wallet.patch .
# RUN git apply wallet.patch

# RUN cat src/store/modules/network/network.ts

# RUN yarn build

FROM --platform=linux/amd64 node:18 as build-deps

# RUN apt-get update && apt-get install -y openssl

# Download initial SSL certs
RUN mkdir -p /etc/nginx/certs/
RUN wget -O /etc/nginx/certs/my.ava.do.crt http://iso.ava.do/my.ava.do.crt
RUN wget -O /etc/nginx/certs/my.ava.do.key http://iso.ava.do/my.ava.do.key

# build wizard
WORKDIR /usr/src/app/wizard
COPY wizard .
Expand All @@ -55,22 +19,18 @@ FROM --platform=linux/amd64 golang:1.22.2-bookworm

USER root

# copy avalanche executable
COPY --from=builder /app /usr/local/app
# COPY --from=build-deps-wallet /usr/src/app/wallet/avalanche-wallet/dist /usr/local/wallet
COPY --from=build-deps /usr/src/app/wizard/build /usr/local/wizard

RUN chmod +x /usr/local/app/avalanchego

COPY --from=build-deps /usr/src/app/wizard/build /usr/local/wizard

RUN apt-get update
RUN apt-get install -y supervisor nginx
RUN apt-get clean

COPY files/supervisord.conf /etc/supervisord/
COPY files/dlcerts.sh /bin/dlcerts
RUN chmod +x /bin/dlcerts
COPY files/nginx.conf /etc/nginx/
RUN mkdir -p /etc/nginx/certs/
COPY --from=build-deps /etc/nginx/certs/* /etc/nginx/certs/

# copy config files
COPY files/config /config
Expand Down
14 changes: 3 additions & 11 deletions build/files/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,17 @@ supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock

[program:dlcert]
command=/bin/dlcerts
autostart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:nginx]
command=nginx -c /etc/nginx/nginx.conf -g "daemon off;"
autostart=false
autostart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

[program:main]
command=/usr/local/app/avalanchego --network-peer-list-num-validator-ips=10 --http-host=0.0.0.0 --http-tls-enabled=true --http-tls-cert-file=/etc/nginx/certs/my.ava.do.crt --http-tls-key-file=/etc/nginx/certs/my.ava.do.key --public-ip-resolution-service=opendns --chain-config-dir=/config --http-allowed-hosts="*"
autostart=false
command=/usr/local/app/avalanchego --network-peer-list-num-validator-ips=10 --http-host=0.0.0.0 --public-ip-resolution-service=opendns --chain-config-dir=/config --http-allowed-hosts="*"
autostart=true
autorestart=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
Expand Down
53 changes: 0 additions & 53 deletions build/files/wallet.patch

This file was deleted.

8 changes: 8 additions & 0 deletions build/wizard/src/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import "./css/style.sass";
import NodeID from "./NodeID.tsx"
// import NodeHealth from "./NodeHealth.tsx"
import NodeBootstrapped from "./NodeBootstrapped.tsx"
function App() {
return (
<div className="App">
<header className="App-header">
<section className="is-medium has-text-white">
<h3 className="is-size-3 has-text-white">Node info</h3>
<NodeID />
{/* <NodeHealth /> */}
<h3 className="is-size-3 has-text-white">Node status</h3>
<NodeBootstrapped chain="X"/>
<NodeBootstrapped chain="P"/>
<NodeBootstrapped chain="C"/>
</section>
</header>
</div>
);
Expand Down
61 changes: 61 additions & 0 deletions build/wizard/src/NodeBootstrapped.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { useEffect, useState } from 'react';

function IsBootStrapped({ chain }: { chain: string }) {
const [isBootStrapped, setIsBootStrapped] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);

useEffect(() => {
// Function to fetch network info
const fetchBootstrapped = async () => {
setIsLoading(true);
try {
const response = await fetch('https://avalanchego.my.ava.do:9650/ext/info', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'info.isBootstrapped',
"params": {
"chain": chain
}
}),
});

if (!response.ok) {
throw new Error('Network response was not ok');
}

const data = await response.json();
if (data.error){
throw new Error(data.error.message);
}

setIsBootStrapped(data?.result?.isBootStrapped === true);

} catch (error) {
console.error('Error fetching bootstrap info:', error);
setError(error.message);
} finally {
setIsLoading(false);
}
};

fetchBootstrapped();
}, [chain]); // Empty dependency array means this effect runs once on mount


if (isLoading) return <div>{chain}-chain: Loading...</div>;
if (error) return <div>{chain}-chain: Error: {error}</div>;

return (
<div>
<p>{chain}-chain: {isBootStrapped ? "ready" : "not ready yet"}</p>
</div>
);
}

export default IsBootStrapped;
1 change: 0 additions & 1 deletion build/wizard/src/NodeID.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function NetworkID() {


<>
<h3 className="is-size-3 has-text-white">Node status</h3>

<section className="is-medium has-text-white">

Expand Down
2 changes: 1 addition & 1 deletion dappnode_package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "avalanchego.avado.dnp.dappnode.eth",
"version": "0.1.90",
"version": "0.1.91",
"upstream": "v1.11.3",
"title": "Avalanche node",
"description": "This is the Avalanche Mainnet node. Avalanche is an open-source platform for launching highly decentralized applications, new financial primitives, and new interoperable blockchains.",
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: '3.4'
services:
avalanchego.avado.dnp.dappnode.eth:
image: 'avalanchego.avado.dnp.dappnode.eth:0.1.90'
image: 'avalanchego.avado.dnp.dappnode.eth:0.1.91'
build:
context: ./build
args:
- VERSION=v1.11.3
- VERSION=v1.11.5
environment:
- EXTRA_OPTS=--dynamic-public-ip=opendns
volumes:
Expand Down

0 comments on commit 4ceb26c

Please sign in to comment.