-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: initial Tiltfile * chore: add lnd1 to Tiltfile * chore: add core api to Tiltfile * chore: add serve_env to api * chore: add auth deps to Tiltfile * chore: run consent test in tilt * build: add xvfb-run to tilt * fix: bring back .env * ci: fix --test opt in tilt.yml * ci: pass labels to tilt
- Loading branch information
1 parent
11f4bc2
commit 808208e
Showing
45 changed files
with
1,461 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "Tilt CI" | ||
on: | ||
pull_request: | ||
branches: [ main ] | ||
types: [opened, synchronize, labeled, unlabeled] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: cachix/install-nix-action@v22 | ||
with: | ||
github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Prepare tilt args from labels | ||
id: prepare_args | ||
run: | | ||
ARGS="" | ||
cat <<EOF > labels.json | ||
${{ toJSON(github.event.pull_request.labels.*.name) }} | ||
EOF | ||
for LABEL in $(jq -r '.[]' < labels.json); do | ||
case "$LABEL" in | ||
dashboard|consent) | ||
ARGS+=" $LABEL" | ||
;; | ||
esac | ||
done | ||
echo "Prepared args: $ARGS" | ||
echo "args=$ARGS" >> "$GITHUB_OUTPUT" | ||
- name: Tilt CI | ||
run: nix develop -c bash -c "cd dev && xvfb-run tilt ci -- --test ${{ steps.prepare_args.outputs.args }}" |
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
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.*.json | ||
.*.env | ||
.envs |
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 |
---|---|---|
@@ -1,7 +1,148 @@ | ||
is_ci=sys.argv[1] == "ci" | ||
|
||
config.define_string_list("test") | ||
cfg = config.parse() | ||
|
||
groups = { | ||
"auth": [ | ||
"oathkeeper", | ||
"hydra", | ||
"hydra-migrate", | ||
"hydra-pg", | ||
"kratos", | ||
"kratos-pg", | ||
], | ||
"core": [ | ||
"apollo-router", | ||
"mongodb", | ||
"redis", | ||
], | ||
"bitcoin": [ | ||
"lnd1", | ||
"bria", | ||
"postgres-bria", | ||
"fulcrum", | ||
"bitcoind-signer", | ||
"bitcoind", | ||
], | ||
"tracing": [ | ||
"otel-agent", | ||
], | ||
} | ||
|
||
consent_test_target = "//apps/consent:cypress" | ||
local_resource( | ||
"consent-test", | ||
labels = ["test"], | ||
auto_init = is_ci and "consent" in cfg.get("test", []), | ||
cmd = "buck2 test {}".format(consent_test_target), | ||
resource_deps = [ | ||
"consent", | ||
"init-test-user", | ||
"hydra-consent" | ||
], | ||
) | ||
|
||
local_resource( | ||
name='init-test-user', | ||
labels = ['test'], | ||
cmd='bin/init-user.sh', | ||
resource_deps = [ | ||
"oathkeeper", | ||
"kratos", | ||
"api", | ||
] | ||
) | ||
|
||
consent_target = "//apps/consent:dev" | ||
if is_ci: | ||
consent_target = '//apps/consent:consent' | ||
local_resource( | ||
"consent", | ||
labels = ["auth"], | ||
cmd = "buck2 build {}".format(consent_target), | ||
serve_cmd = "buck2 run {}".format(consent_target), | ||
resource_deps = [ | ||
"apollo-router", | ||
"hydra", | ||
"api", | ||
], | ||
links = [ | ||
link("http://localhost:3000", "consent"), | ||
], | ||
) | ||
|
||
local_resource( | ||
name='hydra-consent', | ||
labels = ['auth'], | ||
cmd=['bin/setup-hydra-client.sh', 'consent', 'http://localhost:3000'], | ||
resource_deps = [ | ||
"hydra", | ||
] | ||
) | ||
|
||
api_target = "//core/api:api" | ||
local_resource( | ||
"api", | ||
labels = ["frontend"], | ||
labels = ["core"], | ||
cmd = "buck2 build {}".format(api_target), | ||
serve_cmd = "buck2 run {}".format(api_target), | ||
serve_env = { | ||
"HELMREVISION": "dev", | ||
"NETWORK": "regtest", | ||
"OATHKEEPER_DECISION_ENDPOINT": "http://localhost:4456", | ||
"TWILIO_ACCOUNT_SID": "AC_twilio_id", | ||
"TWILIO_AUTH_TOKEN": "AC_twilio_auth_token", | ||
"TWILIO_VERIFY_SERVICE_ID": "VA_twilio_service", | ||
"KRATOS_PG_CON": "postgres://dbuser:secret@localhost:5433/default?sslmode=disable", | ||
"KRATOS_PUBLIC_API": "http://localhost:4433", | ||
"KRATOS_ADMIN_API": "http://localhost:4434", | ||
"KRATOS_MASTER_USER_PASSWORD": "passwordHardtoFindWithNumber123", | ||
"KRATOS_CALLBACK_API_KEY": "The-Value-of-My-Key", | ||
"BRIA_HOST": "localhost", | ||
"BRIA_API_KEY": "bria_dev_000000000000000000000", | ||
"MONGODB_CON": "mongodb://localhost:27017/galoy", | ||
"REDIS_MASTER_NAME": "mymaster", | ||
"REDIS_PASSWORD": "", | ||
"REDIS_0_DNS": "localhost", | ||
"REDIS_0_PORT": "6379", | ||
"REDIS_TYPE": "standalone", | ||
"UNSECURE_IP_FROM_REQUEST_OBJECT": "true", | ||
"UNSECURE_DEFAULT_LOGIN_CODE": "000000", | ||
"GEETEST_ID": "geetest_id", | ||
"GEETEST_KEY": "geetest_key" | ||
}, | ||
allow_parallel = True, | ||
readiness_probe = probe( | ||
period_secs = 5, | ||
http_get = http_get_action( | ||
path = "healthz", | ||
port = 4012, | ||
), | ||
), | ||
resource_deps = [ | ||
"init-onchain", | ||
"lnd1", | ||
] | ||
) | ||
|
||
local_resource( | ||
name='init-onchain', | ||
labels = ['bitcoin'], | ||
cmd='bin/init-onchain.sh', | ||
resource_deps = [ | ||
"bitcoind", | ||
"bria", | ||
] | ||
) | ||
|
||
docker_compose("./docker-compose.deps.yml", project_name = "galoy-dev") | ||
|
||
for service in groups["bitcoin"]: | ||
dc_resource(service, labels = ["bitcoin"]) | ||
for service in groups["tracing"]: | ||
dc_resource(service, labels = ["tracing"]) | ||
for service in groups["core"]: | ||
dc_resource(service, labels = ["core"]) | ||
for service in groups["auth"]: | ||
dc_resource(service, labels = ["auth"]) |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
DEV_DIR="$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")" | ||
source "${DEV_DIR}/helpers/cli.sh" | ||
|
||
echo "Seeding some regtest blocks..." | ||
|
||
bitcoin_cli createwallet "outside" || true | ||
bitcoin_cli -generate 200 > /dev/null 2>&1 | ||
|
||
bitcoin_signer_cli createwallet "dev" || true | ||
bitcoin_signer_cli -rpcwallet=dev importdescriptors "$(cat ./config/bitcoind/bitcoind_signer_descriptors.json)" | ||
|
||
echo "Checking that bria is running..." | ||
|
||
for _ in {1..20}; do | ||
bria_cli wallet-balance -w dev-wallet && break | ||
sleep 1 | ||
done | ||
bria_cli wallet-balance -w dev-wallet || exit 1 | ||
|
||
echo "DONE" |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
set -x | ||
|
||
DEV_DIR="$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")" | ||
source "${DEV_DIR}/helpers/auth.sh" | ||
source "${DEV_DIR}/helpers/gql.sh" | ||
|
||
user_phone="+16505554350" | ||
email="test@galoy.com" | ||
|
||
auth_token="$(login_user "${user_phone}")" | ||
|
||
register_email_to_user "${auth_token}" "${email}" |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
DEV_DIR="$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")" | ||
source "${DEV_DIR}/helpers/cli.sh" | ||
|
||
hydra_client_name="${1}" | ||
redirect_uri="${2}" | ||
|
||
HYDRA_CLIENT_JSON="${DEV_DIR}/../.${hydra_client_name}-hydra-client.json" | ||
HYDRA_CLIENT_ENV="${DEV_DIR}/../.${hydra_client_name}-hydra-client.env" | ||
HYDRA_ADMIN_API="http://localhost:4445" | ||
HYDRA_PUBLIC_API="http://localhost:4444" | ||
|
||
hydra_cli create client \ | ||
--endpoint "${HYDRA_ADMIN_API}" \ | ||
--grant-type authorization_code,refresh_token \ | ||
--response-type code,id_token \ | ||
--format json \ | ||
--scope offline --scope transactions:read --scope payments:send \ | ||
--redirect-uri "$redirect_uri" > "${HYDRA_CLIENT_JSON}" | ||
|
||
CLIENT_ID=$(jq -r '.client_id' < "${HYDRA_CLIENT_JSON}") | ||
CLIENT_SECRET=$(jq -r '.client_secret' < "${HYDRA_CLIENT_JSON}") | ||
|
||
AUTHORIZATION_URL="${HYDRA_PUBLIC_API}/oauth2/auth?client_id=$CLIENT_ID&scope=offline%20transactions:read&response_type=code&redirect_uri=$redirect_uri&state=kfISr3GhH0rqheByU6A6hqIG_f14pCGkZLSCUTHnvlI" | ||
|
||
echo "export CLIENT_ID=$CLIENT_ID" > "${HYDRA_CLIENT_ENV}" | ||
echo "export CLIENT_SECRET=$CLIENT_SECRET" >> "${HYDRA_CLIENT_ENV}" | ||
echo "export AUTHORIZATION_URL=$AUTHORIZATION_URL" >> "${HYDRA_CLIENT_ENV}" | ||
|
||
mkdir -p "${DEV_DIR}/.envs" | ||
cp "${HYDRA_CLIENT_ENV}" "${DEV_DIR}/.envs/${hydra_client_name}.env" |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
rpcuser=rpcuser | ||
rpcpassword=rpcpassword | ||
debug=mempool | ||
debug=rpc | ||
server=1 | ||
txindex=1 | ||
printtoconsole=1 | ||
zmqpubrawtx=tcp://0.0.0.0:28333 | ||
zmqpubrawblock=tcp://0.0.0.0:28332 | ||
blockfilterindex=1 | ||
bind=0.0.0.0 | ||
fallbackfee=0.0002 | ||
rpcallowip=0.0.0.0/0 | ||
regtest=1 | ||
[regtest] | ||
bind=0.0.0.0 | ||
fallbackfee=0.0002 | ||
rpcallowip=0.0.0.0/0 | ||
rpcbind=0.0.0.0 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"active":true,"desc":"wpkh([6f2fa1b2/84'/0'/0']tprv8gXB88g1VCScmqPp8WcetpJPRxix24fRJJ6FniYCcCUEFMREDrCfwd34zWXPiY5MW2xp8e1Z6EeBrh74zMSgfQQmTorWtE1zyBtv7yxdcoa/0/*)#88k4937c","timestamp":0},{"active":true,"desc":"wpkh([6f2fa1b2/84'/0'/0']tprv8gXB88g1VCScmqPp8WcetpJPRxix24fRJJ6FniYCcCUEFMREDrCfwd34zWXPiY5MW2xp8e1Z6EeBrh74zMSgfQQmTorWtE1zyBtv7yxdcoa/1/*)#knn5cywq","internal":true,"timestamp":0}] |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
app: | ||
blockchain: | ||
network: regtest | ||
electrum_url: fulcrum:50001 | ||
tracing: | ||
host: "otel-agent" | ||
port: 4318 | ||
service_name: "bria-dev" |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
bitcoind = bitcoind:18443 | ||
rpcuser = rpcuser | ||
rpcpassword = rpcpassword | ||
peering = false | ||
announce = false | ||
tcp = 0.0.0.0:50001 | ||
ssl = 0.0.0.0:50002 |
Oops, something went wrong.