tf: Replace localhost with 127.0.0.1 to avoid ipv6

After recent upgrades, the charge environment was interpreting localhost
as an ipv6 address (resolving to ::1) and callback requests were
failing. To avoid this and other potential problems, replace localhost
occurrences with 127.0.0.1 to ensure ipv4.
This commit is contained in:
Blockstream Satellite 2023-10-13 12:36:37 -03:00
parent 40881a01e1
commit befb1cc89d
3 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ services:
- blc
environment:
- CHARGE_ROOT=http://api-token:mySecretToken@blc:9112
- CALLBACK_URI_ROOT=http://localhost:9292
- CALLBACK_URI_ROOT=http://127.0.0.1:9292
- CHARGE_API_TOKEN=mySecretToken
- ENV=development
- REDIS_URI=redis://redis:6379

View File

@ -41,12 +41,12 @@ DEFAULT_TX_CONFIRM_TIMEOUT_SECS = 60
SERVER_PORT = 9292
CALLBACK_URI_ROOT = os.getenv('CALLBACK_URI_ROOT',
"http://localhost:{}".format(SERVER_PORT))
"http://127.0.0.1:{}".format(SERVER_PORT))
CHARGE_API_TOKEN = os.getenv('CHARGE_API_TOKEN', str(uuid.uuid4()))
LIGHTNING_WEBHOOK_KEY = hmac_sha256_digest('charged-token', CHARGE_API_TOKEN)
CHARGE_ROOT = os.getenv('CHARGE_ROOT',
f'http://api-token:{CHARGE_API_TOKEN}@localhost:9112')
f'http://api-token:{CHARGE_API_TOKEN}@127.0.0.1:9112')
CONNECTION_TIMEOUT = 2
DB_FILE = db_conf[env]['database']
DB_ROOT = os.path.dirname(DB_FILE)

View File

@ -248,11 +248,11 @@ write_files:
--log-opt max-file=3 \
-v /mnt/disks/data/satellite-api:/data \
-e "ENV=production" \
-e "CHARGE_ROOT=http://api-token:${charge_token}@localhost:9112" \
-e "CALLBACK_URI_ROOT=http://localhost:9292" \
-e "CHARGE_ROOT=http://api-token:${charge_token}@127.0.0.1:9112" \
-e "CALLBACK_URI_ROOT=http://127.0.0.1:9292" \
-e "CHARGE_API_TOKEN=${charge_token}" \
-e "MIN_PER_BYTE_BID=1" \
-e "REDIS_URI=redis://localhost:6379" \
-e "REDIS_URI=redis://127.0.0.1:6379" \
"${sat_api_docker}"
ExecStop=/usr/bin/docker stop api-server
ExecStopPost=/usr/bin/docker rm api-server
@ -279,7 +279,7 @@ write_files:
--pid=host \
--name=sse-server \
-e "SUB_CHANNELS=transmissions,gossip,btc-src,auth" \
-e "REDIS_URI=redis://localhost:6379" \
-e "REDIS_URI=redis://127.0.0.1:6379" \
"${sat_api_sse_docker}"
ExecStop=/usr/bin/docker stop sse-server
ExecStopPost=/usr/bin/docker rm sse-server
@ -304,7 +304,7 @@ write_files:
--name=api-workers \
-v /mnt/disks/data/satellite-api:/data \
-e ENV="production" \
-e "REDIS_URI=redis://localhost:6379" \
-e "REDIS_URI=redis://127.0.0.1:6379" \
"${sat_api_docker}" workers.sh
ExecStop=/usr/bin/docker stop api-workers
ExecStopPost=/usr/bin/docker rm api-workers