diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..1586c84 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,32 @@ +name: Build and Deploy + +on: + workflow_dispatch: + release: + types: [published] + +permissions: + contents: write + +defaults: + run: + working-directory: bridge-frontend + + +jobs: + build-and-deploy: + concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v4 + + - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. + run: | + yarn + yarn build + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: build # The folder the action should deploy. diff --git a/Dockerfile b/Dockerfile index 4dc107f..dc3f3f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,9 +15,11 @@ apt install -y --no-install-recommends \ ca-certificates=20230311ubuntu0.22.04.1 \ g++-riscv64-linux-gnu=4:11.2.0--1ubuntu1 \ wget=1.21.2-2ubuntu1 \ - libclang-dev + libclang-dev \ + libssl-dev pkg-config EOF # libclang needed to build rocksdb. Can remove once this is no longer needed. +# libssl-dev and pkg-config needed to use reqwest RUN set -eux; \ dpkgArch="$(dpkg --print-architecture)"; \ diff --git a/fullnode.Dockerfile b/fullnode.Dockerfile index f08c164..722f323 100644 --- a/fullnode.Dockerfile +++ b/fullnode.Dockerfile @@ -14,8 +14,11 @@ apt install -y --no-install-recommends \ build-essential=12.9ubuntu3 \ ca-certificates=20230311ubuntu0.22.04.1 \ wget=1.21.2-2ubuntu1 \ - libclang-dev + libclang-dev \ + libssl-dev pkg-config EOF +# libclang needed to build rocksdb. Can remove once this is no longer needed. +# libssl-dev and pkg-config needed to use reqwest RUN set -eux; \ dpkgArch="$(dpkg --print-architecture)"; \ diff --git a/src/main.rs b/src/main.rs index 92f36f8..f40ef70 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,7 +85,7 @@ async fn main() -> Result<(), anyhow::Error> { .expect("Failed to start the rollup server"); #[cfg(feature = "listen-graphql")] - tower_cartesi::listen_graphql(&mut cartezcash_app, &server_addr, 10) + tower_cartesi::listen_graphql(&mut cartezcash_app, &server_addr, 10, std::time::Duration::from_secs(5)) .await .expect("Failed to start the rollup server"); diff --git a/tower-cartesi/Cargo.toml b/tower-cartesi/Cargo.toml index ee9b556..9fcc8b4 100644 --- a/tower-cartesi/Cargo.toml +++ b/tower-cartesi/Cargo.toml @@ -16,6 +16,7 @@ reqwest = { version = "0.12.3", features = ["json"] } serde = { version = "1.0.197", features = ["derive"] } serde_json = "1.0.115" thiserror = "1.0.58" +tokio = { version = "1.32", features = ["time"] } tower-service = "0.3.2" tracing = "0.1.40" diff --git a/tower-cartesi/src/lib.rs b/tower-cartesi/src/lib.rs index d8f84e4..2867ec5 100644 --- a/tower-cartesi/src/lib.rs +++ b/tower-cartesi/src/lib.rs @@ -1,5 +1,6 @@ use thiserror::Error; use tower_service::Service; +use tokio::time::interval; mod messages; mod request; @@ -74,14 +75,16 @@ pub async fn listen_graphql( service: &mut S, host_uri: &str, page_size: usize, + frequency: std::time::Duration, ) -> Result<(), Error> where S: Service, { - // let client = hyper::Client::new(); let client = reqwest::Client::new(); let mut cursor = None; + let mut interval = interval(frequency); + loop { let request_body = InputsQuery::build_query(inputs_query::Variables { first: page_size as i64, @@ -97,5 +100,6 @@ where .await .map_err(Error::ServiceError)?; } + interval.tick().await; } }