From 38bdf581807686ec652373f98bc33666ae1f796b Mon Sep 17 00:00:00 2001 From: Derrick Schwabe Date: Sun, 27 Feb 2022 21:53:05 -0700 Subject: README updates and a re-ordering of steps/additional clarity produce a working dev deployment --- README.md | 87 +++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 24 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index bcf979d1..edee9d78 100644 --- a/README.md +++ b/README.md @@ -15,42 +15,76 @@ This repository contains the code for the backend API server which is implemente ### Getting Started - git clone https://github.com/coinos/coinos-server - cd coinos-server - cp -rf sampleconfig ./config - cp .env.sample .env - cp fx.sample fx - docker network create net - sudo base64 config/lnd/tls.cert | tr -d '\n' - sudo base64 config/lnd/data/chain/bitcoin/regtest/admin.macaroon | tr -d '\n' - docker run -it -v $(pwd):/app --entrypoint yarn asoltys/coinos-server - docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --remove-orphans - docker exec -i mariadb mysql -u root -ppassword < db/schema.sql - docker exec -it liquid elements-cli -conf=/config/elements.conf sendtoaddress AzpsKhC6xE9FEK4aWAzMnbvueMLiSa5ym1xpuYogFkHzWgMHSt8B79aNNbFppQzCSQ2yZ9E4nL6RQJU7 1000000 - docker exec -it lnd lncli create - docker exec -it lnd lncli --network=regtest --chain=bitcoin unlock +```bash +git clone https://github.com/coinos/coinos-server +cd coinos-server +cp -rf sampleconfig ./config +cp .env.sample .env +cp fx.sample fx +docker network create net +docker run -it -v $(pwd):/app --entrypoint yarn asoltys/coinos-server +docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --remove-orphans +docker exec -i mariadb mysql -u root -ppassword < db/schema.sql +docker exec -it liquid elements-cli -conf=/config/elements.conf sendtoaddress AzpsKhC6xE9FEK4aWAzMnbvueMLiSa5ym1xpuYogFkHzWgMHSt8B79aNNbFppQzCSQ2yZ9E4nL6RQJU7 1000000 +``` + +then run this and keep reference to the result for the forthcoming [Config changes] + +```bash +sudo base64 config/lnd/tls.cert | tr -d '\n' +``` +then run this and type a password when prompted, and then 'n' to create new wallet: + +```bash +docker exec -it lnd lncli create +``` +(optionally write down the seed as backup in case you lose the wallet and/or password) + +then uncomment line 12 of [config/lnd/lnd.conf] and update the [pwd file] with the new wallet password you just set. + +then run this and copy/paste the result to another blank file or note: +```bash +sudo base64 config/lnd/data/chain/bitcoin/regtest/admin.macaroon | tr -d '\n' +``` + +then run: +```bash +docker-compose down --remove-orphans +``` +and start it back up again with the same command from before: +```bash +docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d --remove-orphans +``` ### Config changes - navigate to config/index.js. - for the lna dictionary, update the values for cert and macaroon. These values can be found in the macaroon and cert files created in the previous section in the root folder of the coinos project. -### Wallet not found issues - If your app logs complain that the wallet was not found, do the following: - docker-compose exec bitcoin bash - bitcoin-cli -datadir=config/ createwallet coinos - exit - docker exec -it lnd lncli --network=regtest --chain=bitcoin unlock +Navigate to `./config/index.js` +Under `lna`, update the values for `cert` and `macaroon` with the output from the respective commands you ran in the section above. +### Wallet not found issues +If your app logs complain that the wallet was not found, do the following: +```bash +docker-compose exec bitcoin bash +bitcoin-cli -datadir=config/ createwallet coinos +exit +docker exec -it lnd lncli --network=regtest --chain=bitcoin unlock +``` +### Spinning down coinos & services +from the root of this repo, run: +```bash +docker-compose down --remove-orphans +``` +--- -Note the last step will take some time on first run as it will download the aforementioned docker images. +Note the initial `docker-compose up` step will take some time on first run as it will download all of the necessary images. After successful creation of all docker containers coinos will be available at http://localhost:8085 -To shutdown coinos and all of its containers/services, run `docker-compose down` again. +To shutdown coinos and all of its containers/services, run `docker-compose down --remove-orphans` again. At anypoint to purge the database and start with a new one run `rm -rf mysql` and then `mkdir mysql` and then the same steps following from that point as outlined above. Or run `purge-except-git.sh` from `./scripts` @@ -131,3 +165,8 @@ The bitcoind and elementsd nodes can be a pruned if you want to limit the amount I've only tested with Maria. Here's a [schema](https://github.com/asoltys/coinos-server/blob/master/db/schema.sql) to get you started. cat db/schema.sql | mysql -u root -p + + +[Config changes]:(#config-changes) +[config/lnd/lnd.conf]:./config/lnd/lnd.conf +[pwd file]:./config/lnd/pwd \ No newline at end of file -- cgit v1.2.3