Commit 0018058b authored by TonyFord's avatar TonyFord
Browse files

remove faircoind

parent 2f8acd99
Pipeline #956 canceled with stage
in 19 seconds
# except of the netname all parameters should be the same as in faircoin.conf
rpcconnect=127.0.0.1
rpcport=8333
rpcuser=faircoin
rpcpassword=NU5QsSmUGL-onUzeosSvpbb23mUiH8xS
port=40406
txindex=1
...@@ -10,25 +10,10 @@ build-jekyll: ...@@ -10,25 +10,10 @@ build-jekyll:
refs: refs:
- master - master
variables: variables:
- $CMD =~ /build-jekyll/ - $CMD =~ /build/
script: script:
- docker-compose build jekyll-server - docker-compose down
- docker-compose build
build-faircoind:
stage: build
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /build-faircoind/
before_script:
- mkdir -p ~/.faircoin2
- source ${FAIRCOIN_CONF}
- echo -e "rpcconnect=127.0.0.1\nrpcport=${rpcport}\nrpcuser=${rpcuser}\nrpcpassword=${rpcpassword}\nport=${port}\ntxindex=1" > ~/.faircoin2/faircoin.conf
script:
- docker-compose build faircoin
restart-jekyll: restart-jekyll:
stage: restart stage: restart
...@@ -38,20 +23,7 @@ restart-jekyll: ...@@ -38,20 +23,7 @@ restart-jekyll:
refs: refs:
- master - master
variables: variables:
- $CMD =~ /restart-jekyll/ - $CMD =~ /restart/
script:
- docker-compose stop jekyll-server
- docker-compose up jekyll-server
restart-faircoind:
stage: restart
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /restart-faircoind/
script: script:
- docker-compose stop faircoin - docker-compose stop
- docker-compose up faircoin - docker-compose up
# Pull base image.
FROM ubuntu:18.04@sha256:5f4bdc3467537cbbe563e80db2c3ec95d548a9145d64453b06939c4592d67b6d
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
#####################################################################################root##
### install base libraries and dependencies for faircoin daemon ###########################
RUN apt-get update -q && \
apt-get install -qy \
git \
make \
autotools-dev \
autoconf \
libtool \
libssl-dev \
libboost-all-dev \
libevent-dev \
libdb++-dev \
libdb-dev
#####################################################################################root##
### install nano commandline editor [optional] ( to edit faircoin.conf later if necessary )
RUN apt-get install -qy nano
#####################################################################################root##
### install python packages
RUN apt-get install -qy python3-pip
RUN python3 -m pip install python-bitcoinrpc
#####################################################################################root##
### system cleanup ########################################################################
RUN rm -rf /var/lib/apt/lists/* && \
apt-get autoremove -y && \
apt-get clean
#####################################################################################root##
### create and run user account to image ##################################################
ARG GITLAB_RUNNER_GID
ARG GITLAB_RUNNER_UID
RUN groupadd -g $GITLAB_RUNNER_GID faircoin
RUN useradd --create-home --shell /bin/bash faircoin --uid $GITLAB_RUNNER_UID --gid $GITLAB_RUNNER_GID
USER faircoin
#################################################################################faircoin##
### download and build faircoin daemon and cli ############################################
WORKDIR /home/faircoin
ARG source_repository
RUN git clone $source_repository /home/faircoin/faircoin
WORKDIR /home/faircoin/faircoin
RUN ./autogen.sh && \
./configure --disable-tests --disable-bench --with-incompatible-bdb --disable-wallet && \
make
#################################################################################faircoin##
### initialize blockchain with txindex=1 ##################################################
WORKDIR /home/faircoin/faircoin/src
RUN mv ./faircoind /home/faircoin/faircoind
RUN mv ./faircoin-cli /home/faircoin/faircoin-cli
WORKDIR /home/faircoin
RUN ./faircoind -daemon -reindex && \
sleep 60 && \
./faircoin-cli stop && \
sleep 10
ENTRYPOINT ["./faircoind"]
...@@ -27,25 +27,3 @@ services: ...@@ -27,25 +27,3 @@ services:
# - "4002:4020" # - "4002:4020"
# volumes: # volumes:
# - .:/srv/jekyll # - .:/srv/jekyll
faircoin:
build:
context: .
dockerfile: Dockerfile_faircoin
args:
source_repository: "https://github.com/faircoin/faircoin.git"
GITLAB_RUNNER_UID: "${GITLAB_RUNNER_UID}"
GITLAB_RUNNER_GID: "${GITLAB_RUNNER_GID}"
env_file:
- ${FAIRCOIN_CONF}
container_name: pulse.faircoin.co-faircoind
restart: always
# command: ' -blocknotify="python3 /home/faircoin/script/getdata.py"'
network_mode: "host"
user: "${GITLAB_RUNNER_UID}:${GITLAB_RUNNER_GID}"
volumes:
- ~/.faircoin2:/home/faircoin/.faircoin2
- ./_data/faircoin:/home/faircoin/data
- ./script:/home/faircoin/script
...@@ -5,13 +5,15 @@ import json ...@@ -5,13 +5,15 @@ import json
import os import os
# rpc_user and rpc_password are set in the bitcoin.conf file # rpc_user and rpc_password are set in the bitcoin.conf file
rpc_user='faircoin' rpc_user=os.environ['rpcuser']
rpc_password='NU5QsSmUGL-onUzeosSvpbb23mUiH8xS' rpc_password=os.environ['rpcpassword']
rpc_connect=os.environ['rpcconnect']
rpc_port=os.environ['rpcport']
rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8333"%(rpc_user, rpc_password)) rpc_connection = AuthServiceProxy("http://%s:%s@%s:%s"%(rpc_user, rpc_password, rpc_connect, rpc_port ))
# check datafiles blockcount # check datafiles blockcount
fn=os.environ['HOME'] + '/data/txs.info.json' fn='../data/txs.info.json'
if not os.path.isfile(fn): if not os.path.isfile(fn):
file = open(fn,'w') file = open(fn,'w')
file.write(json.dumps({ 'blockhash' : 'beed44fa5e96150d95d56ebd5d2625781825a9407a5215dd7eda723373a0a1d7', 'timestamp' : int( datetime.datetime.now().timestamp() ) })) file.write(json.dumps({ 'blockhash' : 'beed44fa5e96150d95d56ebd5d2625781825a9407a5215dd7eda723373a0a1d7', 'timestamp' : int( datetime.datetime.now().timestamp() ) }))
...@@ -31,7 +33,7 @@ block_hash=txs_info['blockhash'] ...@@ -31,7 +33,7 @@ block_hash=txs_info['blockhash']
last_blocks=txs_info['lastblocks'] last_blocks=txs_info['lastblocks']
# update time # update time
fn=os.environ['HOME'] + '/data/txs.info.json' fn='../data/txs.info.json'
file = open(fn,'w') file = open(fn,'w')
file.write(json.dumps({ 'blockhash' : block_hash, 'timestamp' : int( datetime.datetime.now().timestamp() ), 'lastblocks' : txs_info['lastblocks'] })) file.write(json.dumps({ 'blockhash' : block_hash, 'timestamp' : int( datetime.datetime.now().timestamp() ), 'lastblocks' : txs_info['lastblocks'] }))
file.close() file.close()
...@@ -39,8 +41,8 @@ file.close() ...@@ -39,8 +41,8 @@ file.close()
commands = [ [ "getblock", block_hash ] ] commands = [ [ "getblock", block_hash ] ]
block = rpc_connection.batch_(commands)[0] block = rpc_connection.batch_(commands)[0]
if not os.path.exists(os.environ['HOME'] + '/data/tx'): if not os.path.exists('../data/tx'):
os.makedirs(os.environ['HOME'] + '/data/tx') os.makedirs('../data/tx')
while 'nextblockhash' in block: while 'nextblockhash' in block:
block_hash=block['nextblockhash'] block_hash=block['nextblockhash']
...@@ -48,10 +50,10 @@ while 'nextblockhash' in block: ...@@ -48,10 +50,10 @@ while 'nextblockhash' in block:
block = rpc_connection.batch_(commands)[0] block = rpc_connection.batch_(commands)[0]
year = datetime.datetime.fromtimestamp(block['time']).isoformat()[0:4] year = datetime.datetime.fromtimestamp(block['time']).isoformat()[0:4]
if not os.path.exists(os.environ['HOME'] + '/data/tx/' + year ): if not os.path.exists('../data/tx/' + year ):
os.makedirs(os.environ['HOME'] + '/data/tx/' + year ) os.makedirs('../data/tx/' + year )
fn=os.environ['HOME'] + '/data/tx/' + year + '/' + datetime.datetime.fromtimestamp(block['time']).isoformat()[0:10]+'.yml' fn='../data/tx/' + year + '/' + datetime.datetime.fromtimestamp(block['time']).isoformat()[0:10]+'.yml'
file = open(fn,'a') file = open(fn,'a')
file.write( '- ' + str( len( block['tx'] ) ) + '\n' ); file.write( '- ' + str( len( block['tx'] ) ) + '\n' );
file.close() file.close()
...@@ -60,7 +62,7 @@ while 'nextblockhash' in block: ...@@ -60,7 +62,7 @@ while 'nextblockhash' in block:
if len( txs_info['lastblocks'] ) > 480: if len( txs_info['lastblocks'] ) > 480:
txs_info['lastblocks'].pop(0) txs_info['lastblocks'].pop(0)
fn=os.environ['HOME'] + '/data/txs.info.json' fn='../data/txs.info.json'
file = open(fn,'w') file = open(fn,'w')
file.write(json.dumps({ 'blockhash' : block_hash, 'timestamp' : int( datetime.datetime.now().timestamp() ), 'lastblocks' : txs_info['lastblocks'] })) file.write(json.dumps({ 'blockhash' : block_hash, 'timestamp' : int( datetime.datetime.now().timestamp() ), 'lastblocks' : txs_info['lastblocks'] }))
file.close() file.close()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment