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 (57)
stages:
- clean
- build
- restart
- start
- stop
- uninstall
- remove
clean-blockchain-data:
stage: clean
build-faircoind:
stage: build
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /clean/
- $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
after_script:
- echo ${CI_PROJECT_DIR} > ~/test.txt
- rm -R ~/.faircoin2
- docker-compose build
build-faircoind:
stage: build
start-faircoind:
stage: start
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /build/
- $CMD =~ /build|start/
before_script:
- mkdir -p ~/.faircoin2
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- chmod +x ./script/blocknotify.sh
script:
- docker-compose stop
- docker-compose down
- docker-compose build
- 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
restart-faircoind:
stage: restart
uninstall-faircoind:
stage: uninstall
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /build|restart/
- $CMD =~ /uninstall/
script:
- docker-compose stop
- docker-compose down
- docker-compose up -d
remove-faircoind:
stage: remove
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /remove/
script:
- docker-compose stop
- docker-compose down
after_script:
- rm -R ~/.faircoin2
......@@ -25,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 ########################################################################
......@@ -35,10 +36,10 @@ RUN rm -rf /var/lib/apt/lists/* && \
#####################################################################################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
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##
......@@ -58,17 +59,25 @@ 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/.faircoin2
# RUN chown -R faircoin:faircoin /home/faircoin/.faircoin2
# RUN echo "TTT $FAIRCOIN_CONF" > /home/faircoin/.faircoin2/inf.conf
RUN mkdir -p /home/faircoin/pulse.faircoin.co
RUN chown -R faircoin:faircoin /home/faircoin/pulse.faircoin.co
WORKDIR /home/faircoin
ARG FAIRCOIN_CONF
ARG FAIRCOIN_PORT
RUN ./faircoind -daemon -disablewallet -reindex -port=$FAIRCOIN_PORT -conf="$FAIRCOIN_CONF" && \
sleep 60 && \
./faircoin-cli stop && \
sleep 10
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
PATH="$1/.."
if [ -e $PATH/pulse.faircoin.co/script/getdata.py ]
then
cd $PATH/pulse.faircoin.co/script
python3 getdata.py
fi
#!/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
......@@ -7,15 +7,18 @@ services:
context: ./
args:
source_repository: "https://github.com/faircoin/faircoin.git"
GITLAB_RUNNER_UID: "${GITLAB_RUNNER_UID}"
GITLAB_RUNNER_GID: "${GITLAB_RUNNER_GID}"
FAIRCOIN_CONF: "${FAIRCOIN_CONF}"
FAIRCOIN_PORT: 40414
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}" -port=40414 -blocknotify="${CI_PROJECT_DIR}/blocknotify.sh"'
# 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
- ./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
#!/bin/bash
python3 /home/faircoin/pulse.faircoin.co/script/getdata.py
cd /home/faircoin/explorer.faircoin.co/scripts
python3 dbload.py