forked from GaloyMoney/blink
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update docs for contributing with Flash practices (#122)
* docs: update dev.md with flash repo and forked commit * docs: update contributing
- Loading branch information
Showing
2 changed files
with
82 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
## Setup | ||
|
||
This setup was last tested with the following tools: | ||
|
||
``` | ||
$ node --version | ||
v20.10.0 | ||
|
@@ -44,10 +45,12 @@ To use the correct node version, you can install nvm and run `nvm use 20`. Then | |
### Clone the repo: | ||
|
||
``` | ||
$ git clone [email protected]:GaloyMoney/galoy.git | ||
$ cd galoy | ||
$ git clone [email protected]:lnflash/flash.git | ||
$ cd flash | ||
``` | ||
|
||
*Flash is a fork of [Blink](https://github.com/GaloyMoney/blink) at commit `0a52b0673` (tag: 0.13.92)* | ||
|
||
### Set the Environment | ||
|
||
[direnv](https://direnv.net) is required to load environment variables. Make sure it is installed and that the [direnv hook](https://direnv.net/docs/hook.html) is added to your `shell.rc` file. | ||
|
@@ -64,23 +67,28 @@ $ direnv reload | |
(...) | ||
``` | ||
|
||
#### Testing the ibex-webhook | ||
#### Testing the ibex-webhook | ||
|
||
You'll need a web gateway that forwards traffic to your local server (default http://localhost:4008). This can be done with Ngrok. After installing the ngrok cli and creating an account, do the following: | ||
|
||
1. Start ngrok tunnel: | ||
``` | ||
ngrok http http://localhost:4008 | ||
``` | ||
2. Copy the provided URL ("forwarding" field) | ||
3. Add the URL to your `IBEX_EXTERNAL_URI` environment variable. E.g | ||
``` | ||
export IBEX_EXTERNAL_URI="https://1911-104-129-24-147.ngrok-free.app" | ||
``` | ||
Note: To avoid repeating steps 2 & 3 everytime you restart the web gateway, you can get a static domain (e.g [ngrok domains](https://dashboard.ngrok.com/cloud-edge/domains)) and then set the `IBEX_EXTERNAL_URI` in your `.env.local` | ||
|
||
``` | ||
ngrok http http://localhost:4008 | ||
``` | ||
|
||
2. Copy the provided URL ("forwarding" field) | ||
|
||
3. Add the URL to your `IBEX_EXTERNAL_URI` environment variable. E.g | ||
|
||
``` | ||
export IBEX_EXTERNAL_URI="https://1911-104-129-24-147.ngrok-free.app" | ||
``` | ||
|
||
Note: To avoid repeating steps 2 & 3 everytime you restart the web gateway, you can get a static domain (e.g [ngrok domains](https://dashboard.ngrok.com/cloud-edge/domains)) and then set the `IBEX_EXTERNAL_URI` in your `.env.local` | ||
|
||
### Install dependencies | ||
|
||
``` | ||
$ yarn install | ||
``` | ||
|
@@ -92,16 +100,19 @@ $ make start-deps | |
# or | ||
$ make reset-deps | ||
``` | ||
|
||
Everytime the dependencies are re-started the environment must be reloaded via `direnv reload`. When using the [make command](../Makefile) this will happen automatically. | ||
|
||
## Development | ||
|
||
To start the GraphQL server and its dependencies: | ||
|
||
``` | ||
$ make start | ||
``` | ||
|
||
To run in debug mode: | ||
|
||
``` | ||
DEBUG=* make start | ||
``` | ||
|
@@ -111,6 +122,7 @@ After running `make start-deps` or `make reset-deps`, the lightning network - ru | |
You can then login with the following credentials to get an account with an existing balance: `phone: +16505554328`, `code: 000000` | ||
|
||
### Config | ||
|
||
There is a sample configuration file `galoy.yaml`. This is the applications default configuration and contains settings for LND, test accounts, rate limits, fees and more. | ||
|
||
If you need to customize any of these settings you can create a `custom.yaml` file in the path `/var/yaml/custom.yaml`. This file will be merged with the default config. Here is an example of a custom.yaml file that configures fees: | ||
|
@@ -154,6 +166,7 @@ To run the full test suite you can run: | |
```bash | ||
$ make test | ||
``` | ||
|
||
Executing the full test suite requires [runtime dependencies](#runtime-dependencies). | ||
|
||
### Run unit tests | ||
|
@@ -177,6 +190,7 @@ $ make integration | |
``` | ||
|
||
The integration tests are *not* fully idempotent (yet) so currently to re-run the tests, run: | ||
|
||
``` | ||
$ make reset-integration | ||
``` | ||
|
@@ -194,6 +208,7 @@ $ TEST=utils yarn test:unit | |
# or | ||
$ TEST=utils make unit | ||
``` | ||
|
||
where `utils` is the name of the file `utils.spec.ts` | ||
|
||
#### Integration | ||
|
@@ -207,6 +222,7 @@ $ TEST=01-connection make integration | |
``` | ||
|
||
if within a specific test suite you want to run/debug only a describe or it(test) block please use: | ||
|
||
* [describe.only](https://jestjs.io/docs/api#describeonlyname-fn): just for debug purposes | ||
* [it.only](https://jestjs.io/docs/api#testonlyname-fn-timeout): just for debug purposes | ||
* [it.skip](https://jestjs.io/docs/api#testskipname-fn): use it when a test is temporarily broken. Please don't commit commented test cases | ||
|
@@ -217,6 +233,7 @@ if within a specific test suite you want to run/debug only a describe or it(test | |
|
||
Migrations are stored in the `src/migrations` folder. | ||
When developing migrations the best way to test them on a clean database is: | ||
|
||
``` | ||
make test-migrate | ||
``` | ||
|
@@ -231,6 +248,7 @@ npx migrate-mongo create <migration-name> \ | |
``` | ||
|
||
Write the migration in the newly created migration file and then test/run with the following: | ||
|
||
```bash | ||
# Migrate | ||
npx migrate-mongo up \ | ||
|
@@ -246,13 +264,18 @@ When testing, to isolate just the current migration being worked on in local dev | |
### Known issues | ||
|
||
* **Test suite timeouts**: increase jest timeout value. Example: | ||
|
||
```bash | ||
# 120 seconds | ||
$ JEST_TIMEOUT=120000 yarn test:integration | ||
``` | ||
|
||
* **Integration tests running slow**: we use docker to run dependencies (redis, mongodb, bitcoind and 4 lnds) so the entire test suite is disk-intensive. | ||
|
||
* Please make sure that you are running docker containers in a solid state drive (SSD) | ||
|
||
* Reduce lnd log disk usage: change debuglevel to critical | ||
|
||
``` | ||
# ./dev/lnd/lnd.conf | ||
debuglevel=critical | ||
|
@@ -279,6 +302,4 @@ $ yarn prettier -w . | |
## Contributing | ||
When opening a PR please pay attention to having a [clean git history](https://medium.com/@catalinaturlea/clean-git-history-a-step-by-step-guide-eefc0ad8696d) with standard commit messages. We use the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) format for our commits. | ||
It is the responsibility of the PR author to resolve merge conflicts before a merge can happen. If the PR is open for a long time a rebase may be requested. | ||
See the [CONTRIBUTING.md](./CONTRIBUTING.md) |