Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • faircoin.co/faircoind
  • kaana.red/faircoind
2 results
Show changes
Commits on Source (77)
# config will set by gitlab runners env variables. This file is only for template purposes ( default settings ).
rpcconnect=127.0.0.1
rpcport=8332
rpcuser=faircoin
rpcpassword=NU5QsSmUGL-onUzeosSvpbb23mUiH8xS
port=40404
txindex=1
stages:
- restart
- build
- start
- stop
- uninstall
- remove
Build:
build-faircoind:
stage: build
tags:
- FairCoin.Co
......@@ -10,18 +14,72 @@ Build:
- master
variables:
- $CMD =~ /build/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- mkdir -p ~/.faircoin2
- chmod +x ./script/blocknotify.sh
script:
- docker-compose stop
- docker-compose down
- docker-compose build
Restart:
stage: restart
start-faircoind:
stage: start
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /build|start/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- chmod +x ./script/blocknotify.sh
script:
- docker-compose stop
- docker-compose down
- source ${FAIRCOIN_CONF}
- echo -e "rpcconnect=${rpcconnect}\nrpcport=${rpcport}\nrpcuser=${rpcuser}\nrpcpassword=${rpcpassword}\ntxindex=1" > ~/.faircoin2/faircoin.conf
- docker-compose up -d
stop-faircoind:
stage: stop
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /stop/
script:
- docker-compose stop
uninstall-faircoind:
stage: uninstall
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /uninstall/
script:
- docker-compose stop
- docker-compose down
remove-faircoind:
stage: remove
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /build|restart/
- $CMD =~ /remove/
script:
- docker-compose stop
- docker-compose down
- docker-compose up
after_script:
- rm -R ~/.faircoin2
......@@ -8,6 +8,9 @@ ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
RUN apt-get update -q && \
apt-get install -qy \
git \
make \
autotools-dev \
autoconf \
libtool \
libssl-dev \
libboost-all-dev \
......@@ -22,7 +25,8 @@ RUN apt-get install -qy nano
#####################################################################################root##
### install python packages
RUN apt-get install -qy python3-pip
RUN python3 -m pip install python-bitcoinrpc
RUN python3 -m pip install \
python-bitcoinrpc
#####################################################################################root##
### system cleanup ########################################################################
......@@ -32,21 +36,48 @@ RUN rm -rf /var/lib/apt/lists/* && \
#####################################################################################root##
### create and run user account to image ##################################################
RUN useradd --create-home --shell /bin/bash faircoin
ARG RUNNER_GID
ARG RUNNER_UID
RUN groupadd -g $RUNNER_GID faircoin
RUN useradd --create-home --shell /bin/bash faircoin --uid $RUNNER_UID --gid $RUNNER_GID
USER faircoin
#################################################################################faircoin##
### download and build faircoin daemon and cli ############################################
WORKDIR /home/faircoin
COPY ./faircoind ./faircoind
COPY ./faircoin-cli ./faircoin-cli
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
RUN ./faircoind -daemon -reindex && \
sleep 60 && \
./faircoin-cli stop && \
sleep 10
WORKDIR /home/faircoin/faircoin/src
RUN mv ./faircoind /home/faircoin/faircoind
RUN mv ./faircoin-cli /home/faircoin/faircoin-cli
USER root
###########################################################################################
### install dependencies for explorer.faircoin.co ###################################root##
RUN python3 -m pip install \
simplejson \
requests \
interruptingcow \
PyMySQL
RUN mkdir -p /home/faircoin/pulse.faircoin.co
RUN chown -R faircoin:faircoin /home/faircoin/pulse.faircoin.co
RUN mkdir -p /home/faircoin/.faircoin2
RUN chown -R faircoin:faircoin /home/faircoin/.faircoin2
RUN mkdir -p /home/faircoin/explorer.faircoin.co
RUN chown -R faircoin:faircoin /home/faircoin/explorer.faircoin.co
USER faircoin
WORKDIR /home/faircoin
ENTRYPOINT ["./faircoind"]
# faircoind
# FairCoin.Co faircoind
FairCoin daemon connected to FairCoin.Co services.
The service is made for/controlled by gitlab runner.
## Usage
Go Gitlab **CI/CD** -> **Pipeline** and **Run Pipeline**
Enter variable name **CMD**
#### CMD - commands
~~~
build # build container ( changes of Dockerfile )
start # start container ( changes of scripts )
stop # stop container
uninstall # remove container without to delete the data
remove # remove all data
~~~
#### CI/CD Settings
Go Gitlab **Settings** -> **CI/CD** -> **Variables**
~~~
#### FairCoin.Co group variables ######################
FAIRCOIN_CONF # faircoin.conf file
FAIRCOIN_PORT # faircoind -port
~~~
## Development <small>( manual usage )</small>
If you want create an instance manual then follow the instructions.
1. install docker and docker-compose ( https://docs.docker.com/compose/install/ )
1. clone this project
1. change configuration in ./env
1. run services by ./control.sh
~~~
chmod +x ./control.sh
./control.sh build
./control.sh start
./control.sh stop
./control.sh uninstall
./control.sh remove
~~~
#!/bin/bash
export RUNNER_UID=`id -u`
export RUNNER_GID=`id -g`
export `cat ./env/*`
case $1 in
"build")
mkdir -p ~/.faircoin2
chmod +x ./script/blocknotify.sh
docker-compose stop
docker-compose down
docker-compose build
;;
"start")
chmod +x ./script/blocknotify.sh
docker-compose stop
docker-compose down
source ${FAIRCOIN_CONF}
if [ ! -f "~/.faircoin2/faircoin.conf" ]; then echo -e "rpcconnect=${rpcconnect}\nrpcport=${rpcport}\nrpcuser=${rpcuser}\nrpcpassword=${rpcpassword}\ntxindex=1" > ~/.faircoin2/faircoin.conf; fi
docker-compose up -d
;;
"stop")
docker-compose stop
;;
"uninstall")
docker-compose stop
docker-compose down
;;
"remove")
docker-compose stop
docker-compose down
# rm -R ~/.faircoin2 #### dont use this command if you have some wallet.dat in your ~/.faircoin2 folder !!! In this case remove the block databases manually.
;;
esac
......@@ -3,12 +3,22 @@ version: "3.1"
services:
faircoin:
build: ./
container_name: FairCoin-2-V92001-nobuild
build:
context: ./
args:
source_repository: "https://github.com/faircoin/faircoin.git"
RUNNER_UID: "${RUNNER_UID:-1000}"
RUNNER_GID: "${RUNNER_GID:-1000}"
FAIRCOIN_PORT: ${FAIRCOIN_PORT:-40404}
env_file:
- ${FAIRCOIN_CONF}
container_name: FairCoin.Co-faircoind
restart: always
command: '-disablewallet -conf="${FAIRCOIN_CONF}" -blocknotify="${BLOCKNOTIFY}"'
command: '-disablewallet -port=${FAIRCOIN_PORT:-40404} -blocknotify=/home/faircoin/script/blocknotify.sh'
network_mode: "host"
user: "$GITLAB_RUNNER_UID:$GITLAB_RUNNER_GID"
user: "${RUNNER_UID:-1000}:${RUNNER_GID:-1000}"
volumes:
- .faircoin2:/home/faircoin/.faircoin2
${VOLUMES}
- ~/.faircoin2:/home/faircoin/.faircoin2
- ./script:/home/faircoin/script
- ../pulse.faircoin.co:/home/faircoin/pulse.faircoin.co
- ../explorer.faircoin.co:/home/faircoin/explorer.faircoin.co
FAIRCOIN_CONF=./env_file/FAIRCOIN_CONF
FAIRCOIN_PORT=40404
rpcconnect=0.0.0.0
rpcport=8332
rpcuser=faircoin
rpcpassword=password
txindex=1
File deleted
File deleted
#!/bin/bash
python3 /home/faircoin/pulse.faircoin.co/script/getdata.py
cd /home/faircoin/explorer.faircoin.co/scripts
python3 dbload.py