Commit graph

193 commits

Author SHA1 Message Date
nitramiz
b4ccd902d3 TF: make staging deploys proactive/prod opportunistic + don't create tor backend service on staging 2022-01-06 09:18:30 -08:00
nitramiz
ead897b77c TF: update tor + clightning
turn on chunked_transfer_encoding on the LB for SSE subscribers
2022-01-06 08:16:30 -08:00
nitramiz
f84e11fa85 TF: fix hidden service 2022-01-05 13:09:53 -08:00
Blockstream Satellite
99a5784a0a tf: Fix API workers service with old daemon script
The former daemon.sh script was replaced by the workers.sh script in
2cfc398. Update on the terraform setup and also rename the service now
that it no longer consists of only Tx-related daemon workers.
2022-01-05 16:45:45 -03:00
Blockstream Satellite
76a51eec52 Add missing blank lines around class methods
This verification was added on yapf 0.32 and it follows the pep8
specification.
2021-12-28 12:22:58 -03:00
Blockstream Satellite
da31d10916 Fix error dictionary returned as string
Flask-RESTful returns a JSON response by default when returning a
dictionary. It's not necessary to dump the returning dictionary into a
JSON-serialized string. Otherwise, the client will see a string response
instead of a JSON response.
2021-12-28 11:27:25 -03:00
Blockstream Satellite
1363a3a739 Prevent order bumping if not in pending/paid state
Bumping the bid would be useless if the order is already in the
transmitting, sent, or received states. Hence, prevent such requests.
2021-12-28 10:01:04 -03:00
Blockstream Satellite
8c91e11cca Remove chunked transfer encoding from nginx conf
This configuration was leading to long delays when receiving SSE
notifications with the demo-rx app.
2021-12-28 10:01:04 -03:00
Blockstream Satellite
f8dfa44c73 Remove pending orders from list of queued orders
An order is only "queued for transmission" after leaving the
pending (payment pending) state.
2021-12-28 10:01:04 -03:00
Blockstream Satellite
5882fddc49 Support retransmission of unconfirmed orders
This change implements a mechanism to retransmit orders if some of the
order's selected regions do not confirm transmission in due time. It
adds a worker to repeatedly check the orders and determine if they need
retransmission. Such orders will be added to a new table named
tx_retries. The tx_start function now first checks if there are regular
new paid orders to transmit. If not, it will check the retransmission
table and retransmit an order from there if one is available.

This patch also introduces a new order state called "retranmission". The
order enters this state while waiting for retransmission.
2021-12-28 10:01:04 -03:00
Blockstream Satellite
21ee2f212b Support API transmissions over selected regions
Users can provide a list of regions to POST /order requests. This list
indicates on which regions the order should be transmitted. It also
determines the expected transmission and reception confirmations.
2021-12-27 12:16:25 -03:00
Blockstream Satellite
2cfc39804e Remove tx loop and rely on tx confirmations
This change removes the infinite transmission loop with sleep periods
between each transmission. Now, a new transmission can start by a call
to "tx_start" on the following two conditions:

1) As soon as the application starts (if there is a previously paid
   order waiting already).
2) As soon as the current transmission ends. The server will immediately
   look for the next order ready for transmission and start it if
   available.

