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 (61)
stages: stages:
- build - build
- restart - start
- stop
- uninstall
- remove
build-faircoind: build-faircoind:
stage: build stage: build
...@@ -12,20 +15,71 @@ build-faircoind: ...@@ -12,20 +15,71 @@ build-faircoind:
variables: variables:
- $CMD =~ /build/ - $CMD =~ /build/
before_script: before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- mkdir -p ~/.faircoin2 - mkdir -p ~/.faircoin2
- chmod +x ./script/blocknotify.sh
script: script:
- docker-compose stop
- docker-compose down - docker-compose down
- docker-compose build - docker-compose build
restart-faircoind: start-faircoind:
stage: restart stage: start
tags: tags:
- FairCoin.Co - FairCoin.Co
only: only:
refs: refs:
- master - master
variables: variables:
- $CMD =~ /build|restart/ - $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 =~ /remove/
script: script:
- docker-compose stop
- docker-compose down - docker-compose down
- docker-compose up after_script:
- rm -R ~/.faircoin2
...@@ -25,7 +25,8 @@ RUN apt-get install -qy nano ...@@ -25,7 +25,8 @@ RUN apt-get install -qy nano
#####################################################################################root## #####################################################################################root##
### install python packages ### install python packages
RUN apt-get install -qy python3-pip RUN apt-get install -qy python3-pip
RUN python3 -m pip install python-bitcoinrpc RUN python3 -m pip install \
python-bitcoinrpc
#####################################################################################root## #####################################################################################root##
### system cleanup ######################################################################## ### system cleanup ########################################################################
...@@ -35,10 +36,10 @@ RUN rm -rf /var/lib/apt/lists/* && \ ...@@ -35,10 +36,10 @@ RUN rm -rf /var/lib/apt/lists/* && \
#####################################################################################root## #####################################################################################root##
### create and run user account to image ################################################## ### create and run user account to image ##################################################
ARG GITLAB_RUNNER_GID ARG RUNNER_GID
ARG GITLAB_RUNNER_UID ARG RUNNER_UID
RUN groupadd -g $GITLAB_RUNNER_GID faircoin RUN groupadd -g $RUNNER_GID faircoin
RUN useradd --create-home --shell /bin/bash faircoin --uid $GITLAB_RUNNER_UID --gid $GITLAB_RUNNER_GID RUN useradd --create-home --shell /bin/bash faircoin --uid $RUNNER_UID --gid $RUNNER_GID
USER faircoin USER faircoin
#################################################################################faircoin## #################################################################################faircoin##
...@@ -58,17 +59,25 @@ WORKDIR /home/faircoin/faircoin/src ...@@ -58,17 +59,25 @@ WORKDIR /home/faircoin/faircoin/src
RUN mv ./faircoind /home/faircoin/faircoind RUN mv ./faircoind /home/faircoin/faircoind
RUN mv ./faircoin-cli /home/faircoin/faircoin-cli 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 mkdir -p /home/faircoin/pulse.faircoin.co
# RUN chown -R faircoin:faircoin /home/faircoin/.faircoin2 RUN chown -R faircoin:faircoin /home/faircoin/pulse.faircoin.co
# RUN echo "TTT $FAIRCOIN_CONF" > /home/faircoin/.faircoin2/inf.conf
WORKDIR /home/faircoin RUN mkdir -p /home/faircoin/.faircoin2
ARG FAIRCOIN_CONF RUN chown -R faircoin:faircoin /home/faircoin/.faircoin2
ARG FAIRCOIN_PORT
RUN ./faircoind -daemon -disablewallet -reindex -port=$FAIRCOIN_PORT -conf="$FAIRCOIN_CONF" && \ RUN mkdir -p /home/faircoin/explorer.faircoin.co
sleep 60 && \ RUN chown -R faircoin:faircoin /home/faircoin/explorer.faircoin.co
./faircoin-cli stop && \
sleep 10
USER faircoin
WORKDIR /home/faircoin
ENTRYPOINT ["./faircoind"] 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
...@@ -7,15 +7,18 @@ services: ...@@ -7,15 +7,18 @@ services:
context: ./ context: ./
args: args:
source_repository: "https://github.com/faircoin/faircoin.git" source_repository: "https://github.com/faircoin/faircoin.git"
GITLAB_RUNNER_UID: "${GITLAB_RUNNER_UID}" RUNNER_UID: "${RUNNER_UID:-1000}"
GITLAB_RUNNER_GID: "${GITLAB_RUNNER_GID}" RUNNER_GID: "${RUNNER_GID:-1000}"
FAIRCOIN_CONF: "${FAIRCOIN_CONF}" FAIRCOIN_PORT: ${FAIRCOIN_PORT:-40404}
FAIRCOIN_PORT: 40414 env_file:
- ${FAIRCOIN_CONF}
container_name: FairCoin.Co-faircoind container_name: FairCoin.Co-faircoind
restart: always restart: always
command: '-disablewallet -conf="${FAIRCOIN_CONF}" -port=40414' command: '-disablewallet -port=${FAIRCOIN_PORT:-40404} -blocknotify=/home/faircoin/script/blocknotify.sh'
# command: '-disablewallet -conf="${FAIRCOIN_CONF}" -blocknotify="${BLOCKNOTIFY}"'
network_mode: "host" network_mode: "host"
user: "${GITLAB_RUNNER_UID}:${GITLAB_RUNNER_GID}" user: "${RUNNER_UID:-1000}:${RUNNER_GID:-1000}"
volumes: volumes:
- ~/.faircoin2:/home/faircoin/.faircoin2 - ~/.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