-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connector-go-ethereum): add the docker environment
Signed-off-by: Takuma TAKEUCHI <takeuchi.takuma@fujitsu.com>
- Loading branch information
Showing
12 changed files
with
394 additions
and
230 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
packages/cactus-plugin-ledger-connector-go-ethereum-socketio/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FROM hyperledger/fabric-tools:1.4 | ||
|
||
RUN apt-get update && apt-get upgrade -y && apt-get install -y software-properties-common gnupg | ||
#RUN gnupg1 gnupg2 | ||
|
||
RUN apt-get install -y \ | ||
apt-utils \ | ||
apt-transport-https \ | ||
software-properties-common \ | ||
wget \ | ||
curl \ | ||
telnet \ | ||
sudo \ | ||
build-essential \ | ||
libffi-dev \ | ||
libssl-dev \ | ||
zlib1g-dev \ | ||
liblzma-dev \ | ||
libbz2-dev \ | ||
libreadline-dev \ | ||
libsqlite3-dev \ | ||
git \ | ||
gnupg | ||
|
||
# install python 3.9.5 | ||
#RUN apt-get install -y python3 python3-pip | ||
#RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv | ||
#RUN echo 'export PATH="$HOME"/.pyenv/bin:$PATH' >> ~/.rc | ||
#RUN . ~/.rc && pyenv install 3.9.5 | ||
#RUN echo 'eval "$(pyenv init -)"' >> ~/.rc | ||
#RUN echo 'eval "$(pyenv init --path)"' >> ~/.rc | ||
#RUN cat ~/.rc >> ~/.bashrc | ||
#RUN . ~/.rc && pyenv global 3.9.5 | ||
|
||
RUN apt-get install -y nodejs npm | ||
RUN npm install n -g | ||
RUN n 12 | ||
RUN apt purge -y nodejs npm | ||
|
||
CMD [ "tail", "-f", "/dev/null" ] | ||
|
||
COPY ./dist /root/cactus/dist/ | ||
COPY ./node_modules /root/cactus/node_modules/ | ||
COPY ./package.json /root/cactus/ |
77 changes: 77 additions & 0 deletions
77
packages/cactus-plugin-ledger-connector-go-ethereum-socketio/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!-- | ||
Copyright 2021 Hyperledger Cactus Contributors | ||
SPDX-License-Identifier: Apache-2.0 | ||
README.md | ||
--> | ||
# `@hyperledger/cactus-plugin-ledger-connector-go-ethereum-socketio` | ||
|
||
This plugin provides `Cactus` a way to interact with Go-Ethereum networks. Using this we can perform: | ||
- `sendSyncRequest`: Send sync-typed requests to the ledgers (e.g. getBalance) | ||
- `sendAsyncRequest`: Send async-typed requests to the ledgers (e.g. sendTransaction) | ||
- `startMonitor`: Start monitoring blocks on the ledgers | ||
- `stopMonitor`: Stop the block monitoring | ||
|
||
## Summary | ||
- [Getting started](#getting-started) | ||
- [Usage samples](#usage-samples) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
- [Acknowledgments](#acknowledgments) | ||
|
||
## Getting started | ||
|
||
### Required software components | ||
- OS: Linux (recommended Ubuntu20.04,18.04 or CentOS7) | ||
- Docker (recommend: v17.06.2-ce or greater) | ||
- Docker-compose (recommend: v1.14.0 or greater) | ||
- node.js v12 (recommend: v12.20.2 or greater) | ||
|
||
### Prerequisites | ||
- Please ensure that the destination ledger (default: [geth-testnet](../../tools/docker/geth-testnet)) is already launched | ||
- Available port: `5050` (for the port of `@hyperledger/cactus-plugin-ledger-connector-go-ethereum-socketio`) | ||
- if this port is already used, please change the setting on `docker-compose.yaml` | ||
|
||
### Boot methods | ||
|
||
#### 1. Build the modules | ||
- Install npm packages and build them | ||
``` | ||
cd cactus/packages/cactus-plugin-ledger-connector-go-ethereum-socketio | ||
npm install | ||
npm run build | ||
``` | ||
- Create symbolic link to node_modules | ||
- NOTE: This command is enough to execute only once. | ||
``` | ||
npm run init-ethereum | ||
``` | ||
|
||
#### 2. Create the docker image | ||
- Create the docker image | ||
``` | ||
docker-compose -f docker-compose.yaml build | ||
``` | ||
|
||
#### 3. Launch the container | ||
- Launce the container | ||
``` | ||
docker-compose -f docker-compose.yaml up | ||
``` | ||
|
||
## Usage samples | ||
- To confirm the operation of this package, please refer to the following business-logic sample applications: | ||
- [electricity-trade](../../examples/electricity-trade) | ||
- [car-trade](../../examples/cartrade) | ||
|
||
## Contributing | ||
|
||
We welcome contributions to Hyperledger Cactus in many forms, and there's always plenty to do! | ||
|
||
Please review [CONTIRBUTING.md](../../CONTRIBUTING.md) to get started. | ||
|
||
## License | ||
|
||
This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file. | ||
|
||
## Acknowledgments |
12 changes: 8 additions & 4 deletions
12
packages/cactus-plugin-ledger-connector-go-ethereum-socketio/copyStaticAssets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
/* | ||
* Copyright 2020-2021 Hyperledger Cactus Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* | ||
* copyStaticAssets.ts | ||
*/ | ||
import * as shell from 'shelljs'; | ||
shell.cp('-R', 'src/main/typescript/common/core/CA/', './dist/common/core'); | ||
shell.cp('-R', 'src/main/typescript/common/core/validatorKey/', './dist/common/core'); | ||
import * as shell from "shelljs"; | ||
shell.cp("-R", "src/main/typescript/common/core/CA/", "./dist/common/core"); | ||
shell.cp( | ||
"-R", | ||
"src/main/typescript/common/core/validatorKey/", | ||
"./dist/common/core" | ||
); |
9 changes: 6 additions & 3 deletions
9
packages/cactus-plugin-ledger-connector-go-ethereum-socketio/copyUtilityAssets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
/* | ||
* Copyright 2020-2021 Hyperledger Cactus Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* | ||
* copyUtilityAssets.ts | ||
*/ | ||
import * as shell from 'shelljs'; | ||
shell.cp('../cactus-cmd-socketio-server/src/main/typescript/verifier/ValidatorAuthentication.ts', './src/main/typescript/connector'); | ||
import * as shell from "shelljs"; | ||
shell.cp( | ||
"../cactus-cmd-socketio-server/src/main/typescript/verifier/ValidatorAuthentication.ts", | ||
"./src/main/typescript/connector" | ||
); |
37 changes: 37 additions & 0 deletions
37
packages/cactus-plugin-ledger-connector-go-ethereum-socketio/docker-compose.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
version: "3" | ||
services: | ||
hyperledger-cactus-plugin-ledger-connector-go-ethereum-socketio: | ||
container_name: hyperledger-cactus-plugin-ledger-connector-go-ethereum-socketio | ||
image: hyperledger-cactus-plugin-ledger-connector-go-ethereum-socketio | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile | ||
args: | ||
- HTTP_PROXY=$HTTP_PROXY | ||
- http_proxy=$HTTP_PROXY | ||
- HTTPS_PROXY=$HTTPS_PROXY | ||
- https_proxy=$HTTP_PROXY | ||
- FTP_PROXY=$HTTP_PROXY | ||
- ftp_proxy=$HTTP_PROXY | ||
- NO_PROXY=$NO_PROXY | ||
- no_proxy=$NO_PROXY | ||
ports: | ||
- "5050:5050" | ||
environment: | ||
- HTTP_PROXY=$HTTP_PROXY | ||
- http_proxy=$HTTP_PROXY | ||
- HTTPS_PROXY=$HTTPS_PROXY | ||
- https_proxy=$HTTP_PROXY | ||
- FTP_PROXY=$HTTP_PROXY | ||
- ftp_proxy=$HTTP_PROXY | ||
- NO_PROXY=$NO_PROXY | ||
- no_proxy=$NO_PROXY | ||
working_dir: /root/cactus/ | ||
entrypoint: "npm run start" | ||
#networks: | ||
# - geth1net | ||
|
||
networks: | ||
default: | ||
external: | ||
name: geth1net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.