Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

Commit

Permalink
#92 Pump development guide
Browse files Browse the repository at this point in the history
  • Loading branch information
arturalbov committed May 24, 2018
1 parent 3f2ab71 commit 1d161c4
Showing 1 changed file with 58 additions and 6 deletions.
64 changes: 58 additions & 6 deletions docs/contributing/pump-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ class BitcoinPumpApplication {
fun main(args: Array<String>) {

val application = SpringApplication(BitcoinPumpApplication::class.java)
application.setRegisterShutdownHook(false)
val applicationContext = application.run(*args)

val pump = applicationContext.getBean(ChainPump::class.java)
pump.startPump()
application.runPump(args)
}
}
}
Expand Down Expand Up @@ -222,4 +218,60 @@ class BitcoinBlockchainInterface(
}
```

So, as you can see, you're not care of what happening with data next and how to store it. All you need is just to tell `BlockBundle` how to map it's fields on entities and we'll take care of everything else.
So, as you can see, you're not care of what happening with data next and how to store it. All you need is just to tell `BlockBundle` how to map it's fields on entities and we'll take care of everything else.

### Memory Pool Pump

You also could add memory pool pumping logic by simply implement `PoolInterface` interface

```kotlin
interface PoolInterface<T: PoolItem> {
fun subscribePool(): Flowable<T>
}
```

It contains only one method that should return `io.reactivex.Flowable` of pool items.

### Create Dockerfile
Put Docker file in root folder of your module. Here is template of Dockerfile:
```
# Build Stage
FROM openjdk:10-jdk-slim AS build
COPY ./ /build
WORKDIR /build
RUN ./gradlew clean :pumps:${your_chain_name}:assemble
# Container with application
FROM openjdk:10-jre-slim
COPY --from=build /build/pumps/${your_chain_name}/build/libs /cyberapp/bin
ENTRYPOINT exec java $JAVA_OPTS -jar /cyberapp/bin/${your_chain_name}.jar
```

### Update CI

Finally, you should update `.circleci/config.yml` file with steps for building and pushing docker image.
* Add deploy job to `jobs` section. Template:
```
deploy_chain_pumps_${your_chain_name}_image:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
version: 17.11.0-ce
- run:
name: Build ${your_chain_name} Pump Image
command: |
docker build -t build/pump-${your_chain_name} -f ./pumps/${your_chain_name}/Dockerfile ./
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker tag build/pump-${your_chain_name} cybernode/chain-pump-${your_chain_name}:$CIRCLE_TAG
docker push cybernode/chain-pump-${your_chain_name}:$CIRCLE_TAG
docker tag build/pump-${your_chain_name} cybernode/chain-pump-${your_chain_name}:latest
docker push cybernode/chain-pump-${your_chain_name}:latest
```
* Add deploy job to `workflows.search_build.jobs` section. Template:
```
- deploy_chain_pumps_${your_chain_name}_image:
<<: *release_filter
requires:
- build_project
```

0 comments on commit 1d161c4

Please sign in to comment.