Commit 14329a6a authored by TonyFord's avatar TonyFord
Browse files

update docs

parent ec45b020
# Developer report
Here are some commands and infos of a real server preparation to gitlab-runner usage.
## 2021 Mar 28
## Running electrum-faircoin server on AIC (okamain with LXC=syncthing)
### using gitlab-runner with help from Sebastian
+ start from https://git.fairkom.net
+ fork https://git.fairkom.net/faircoin.co/electrumfairchainsx ( click fork button on top right and select the target of the fork )
+ new forked repo https://git.fairkom.net/example/electrumfairchainsx
+ edit https://git.fairkom.net/example/electrumfairchainsx/-/blob/master/.gitlab-ci.yml and change the gitlab-runner tags to yours ( for example your git group name, your server name, your domain, ... )
+ goto https://git.fairkom.net/example/electrumfairchainsx/-/settings/ci_cd
+ find the registration token in Settings -> CI/CD -> Runner ( section )
+ this token is needed when you register your gitlab-runner on your server
~~~
sudo gitlab-runner register
~~~
+ URL: enter only https://git.fairkom.net
+ tags: example.com
+ description: example.com runner
+ executor: shell
+ a gitlab-runner user will be created after registration
+ if you have registered it successfully then you need to add your gitlab-runner to docker group
~~~
sudo usermod -a -G docker gitlab-runner
~~~
~~~
### some helpful commands if you want list/remove runner ####
sudo gitlab-runner list
sudo gitlab-runner unregister runnersID
### alternativeley you can edit the /etc/gitlab-runner/config.toml
sudo nano /etc/gitlab-runner/config.toml
sudo gitlab-runner restart
~~~
+ then remove the clear section in /home/gitlab-runner/.bash_logout
~~~
sudo nano /home/gitlab-runner/.bash_logout
~~~
+ then set a password to get access to gitlab-runner later if you need to debug something
~~~
sudo passwd gitlab-runner
~~~
+ to execute pipelines you must go to CI/CD not Settings -> CI/CD
+ go in git -> CI/CD -> pipelines -> Run Pipeline ->
~~~
Variable => CMD = install
~~~
+ go to Settings -> CI/CD -> Variables -> create Type(File) SSL_CONF -> put a copy of the ./env_file/SSL_CONF and edit it
+ you can run it manually by ssh access log in as gitlab-runner
~~~
. setenv
deploy/install
~~~
+ at the beginning the faircoind must build up the blockchain database. Every new block must be checked if its valid. This requires a lot of #CPU power but it will be temporarily.
+ wait ~3h until the blockchain is up-to-date then your server should be available in electrumfair
+ If it is not available then check your DNS and firewall settings
~~~
### DNS check -> both commands should result the same ip
curl ifconfig.me
dig electrum.example.com
~~~
~~~
### Firewall check -> test it inside and outside of your server
telnet electrum.example.com 51812
### if it is accessible then it should result the line
Escape character is '^]'
~~~
......@@ -12,23 +12,33 @@ faircoin jsonrpc for php developers
+ docker-compose installed ( https://docs.docker.com/compose/install/ )
+ gitlab-runner installed ( optional for gitlab deployment ) ( see vps server setup )
## Usage
## Usage <small>( by gitlab runner automation )</small>
### by Gitlab-Runner
Go into gitlab **CI/CD** -> **Pipeline** and **Run Pipeline**
1. Fork this project to your group/repositories where you have set up a gitlab-runner
1. change the gitlab-runner tags in .gitlab-ci.yml
1. add env files ( select Type = file ! ) to override defaults ./env_file , go to Gitlab **Settings** -> **CI/CD** -> **Variables**
Enter variable name **CMD**
#### CMD - commands
You can read a full developer report of server preparation with gitlab-runner usage > [DEV_REPORT.md](DEV_REPORT.md)
Container commands:
~~~
build
init # initialize configuration
start # start container ( changes of scripts )
stop # stop container
uninstall # remove container
remove
#### env files ( examples see env_file/... / select Type = file !) ######################
FAIRCHAINS_CONF # [optional] fairchains.conf / faircoin.conf
SSL_CONF # [mandatory] configuration to create ssl cert
FAIRCHAINS_ELECTRUMX_JSON # [optional] electrumx serve network configuration
FAIRCHAINS_JSON # [optional] blockchain parameters
~~~
1. run command, go to Gitlab **CI/CD** -> **Pipeline** and **Run Pipeline**
Enter variable name **CMD**
~~~
build # build container ( changes of Dockerfile )
start # start container ( changes of scripts )
new_ssl # create new ssl file for electrumx server
stop # stop container
install # runs build, start and new_ssl stages
uninstall # remove container without to delete the data
remove # remove all data
~~~
Wallet commands:
......@@ -49,7 +59,7 @@ Go Gitlab **Settings** -> **CI/CD** -> **Variables**
LH_PORT_jsonrpc # php -S 0.0.0.0:${LH_PORT}
~~~
Pipeline variables:
Pipeline variables ( required to run wallet commands ):
~~~
CMD = create wallet
WALLET = <new wallet name> # [optional] specify the wallets name
......@@ -78,32 +88,48 @@ PASSWORD = <wallet password> # password encrypts all wallets dat
~~~
## Manual usage
### by SSH access <small>( manually without gitlab-runner )</small>
change localhost port in setenv.sh
and run setenv.sh to init env vars
1. install docker and docker-compose ( https://docs.docker.com/compose/install/ )
1. clone this project
1. change configuration in ./env_file
1. Initialize env vars
~~~
. ./setenv.sh
chmod +x setenv
. setenv
~~~
follow the commands in the .gitlab-ci.yml and do the same steps as the gitlab-runner would do.
+ go to the section of your choice ( build|start|stop|uninstall|remove )
+ run all commands of ( before_script )
+ run all commands of ( script )
+ run all commands of ( after_script )
## Nginx server setup
1. run command from project root folder
~~~
deploy/build
deploy/start
deploy/new_ssl
deploy/stop
deploy/install
deploy/uninstall
deploy/remove
~~~
follow the instructions on https://git.fairkom.net/faircoin.co/admin/-/blob/master/SERVERSETUP.md#configure-server-host
#### Troubleshooting / console commands
some commands can be helpful getting shell access to container or get some status info
~~~
console/electrumx # get access to container of electrumfairchainsx server ( same as electrumfairchainsx )
console/electrumfairchainsx # get access to container of electrumfairchainsx server
console/faircoin # get access to container of faircoind
console/php-server # get access to container of php-server
console/ps # list containers status info
console/status # list all ports / processes and faircoind info
console/create wallet # create new electrumfair wallet
console/restore wallet # restore electrumfair wallet from seed or key
console/load wallet # load wallet ( make it hot )
console/close wallet # close wallet ( make it cold )
console/walletinfo # get electrumfair wallet info
~~~
## Wallet
~~~
./run_electrumfair create --passphrase test123 --password test123 --wallet /home/faircoin/.electrumfair/wallets/test
## Nginx server setup
~~~
follow the instructions on https://git.fairkom.net/faircoin.co/admin/-/blob/master/SERVERSETUP.md#configure-server-host
Markdown is supported
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