Skip to content

Commit

Permalink
Final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dastansam committed Mar 22, 2024
1 parent 4145089 commit d1a12b5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 deletions.
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
target
**/target
target/*
target
!./target/release/iso8583-chain
16 changes: 6 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,17 @@ WORKDIR /app
COPY . .

# Build the substrate node
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo build --release --locked --features docker
RUN cargo build --release --locked --features docker

# Use a smaller base image for the final image
FROM debian:bullseye-slim

# Install necessary dependencies
RUN apt-get update && apt-get install -y \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
libssl1.1 \
ca-certificates \
curl
RUN apt-get update && \
apt-get install -y libssl-dev libssl1.1 ca-certificates && \
update-ca-certificates --fresh && \
rm -rf /var/lib/apt/lists/*

# Copy the built substrate node binary from the builder stage
COPY --from=builder /app/target/release/iso8583-chain /usr/local/bin/

Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ cargo build --release
./target/release/iso8583-chain --dev --tmp -loffchain-worker
```

Docker:

```bash
# Ready to use docker image
docker run -it -p 9944:9944 kingleard/iso8583-chain --dev --tmp --unsafe-rpc-external --rpc-cors=all --rpc-methods=unsafe -loffchain-worker

# Build docker image
docker build -t iso8583-chain .

# Run docker image
docker run -it -p 9944:9944 iso8583-chain --dev --tmp --unsafe-rpc-external --rpc-cors=all --rpc-methods=unsafe -loffchain-worker
```

### Offchain Worker

First and foremost, insert the offchain worker key by running this command:
Expand Down Expand Up @@ -55,10 +68,4 @@ cargo tarpaulin --workspace --all-features

This is the high-level overview of components and how they interact:

![iso-8583-overview](https://github.com/subclone/payment-processor/assets/88332432/01c97bed-2ec8-4041-9702-cf079477e9be)

```rs
cargo build -r

./target/release/iso8583-chain --dev --tmp
```
![iso-8583-overview](https://github.com/subclone/payment-processor/assets/88332432/939a8e5c-0b2e-4735-b0f4-003726008248)
2 changes: 1 addition & 1 deletion node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fn testnet_genesis(
.expect("valid account; qed"),
],
#[cfg(feature = "docker")]
payment_processor_url: b"http://host.docker.internal:3001".to_vec(),
payment_processor_url: b"http://server:3001".to_vec(),
#[cfg(not(feature = "docker"))]
payment_processor_url: b"http://localhost:3001".to_vec(),
},
Expand Down
13 changes: 13 additions & 0 deletions pallets/iso-8583/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,19 @@ pub mod pallet {

Ok(())
}

/// Set payment processor url
///
/// This function is used to set the payment processor url.
#[pallet::weight(T::DbWeight::get().writes(1))]
#[pallet::call_index(9)]
pub fn set_payment_processor_url(origin: OriginFor<T>, url: StorageKey) -> DispatchResult {
ensure_root(origin)?;

PaymentProcessorUrl::<T>::put(url);

Ok(())
}
}

#[pallet::hooks]
Expand Down

0 comments on commit d1a12b5

Please sign in to comment.