Meanwhile, the condition for ending the current transmission (i.e., for
calling "tx_end(order)") is when all Tx confirmations are received from
all regions.
2021-12-27 12:16:25 -03:00
nitramiz
0fc668d490 tf: update check-containers.sh 2021-09-24 07:48:03 -07:00
nitramiz
71ca226f6b tf: disable google-logging 2021-09-24 07:36:32 -07:00
nitramiz
6b6448437e tf: update prometheus instance 2021-09-02 08:30:19 -07:00
Blockstream Satellite
b45faeb54a Bump SSE server dependencies
- Update the node 16 image.
- Update dependencies to their latest versions.
- Update package lock file.
2021-07-22 10:18:15 -03:00
Blockstream Satellite
ef8b74e454 Add status badge for unit tests 2021-07-22 09:32:41 -03:00
Blockstream Satellite
e6cd148bc6 Support auth_token given as query string parameter 2021-07-21 14:43:44 -03:00
nitramiz
19a5e08e91 CI: add build job for tags; TF: cleanup 2021-07-21 10:34:58 -07:00
Blockstream Satellite
876c6de170 Fix line break on invoice callback URL 2021-07-21 13:52:45 -03:00
nitramiz
b6f14cbf73 CI: don't run test job on tags 2021-07-21 06:14:25 -07:00
Blockstream Satellite
69b97e9eae Randomize charge api token's getenv fallback value
If the env var is not defined, fall back to a random string. However,
note the random string won't work over gunicorn if using multiple
workers. In this case, it is necessary to define the env var.
2021-07-20 15:05:11 -03:00
nitramiz
608e61692a TF: update check_containers alert 2021-07-20 08:58:03 -07:00
nitramiz
ebe74cb80a CI: remove redundant plan_satapi job 2021-07-20 12:28:49 -03:00
nitramiz
c0c904d7ff TF: move iptables 4500 rule to correct service 2021-07-20 12:28:49 -03:00
nitramiz
ff1081033c TF: rename the tx-daemon and sse services 2021-07-20 12:28:49 -03:00
Blockstream Satellite
095034b7dd TF: Review the api-server and charge service order 2021-07-20 12:28:49 -03:00
nitramiz
a110135f6d CI job nits 2021-07-20 12:28:49 -03:00
nitramiz
a89d2f3e70 TF: systemd services nits 2021-07-20 12:28:49 -03:00
nitramiz
9d8f4f16eb CI: update job trigger rules 2021-07-20 12:28:49 -03:00
Blockstream Satellite
a6e5102641 TF: change lightningd prom metrics iptables port 2021-07-20 12:28:49 -03:00
Blockstream Satellite
4cf05d45f0 TF: make api-server PROACTIVE 2021-07-20 12:28:49 -03:00
nitramiz
79eb73f223 CI: manual image builds on all branches 2021-07-20 12:28:49 -03:00
nitramiz
5860c65540 CI: GCR docker auth; rename ionosphere to api-server
TF: add CI service account; add REDIS_URI to services
2021-07-20 12:28:49 -03:00
Blockstream Satellite
7f6d4b3a6b CI: Review CI to allow deployment from any branch
- If a staging_/prod_/misc_ tag is present, or if merging to master,
  push the Satellite API image upstream.

- Tag images with the commit SHA and the commit ref slug (.e.g, branch
  name) for caching. Tag with latest if merging to master.

- Deploy the image specified by commit SHA.
2021-07-20 12:28:49 -03:00
Blockstream Satellite
fd36995b66 CI: Push Docker images to gcloud registry 2021-07-20 12:28:42 -03:00
Blockstream Satellite
afbd02f759 TF: prepare staging 2021-07-20 12:28:28 -03:00
Blockstream Satellite
be67323a24 CI/TF: Updates for python-ported version 2021-07-20 12:28:28 -03:00
Blockstream Satellite
3d7a5b764d Add expired invoice error and rename paid error
- Add new error: INVOICE_ALREADY_EXPIRED.
- Rename ORDER_ALREADY_PAID to INVOICE_ALREADY_PAID.
2021-07-20 12:28:08 -03:00
Blockstream Satellite
90f7c12783 Remove unused/obsolete API error codes
The new server implementation in Python implements request validation
using the Marshamallow package. With that, some requests are validated
directly by the marshmallow validator and do not return custom error
codes. Drop those error codes and other unused ones. Review the README
docs accordingly.
2021-07-20 12:28:08 -03:00
Blockstream Satellite
24a4c5ccb7 Do not round the order's bid_per_byte value
Store the fractional value on the db. Let the frontend round if
necessary but keep it non-rounded on the backend.
2021-07-20 12:28:08 -03:00
Blockstream Satellite
1568ee54f2 Add a new error code for fetching info
Return a json response with a custom error code like most other API
endpoints.
2021-07-20 12:28:08 -03:00
Blockstream Satellite
d8e7516f01 Add date filter and paging on all orders/ states
- Add date filtering (before parameter) to /queued.
- Add page limit to /sent and /pending.
2021-07-20 12:28:08 -03:00
Blockstream Satellite
9d421771e7 Port the satellite API to python
- Preserve the SQLite database and use SQLAlchemy to wrap db
  interactions.
- Use Alembic for database migrations.
- Organize all the python modules on the new server/ directory.
- Use pytest for unit tests and organize test modules at server/tests/.
2021-07-20 12:28:08 -03:00
Blockstream Satellite
8a332afcb0 TF: cleanup unused postgres service 2021-07-20 12:28:08 -03:00
Blockstream Satellite
825d04b651 CI: remove testnet_staging jobs 2021-07-20 12:28:08 -03:00
nitramiz
0dbeb9feab CI: terraform 0.14.5 2021-03-29 08:34:55 -07:00
nitramiz
417b52ad5e
update lightningd to 0.9.3
remove LB autoscaler
2021-03-29 08:10:23 -07:00
nitramiz
905e7e6a87
CI: update misc jobs 2021-02-23 07:33:03 -08:00
nitramiz
a4281072b6 update DNS; output LB's internal IP 2021-02-23 07:23:07 -08:00