Commit 8b825300 authored by TonyFord's avatar TonyFord
Browse files

add deployment step init

parent a702fd99
stages: stages:
- build - build
- init
- start - start
- create_wallet - create_wallet
- load_wallet - load_wallet
...@@ -17,7 +18,7 @@ build: ...@@ -17,7 +18,7 @@ build:
refs: refs:
- master - master
variables: variables:
- $CMD =~ /build/ - $CMD =~ /^build$/
before_script: before_script:
- export RUNNER_UID=`id -u` - export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g` - export RUNNER_GID=`id -g`
...@@ -31,6 +32,35 @@ build: ...@@ -31,6 +32,35 @@ build:
after_script: after_script:
- docker-compose down - docker-compose down
init:
stage: init
tags:
- FairCoin.Co
only:
refs:
- master
variables:
- $CMD =~ /^build$|^init$/
before_script:
- export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g`
script:
- docker-compose exec -T faircoin ./stop_faircoin_services.sh && sleep 10
- docker-compose stop
- docker-compose up -d --remove-orphans faircoin
- docker-compose exec -T faircoin rm -f /home/faircoin/.faircoin2/faircoin.conf
- docker-compose exec -T faircoin cp /home/faircoin/_init/.faircoin2/faircoin.conf /home/faircoin/.faircoin2/
- docker-compose exec -T faircoin rm -f /home/faircoin/.faircoin2/fairchains.conf
- docker-compose exec -T faircoin cp /home/faircoin/_init/.faircoin2/fairchains.conf /home/faircoin/.faircoin2/
- docker-compose exec -T faircoin rm -f /home/faircoin/.faircoin2/FairCoinChain.electrumx.json
- docker-compose exec -T faircoin cp /home/faircoin/_init/.faircoin2/FairCoinChain.electrumx.json /home/faircoin/.faircoin2/
- docker-compose exec -T faircoin rm -f /home/faircoin/.faircoin2/FairCoinChain.json
- docker-compose exec -T faircoin cp /home/faircoin/_init/.faircoin2/FairCoinChain.json /home/faircoin/.faircoin2/
- docker-compose exec -T faircoin rm -f /home/faircoin/.electrumfair/config
- docker-compose exec -T faircoin cp /home/faircoin/_init/.electrumfair/config /home/faircoin/.electrumfair/
after_script:
- docker-compose down
start: start:
stage: start stage: start
tags: tags:
...@@ -39,7 +69,7 @@ start: ...@@ -39,7 +69,7 @@ start:
refs: refs:
- master - master
variables: variables:
- $CMD =~ /^build$|^start$/ - $CMD =~ /^build$|^init$|^start$/
before_script: before_script:
- export RUNNER_UID=`id -u` - export RUNNER_UID=`id -u`
- export RUNNER_GID=`id -g` - export RUNNER_GID=`id -g`
......
...@@ -24,6 +24,7 @@ Enter variable name **CMD** ...@@ -24,6 +24,7 @@ Enter variable name **CMD**
Container commands: Container commands:
~~~ ~~~
build build
init # initialize configuration
start # start container ( changes of scripts ) start # start container ( changes of scripts )
stop # stop container stop # stop container
uninstall # remove container uninstall # remove container
......
...@@ -16,7 +16,7 @@ services: ...@@ -16,7 +16,7 @@ services:
faircoin: faircoin:
build: build:
context: ./faircoin/faircoin context: ./services/faircoin
args: args:
RUNNER_UID: ${RUNNER_UID:-1000} RUNNER_UID: ${RUNNER_UID:-1000}
RUNNER_GID: ${RUNNER_GID:-1000} RUNNER_GID: ${RUNNER_GID:-1000}
...@@ -25,12 +25,14 @@ services: ...@@ -25,12 +25,14 @@ services:
command: ./start_faircoin_services.sh command: ./start_faircoin_services.sh
user: "${RUNNER_UID:-1000}:${RUNNER_GID:-1000}" user: "${RUNNER_UID:-1000}:${RUNNER_GID:-1000}"
volumes: volumes:
- ./services/_init/.faircoin2:/home/faircoin/_init/.faircoin2
- ./services/_init/.electrumfair:/home/faircoin/_init/.electrumfair
- faircoin2:/home/faircoin/.faircoin2 - faircoin2:/home/faircoin/.faircoin2
- electrumfair:/home/faircoin/.electrumfair - electrumfair:/home/faircoin/.electrumfair
electrumfairchainsx: electrumfairchainsx:
build: build:
context: ./faircoin/electrumfairchainsx context: ./services/electrumfairchainsx
args: args:
RUNNER_UID: "${RUNNER_UID}" RUNNER_UID: "${RUNNER_UID}"
RUNNER_GID: "${RUNNER_GID}" RUNNER_GID: "${RUNNER_GID}"
...@@ -38,14 +40,12 @@ services: ...@@ -38,14 +40,12 @@ services:
- faircoin - faircoin
container_name: faircoin-electrumfairchainsx container_name: faircoin-electrumfairchainsx
restart: always restart: always
command: ./efcx_server command: sleep inf
user: "${RUNNER_UID:-1000}:${RUNNER_GID:-1000}" user: "${RUNNER_UID:-1000}:${RUNNER_GID:-1000}"
volumes: volumes:
- ./services/_init/.faircoin2:/home/faircoin/_init/.faircoin2
- faircoin2:/home/faircoin/.faircoin2 - faircoin2:/home/faircoin/.faircoin2
- fairchains:/home/faircoin/.fairchains
volumes: volumes:
faircoin2: faircoin2:
fairchains:
electrumfair: electrumfair:
...@@ -46,14 +46,8 @@ RUN useradd --create-home --shell /bin/bash faircoin --uid $RUNNER_UID --gid $RU ...@@ -46,14 +46,8 @@ RUN useradd --create-home --shell /bin/bash faircoin --uid $RUNNER_UID --gid $RU
RUN mkdir -p $FAIRCHAINS_PATH RUN mkdir -p $FAIRCHAINS_PATH
RUN chown -R faircoin:faircoin $FAIRCHAINS_PATH RUN chown -R faircoin:faircoin $FAIRCHAINS_PATH
COPY .faircoin2/fairchains.conf ${FAIRCHAINS_PATH}fairchains.conf RUN mkdir -p /home/faircoin/_init/.faircoin2
RUN chown faircoin:faircoin ${FAIRCHAINS_PATH}fairchains.conf RUN chown -R faircoin:faircoin /home/faircoin/_init/.faircoin2
COPY .faircoin2/FairCoinChain.electrumx.json ${FAIRCHAINS_PATH}FairCoinChain.electrumx.json
RUN chown faircoin:faircoin ${FAIRCHAINS_PATH}FairCoinChain.electrumx.json
COPY .faircoin2/FairCoinChain.json ${FAIRCHAINS_PATH}FairCoinChain.json
RUN chown faircoin:faircoin ${FAIRCHAINS_PATH}FairCoinChain.json
USER faircoin USER faircoin
#################################################################################faircoin## #################################################################################faircoin##
......
...@@ -49,16 +49,20 @@ ARG RUNNER_UID ...@@ -49,16 +49,20 @@ ARG RUNNER_UID
RUN groupadd -g $RUNNER_GID faircoin RUN groupadd -g $RUNNER_GID faircoin
RUN useradd --create-home --shell /bin/bash faircoin --uid $RUNNER_UID --gid $RUNNER_GID RUN useradd --create-home --shell /bin/bash faircoin --uid $RUNNER_UID --gid $RUNNER_GID
RUN mkdir -p /home/faircoin/.faircoin2
RUN chown -R faircoin:faircoin /home/faircoin/.faircoin2
RUN mkdir -p /home/faircoin/.electrumfair RUN mkdir -p /home/faircoin/.electrumfair
RUN chown -R faircoin:faircoin /home/faircoin/.electrumfair RUN chown -R faircoin:faircoin /home/faircoin/.electrumfair
RUN mkdir -p /home/faircoin/.faircoin2 RUN mkdir -p /home/faircoin/_init/.faircoin2
RUN chown -R faircoin:faircoin /home/faircoin/_init/.faircoin2
COPY .faircoin2/faircoin.conf /home/faircoin/.faircoin2/faircoin.conf RUN mkdir -p /home/faircoin/_init/.electrumfairchainsx
RUN chown -R faircoin:faircoin /home/faircoin/.faircoin2 RUN chown -R faircoin:faircoin /home/faircoin/_init/.electrumfair
COPY .electrumfair/config /home/faircoin/.electrumfair/config COPY ./servers.json /home/faircoin/servers.json
RUN chown faircoin:faircoin /home/faircoin/.electrumfair/config RUN chown faircoin:faircoin /home/faircoin/servers.json
COPY ./start_faircoin_services.sh /home/faircoin/start_faircoin_services.sh COPY ./start_faircoin_services.sh /home/faircoin/start_faircoin_services.sh
RUN chown faircoin:faircoin /home/faircoin/start_faircoin_services.sh RUN chown faircoin:faircoin /home/faircoin/start_faircoin_services.sh
......
#!/bin/bash #!/bin/bash
if [ ! -d ./electrumfair/packages ]; then ./electrumfair/contrib/make_packages; fi if [ ! -d ./electrumfair/packages ]; then ./electrumfair/contrib/make_packages; fi
rm ./electrumfair/electrumfair/servers.json rm ./electrumfair/electrumfair/servers.json
cp ./.electrumfair/servers.json ./electrumfair/electrumfair/ cp ./servers.json ./electrumfair/electrumfair/
./electrumfair/run_electrumfair daemon start ./electrumfair/run_electrumfair daemon start
./faircoind ./faircoind
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