Skip to content
Snippets Groups Projects
Commit e137c729 authored by GreyKoda's avatar GreyKoda
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
## Nodo y API BFA para Docker
### Docker
Para poder levantar los contenedores es necesario contar con [Docker instalado](https://docs.docker.com/engine/install/).
### Descripción
El presente repositorio levanta dos contenedores Docker:
- [nodo transaccional](https://gitlab.bfa.ar/blockchain/nucleo) (producción)
- [api (tsa2)](https://gitlab.bfa.ar/blockchain/tsa2)
El nodo crea una cuenta y esa cuenta es la que levanta la API.
### Implementación
Para poder levantar todo con docker-compose primero es necesario crear las imágenes:
**NODO**
````
docker build -t nodobfa nodo/
````
**API**
````
docker build -t apibfa api/
````
**Por último:**
````
docker-compose up -d
````
### Importante
Al levantar los contenedores el nodo empezará a sincronizar. La API quedará expuesta en el puerto 3000.
**Comandos útiles:**
````
docker exec nodobfa bfalog.sh
docker exec nodobfa localstate.pl
````
O cualquier otro comando documentado del [nodo](https://gitlab.bfa.ar/blockchain/nucleo)
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y software-properties-common cron wget curl locales npm git zip unzip
RUN locale-gen es_AR.UTF-8
RUN export LANG=es_AR.UTF-8
RUN git clone https://gitlab.bfa.ar/blockchain/tsa2.git
RUN cd tsa2/api && npm install -g truffle && npm install
RUN cd tsa2/api && npm run build
RUN sed -i "s/chainId: '99118822',/ /g" /tsa2/api/dist/StamperWrapper.js && sed -i 's/txPromise = await this.web3.eth.sendSignedTransaction/txPromise = this.web3.eth.sendSignedTransaction/g' /tsa2/api/dist/StamperWrapper.js
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 3000
ENV GETH_ACCOUNT_JSON="/nodo_data/account.json"
ENV GETH_ACCOUNT_PASSWORD=""
ENV GETH_HOST=http://nodobfa:8545
ENV CONTRACT_ABI_PATH="tsa2/api/abi.json"
ENV CONTRACT_ADDRESS=0x7e56220069CAaF8367EA42817EA9210296AeC7c6
CMD [ "node", "tsa2/api/dist/index.js" ]
version: "3"
services:
nodobfa:
container_name: nodobfa
image: nodobfa
tty: true
ports:
- "8545:8545"
- "8546:8546"
- "30303:30303/tcp"
- "30303:30303/udp"
- "30304:30304/udp"
environment:
- BFAHOME=/home/bfa/bfa
- PATH=${PATH}:/home/bfa/bfa/bin:/home/bfa/bin
volumes:
- nodo_data:/nodo_data/
apibfa:
container_name: apibfa
image: apibfa
tty: true
ports:
- "3000:3000"
volumes:
- nodo_data:/nodo_data/
links:
- nodobfa
volumes:
nodo_data:
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y software-properties-common cron wget curl locales npm git zip unzip net-tools nano
RUN locale-gen es_AR.UTF-8
RUN export LANG=es_AR.UTF-8
RUN git clone https://gitlab.bfa.ar/blockchain/nucleo.git /bfa
RUN mkdir -p /nodo_data/
RUN /bfa/bin/installbfa.sh
RUN chown bfa:bfa -R /nodo_data/
RUN sed -i 's/--rpccorsdomain \\\*/--rpccorsdomain \\\* \\\n --rpcaddr 0.0.0.0\t\\\n --rpcport 8545/g' /home/bfa/bfa/bin/start.sh
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
USER bfa
RUN export BFAHOME=/home/bfa/bfa && PATH=${PATH}:/home/bfa/bfa/bin:/home/bfa/bin && admin.sh account
RUN cp /home/bfa/bfa/network/node/keystore/UTC* /nodo_data/account.json
VOLUME /nodo_data/
EXPOSE 8545 8546 30303
ENTRYPOINT ["/bin/sh", "-c" , "/home/bfa/bfa/bin/start.sh && tail -F /dev/null"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment