Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.7.18 #1188

Merged
merged 48 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
10e8854
chore: Updating npm dev dependencies
ChiaAutomation Aug 16, 2024
b5c863c
feat: added sync registries logging
wwills2 Sep 18, 2024
473b590
feat: converted logger to ES module for use with config-loader
wwills2 Sep 18, 2024
70a06ea
Update package.json
wwills2 Sep 18, 2024
6d95bab
feat: sql logging hashes queries
wwills2 Sep 19, 2024
c965a53
feat: additional logging
wwills2 Sep 19, 2024
b8e2529
feat: check to reset org generations if cadt is ahead of DL
wwills2 Sep 20, 2024
288c7c6
Merge pull request #1172 from Chia-Network/debug-logging
wwills2 Sep 20, 2024
fc80ccd
Update README.md
erickch123 Sep 22, 2024
0408228
feat: minor logging improvements
wwills2 Sep 23, 2024
dac58bc
Use GitHub Glue Action instead of curl
Starttoaster Sep 24, 2024
1ab230b
Merge pull request #1185 from Chia-Network/glue
TheLastCicada Sep 24, 2024
0f14b1d
feat: minor logging improvements
wwills2 Sep 23, 2024
57b2b0f
Merge remote-tracking branch 'origin/fix/reorg-negative-generations' …
wwills2 Sep 24, 2024
a89fcdd
feat: added query logger
wwills2 Sep 24, 2024
906e5e0
Merge pull request #1178 from erickch123/develop
TheLastCicada Sep 24, 2024
b6c0b4c
feat: added task to check subscriptions and resubscribe to missing or…
wwills2 Oct 3, 2024
93cfeea
feat: added task to check subscriptions and resubscribe to missing or…
wwills2 Oct 3, 2024
05db6c3
Merge remote-tracking branch 'origin/org-table-auto-resubscription' i…
wwills2 Oct 3, 2024
0d428de
Merge pull request #1175 from Chia-Network/fix/reorg-negative-generat…
wwills2 Oct 3, 2024
da42348
feat: named organization in log output
wwills2 Oct 3, 2024
aef3a42
feat: added migration task checks
wwills2 Oct 3, 2024
d8fcf7b
Merge pull request #1187 from Chia-Network/org-table-auto-resubscription
wwills2 Oct 3, 2024
b3e8fe9
chore: version bump
TheLastCicada Oct 4, 2024
ac9b560
Merge pull request #1189 from Chia-Network/1718
TheLastCicada Oct 4, 2024
a37775c
feat: sync-registries task refinements
wwills2 Oct 8, 2024
2e8b8f0
feat: sync-registries task refinements
wwills2 Oct 9, 2024
293bf14
fix: failing tests due to zero vs one based generation count mismatch
wwills2 Oct 9, 2024
ca8d15c
fix: failing tests due to zero vs one based generation count mismatch
wwills2 Oct 9, 2024
c379f3c
Merge remote-tracking branch 'origin/fix-failing-tests' into fix-fail…
wwills2 Oct 10, 2024
c2c3192
docs: add testneta instructions
TheLastCicada Oct 11, 2024
4ddb32d
docs: how to setup testneta
TheLastCicada Oct 11, 2024
0133ac5
docs: document new log levels
TheLastCicada Oct 11, 2024
711d792
docs: improved testneta docs
TheLastCicada Oct 11, 2024
57a004d
ci: test environment improvements
TheLastCicada Oct 11, 2024
f0cf847
feat: added simulator check to getSyncStatus
wwills2 Oct 15, 2024
51cff85
Merge remote-tracking branch 'origin/fix-failing-tests' into fix-fail…
wwills2 Oct 15, 2024
317eff3
Merge pull request #1194 from Chia-Network/fix-failing-tests
wwills2 Oct 15, 2024
c4a1e0b
Merge pull request #1195 from Chia-Network/chia-tools
TheLastCicada Oct 15, 2024
c7d57bf
fix: registry sync stopping pre-maturely
wwills2 Oct 16, 2024
a78a6cb
fix: improve log messages to include registryId for easier debugging
TheLastCicada Oct 16, 2024
43dc5e3
Merge pull request #1196 from Chia-Network/improve-logging-id-stuff
TheLastCicada Oct 16, 2024
6093019
fix: a few more logging improvments
TheLastCicada Oct 16, 2024
cf8118a
Merge pull request #1197 from Chia-Network/more-logging-ids
TheLastCicada Oct 16, 2024
d8ef2dd
docs: document serving datalayer dat files
TheLastCicada Oct 17, 2024
042a356
docs: document serving datalayer dat files improvements
TheLastCicada Oct 18, 2024
4ec2af8
docs: more clarity about static IP addresses
TheLastCicada Oct 18, 2024
8c8e345
Merge pull request #1198 from Chia-Network/s3-http-docs
TheLastCicada Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ jobs:
cadt-linux-x64-deb/*.deb
cadt-linux-arm64-deb/*.deb

- name: Gets JWT Token from GitHub
uses: Chia-Network/actions/github/jwt@main

- name: Trigger apt repo update
run: |
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"cadt_repo":"cadt","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/start
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"cadt_repo":"cadt","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/cadt/${{ github.sha }}/success/deploy
uses: Chia-Network/actions/github/glue@main
with:
json_data: '{"cadt_repo":"cadt","release_version":"${{ steps.tag-name.outputs.TAGNAME }}"}'
glue_url: ${{ secrets.GLUE_API_URL }}
glue_project: "cadt"
glue_path: "trigger"
3 changes: 3 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@ jobs:
- name: install global packages
run: npm i -g @babel/cli sequelize-cli cross-env

- name: Show home directory
run: ls -lah ~

- name: npm tests
run: npm run test
73 changes: 70 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This project was formerly known as the Climate Warehouse, and you may see this t

The CADT application is designed to run 24/7, much like any other API. While it is possible to run it on-demand only when API requests need to be made, this guide assumes a permanently running solution.

The simplest way to run the CADT application is to use the same machine the Chia Full Node, Wallet, Datalayer, and Datalayer HTTP services reside on. CADT communicates with the Chia services over an RPC interface. The RPC interface uses certificates to authenticate, which will work automatically when the CADT application is run as the same user on the same machine as the Chia services. To run CADT on a separate machine from Chia, a public certificate from the Chia node must be used to authenticate (not yet documented).
The simplest way to run the CADT application is to use the same machine the Chia Full Node, Wallet, Datalayer, and Datalayer-HTTP services reside on. CADT communicates with the Chia services over an RPC interface. The RPC interface uses certificates to authenticate, which will work automatically when the CADT application is run as the same user on the same machine as the Chia services. To run CADT on a separate machine from Chia, a public certificate from the Chia node must be used to authenticate (not yet documented).

Basic Chia installation instructions are provided below, but further installation options, please see the [Chia docs site](https://docs.chia.net/installation/). For most CADT setups, we recommend the installing the headless `chia-blockchain-cli` package via the `apt` repo and using [systemd](https://docs.chia.net/installation/#systemd).

Expand Down Expand Up @@ -132,11 +132,77 @@ To install from source:
```
git clone [email protected]:Chia-Network/cadt.git
cd cadt
nvm install 18.16
nvm use 18.16
nvm install 20.16
nvm use 20.16
npm run start
```

### Datalayer HTTP File Serving

CADT relies on all participants publicly sharing their data over Chia Datalayer, which includes sharing the Chia-generated `.dat` files over HTTP. The files are located in `~/.chia/mainnet/data_layer/db/server_files_location_<NETWORK>/` (where `<NETWORK>` is the Chia network, usually either "mainnet" or "testneta") and can be shared over any web-accessible HTTP endpoint, including

* Using the built-in datalayer-http service (see [Installation](#installation) instructions below). Datalayer-http runs on port 8575 by default which may need to be opened in your firewall configuration or forwarded by your router. Additionally, a static IP address will be required, which is not offered by default on some hosting providers. On AWS, assign an Elastic IP to the EC2 instance or use an Application Load Balancer to solve this.

* Using Nginx, Apache, Caddy, or any other web server. This also requires a static IP address, or dynamically assigned DNS record. Another challenge is that the default location for the .dat files is in the user's home directory, which the web server software will not have read-access to. One simple solution is
* `mv ~/.chia/mainnet/data_layer/db/server_files_location_<NETWORK> /var/www/` - move the datalayer file directory outside of the home directory
* `chmod -R 744 /var/www/server_files_location_<NETWORK>` - change permissions on all datalayer files to be read by any user
* `ln -s /var/www/server_files_location_<NETWORK> ~/.chia/mainnet/data_layer/db/server_files_location_<NETWORK>` - create a shortcut from the old location to the new
* Use [Nginx](https://nginx.org/), [Apache](https://httpd.apache.org/), [Caddy](https://caddyserver.com/), or any web server to serve the files over HTTP. Here is a sample Nginx config:

```
server {
listen 80;

root /var/www/server_files_location_<NETWORK>;

server_name datalayer.example.com;

index index.html;

expires 30d;
add_header Pragma "public";
add_header Cache-Control "public";

}
```

* Use [S3](https://aws.amazon.com/s3/) or other object store. Datalayer .dat files can be synced to any cloud file storage solution that can serve them publicly over HTTP. One recommended solution using S3 is to [use this script and follow the installation and usage instructions in the README](https://github.com/TheLastCicada/Chia-Datalayer-S3-Sync).



### Run CADT on a Testnet

Chia has a few test networks called "[testnets](https://docs.chia.net/testnets/)". Testnets allow anyone to test applications using plentiful and low value TXCH instead of needing to purchace XCH. We recommend running a testnet version of CADT in order to test integrations, software updates, and experiment in a low-stakes environment.

CADT runs on a testnet called "testnetA" which is different than the main Chia testnet, testnet11. TestnetA has a CADT governance node and an [observer](https://chia-cadt-demo.chiamanaged.com/). To configure your Chia and CADT environment to use testnetA, do the following:

*Note - these instructions only work with Chia version 2.4.4 and above*

1. Follow the [instructions here and install chia-tools](https://github.com/chia-network/chia-tools?tab=readme-ov-file#apt-repo-installation).

2. Use chia-tools to switch to testneta in the Chia config

`chia-tools network switch testneta`

3. Restart Chia

`sudo systemctl restart chia-wallet@<USERNAME> chia-data-layer@<USERNAME> chia-full-node@<USERNAME>`

4. Stop CADT

`sudo systemctl stop cadt@<USERNAME>`

4. Update the `GOVERNANCE_BODY_ID` in `~/.chia/mainnet/cadt/v1/config.yaml` to be `1019153f631bb82e7fc4984dc1f0f2af9e95a7c29df743f7b4dcc2b975857409`

5. If you already were running CADT on mainnet, delete the CADT database

`rm ~/.chia/mainnet/cadt/v1/data.sqlite3*`

6. Start CADT

`sudo systemctl start cadt@<USERNAME>`


### Ports, Networking, and Security

By default, the CADT API will listen on localhost only on port 31310. If running a node with `READ_ONLY` set to `false`, it is highly recommended that CADT is run on a private network or with access limited by IP address. To allow remote connections to CADT, set the `BIND_ADDRESS` (see the [Configuration](#configuration) section below) to the IP to listen on, or `0.0.0.0` to listen on all interfaces. The port for the CADT API can be set with the parameter `CW_PORT`. The default port is 31310. In many cases, users will need to access the API from their workstations for either the [CADT UI](https://github.com/Chia-Network/climate-warehouse-ui) or to integrate with existing tools and scripts. To add authentication to the API, use the `CADT_API_KEY` parameter. Alternatively, the API can be served behind an authentication proxy to restrict access and the `CADT_API_KEY` can be left blank. If running an observer node with `READ_ONLY` set to `true`, the CADT API will only share data from the public blockchain, and running without authentication is usually safe. If `READ_ONLY` is set to `false`, authentication must be used to prevent unauthorized writes to the blockchain.
Expand All @@ -156,6 +222,7 @@ In the `CHIA_ROOT` directory (usually `~/.chia/mainnet` on Linux), CADT will add
* **DB_HOST**: Hostname of the MySQL database
* **APP**: This section is for configuring the CADT application.
* **CW_PORT**: CADT port where the API will be available. 31310 by default.
* **LOG_LEVEL**: Controls verbosity of logging. Common settings are `info` and `debug`. Setting to `silly` will log all queries.
* **BIND_ADDRESS**: By default, CADT listens on localhost only. To enable remote connections to CADT, change this to `0.0.0.0` to listen on all network interfaces, or to an IP address to listen on a specific network interface.
* **DATALAYER_URL**: URL and port to connect to the [Chia DataLayer RPC](https://docs.chia.net/datalayer-rpc). If Chia is installed locally with default settings, https://localhost:8562 will work.
* **WALLET_URL**: URL and port to connect to the [Chia Wallet RPC](https://docs.chia.net/wallet-rpc). If Chia is installed on the same machine as CADT with default settings, https://localhost:9256 will work.
Expand Down
Loading
Loading