Commit 25251830 authored by TonyFord's avatar TonyFord
Browse files

deployment electrumfairchainsx server

parents
stages:
- build
- start
- stop
- uninstall
- remove
build-electrumfairchainsx:
stage: build
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /build/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
script:
- docker-compose stop
- docker-compose down
- docker-compose build
start-electrumfair:
stage: start
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /build|start/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
- cat ${FAIRCHAINS_CONF} > fairchains.conf
script:
- docker-compose stop
- docker-compose down
- docker-compose up -d
stop-electrumfairchainsx:
stage: stop
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /stop/
script:
- docker-compose stop
uninstall-electrumfairchainsx:
stage: uninstall
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /uninstall/
script:
- docker-compose stop
- docker-compose down
remove-electrumfairchainsx:
stage: remove
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /remove/
script:
- docker-compose stop
- docker-compose down
# 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 \
net-tools \
git \
python3-pyqt5 \
openssl
#####################################################################################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 \
aiorpcx
attrs
plyvel
pylru
aiohttp
#####################################################################################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 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
RUN mkdir -p /home/faircoin/.fairchains
RUN chown -R faircoin:faircoin /home/faircoin/.fairchains
USER faircoin
#################################################################################faircoin##
### download electrumfairchainsx & build ##################################################
WORKDIR /home/faircoin
RUN git clone https://github.com/fairchainsx/electrumfairchainsx.git
WORKDIR /home/faircoin/electrumfairchainsx
RUN python3 setup.py build
#################################################################################faircoin##
### create ssl cert #######################################################################
WORKDIR /home/faircoin/.fairchains
RUN git clone https://github.com/fairchainsx/fairchains-collection.git
RUN cp ./fairchains-collection/FairCoin/FairCoinChain.electrumx.json ./
RUN cp ./fairchains-collection/FairCoin/FairCoinChain.json ./
RUN openssl genrsa -out electrumx.key 2048
RUN openssl req -new -key electrumx.key -out electrumx.csr
RUN openssl x509 -req -days 1825 -in electrumx.csr -signkey electrumx.key -out electrumx.crt
COPY ./fairchains.conf ./fairchains.conf
WORKDIR /home/faircoin/electrumfairchainsx
ENTRYPOINT ["python3 efcx_server"]
# FairCoin.Co electrumfairchainsx server
electrumfairchainsx server for electrumfair(chains) wallets
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 ######################
FAIRCHAINS_CONF # conf
~~~
## 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")
docker-compose stop
docker-compose down
docker-compose build
;;
"start")
cat ${FAIRCHAINS_CONF} > ./fairchains.conf
docker-compose stop
docker-compose down
docker-compose up -d
;;
"stop")
docker-compose stop
;;
"uninstall")
docker-compose stop
docker-compose down
;;
"remove")
docker-compose stop
docker-compose down
# rm -R ~/.electrumfair #### dont use this command if you have some wallet.dat in your ~/.faircoin2 folder !!! In this case remove the block databases manually.
;;
esac
version: "3.1"
services:
electrumfair:
build:
context: ./
args:
RUNNER_UID: "${RUNNER_UID}"
RUNNER_GID: "${RUNNER_GID}"
container_name: FairCoin.Co-electrumfairchainsx
command: daemon
network_mode: "host"
user: "${RUNNER_UID}:${RUNNER_GID}"
FAIRCHAINS_CONF=./env_file/FAIRCHAINS_CONF
rpcconnect=0.0.0.0
rpcport=8399
rpcuser=faircoin
rpcpassword=password
txindex=1
netname=FairCoinChain
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