Skip to content

Commit

Permalink
Merge pull request #1137 from Chia-Network/develop
Browse files Browse the repository at this point in the history
Release 1.7.17
  • Loading branch information
TheLastCicada authored Aug 16, 2024
2 parents fe97f44 + 62f1c1b commit ec48c37
Show file tree
Hide file tree
Showing 25 changed files with 3,481 additions and 1,388 deletions.
8 changes: 5 additions & 3 deletions .babelrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ const jsConfig = require('./jsconfig.json');
module.exports = {
include: [/src/, /node_modules/],
presets: ['@babel/preset-env'],
targets: {
node: "20.16"
},
plugins: [
[
'@babel/plugin-syntax-import-attributes',
['@babel/plugin-syntax-import-attributes',
{
deprecatedAssertSyntax: true,
},
Expand All @@ -16,6 +18,6 @@ module.exports = {
{
root: [path.resolve(jsConfig.compilerOptions.baseUrl)],
},
],
]
],
};
25 changes: 0 additions & 25 deletions .eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node 18.x
- name: Setup Node 20.x
uses: actions/setup-node@v3
with:
node-version: '18.16'
node-version: '20.16'

- name: Install Husky
run: npm install --save-dev husky
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
- name: Build arm 64 dist
run: |
mkdir pkgcache
docker run --rm --platform linux/arm64 -v $(pwd):/app -w /app -e PKG_CACHE_PATH=pkgcache node:18.16 /bin/bash -c "npm pkg delete scripts.prepare && npm install && npm i -g @babel/cli @babel/preset-env pkg && npm run create-linux-arm64-dist"
docker run --rm --platform linux/arm64 -v $(pwd):/app -w /app -e PKG_CACHE_PATH=pkgcache node:20.16 /bin/bash -c "npm pkg delete scripts.prepare && npm install && npm i -g @babel/cli @babel/preset-env pkg && npm run create-linux-arm64-dist"
- name: Copy sqlite3
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: NPM Tests
runs-on: ubuntu-latest
container:
image: node:18.16
image: node:20.16

steps:
- uses: Chia-Network/actions/clean-workspace@main
Expand Down
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.16
20.16
4 changes: 4 additions & 0 deletions .repo-content-updater.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pr_target_branch: develop
assign_users:
- TheLastCicada
commit_prefix: "chore: "
59 changes: 49 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ The CADT application is designed to run 24/7, much like any other API. While it

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).

For Chia installation instructions, 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).
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).

After the initial installation, it will take anywhere from a few days (most likely for a cloud-hosted server) to a few weeks (possible on lower-powered systems or servers with slow connections) to sync the Chia full node. During this time, CADT can start syncing, but any writes to CADT are likely to fail. For best results, we recommend waiting for the Chia full node to finish syncing before using CADT. Check the status of the full node sync with `chia show -s`.

*Those familiar with bittorrent and have a fast connection can speed up the full node syncing by [downloading the database](https://www.chia.net/downloads/#database-checkpoint) and copying it into place manually*

### How to use the API

Expand All @@ -38,9 +42,9 @@ ARM and x86 systems are supported. While Windows, MacOS, and all versions of Li

A binary file that can run on all Linux distributions on x86 hardware can be found for each tagged release named `cadt-linux-x64-<version>.zip`. This zip file will extract to the `cadt-linux-64` directory by default, where the `cadt` file can be executed to run the API.

#### Debian-based Linux Distros (Ubuntu, Mint, etc)
#### Recommended Method: APT on Debian-based Linux Distros (Ubuntu, Mint, etc)

The CADT API can be installed with `apt`. Both ARM and x86 versions can be installed this way.
The CADT API and the Chia Blockchain software can be installed with `apt`. Both ARM and x86 versions can be installed this way.

1. Start by updating apt and allowing repository download over HTTPS:

Expand All @@ -55,38 +59,73 @@ sudo apt-get install ca-certificates curl gnupg
curl -sL https://repo.chia.net/FD39E6D3.pubkey.asc | sudo gpg --dearmor -o /usr/share/keyrings/chia.gpg
```

3. Use the following command to set up the repository.
3. Use the following command to set up the CADT repository.

```
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/chia.gpg] https://repo.chia.net/cadt/debian/ stable main" | sudo tee /etc/apt/sources.list.d/cadt.list > /dev/null
```

4. Install CADT
4. Add the Chia repository (via the [official Chia installation instructions](https://docs.chia.net/installation/#using-the-cli))

```
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/chia.gpg] https://repo.chia.net/debian/ stable main" | sudo tee /etc/apt/sources.list.d/chia.list > /dev/null
```

5. Install Chia CLI and CADT

```
sudo apt-get update
sudo apt-get install cadt
sudo apt-get install chia-blockchain-cli cadt
```

6. Start Chia Wallet and Datalayer with [systemd](https://docs.chia.net/installation/#systemd)

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

For `<USERNAME>`, enter the user that Chia runs as (the user with the `.chia` directory in their home directory). For example, if the `ubuntu` is where Chia runs, start Chia with `systemctl start chia-wallet@ubuntu`.

Optional: If using Chia's built-in HTTP server to share datalayer files, start the `chia-data-layer-http` service with

```
sudo systemctl start chia-data-layer-http@<USERNAME>
```

5. Start CADT with systemd
7. Start CADT with systemd

```
sudo systemctl start cadt@<USERNAME>
```
For `<USERNAME>`, enter the user that Chia runs as (the user with the `.chia` directory in their home directory). For example, if the `ubuntu` is where Chia runs, start CADT with `systemctl start cadt@ubuntu`.

6. Set CADT to run at boot
8. Set Chia and CADT to run at boot

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

If using the built-in HTTP server for datalayer, start it at boot with

```
sudo systemctl enable chia-data-layer-http@<USERNAME>
```

10. View CADT logs to validate

```
sudo systemctl enable cadt@<USERNAME>
journalctl -u cadt@<USERNAME> -f
(ctrl+c to exit)
```

### Installation from Source

*Installation from source is only recommended for those contributing code to CADT and is not intended to be used in production.*

You'll need:
- Git
- [nvm](https://github.com/nvm-sh/nvm) - This app uses `nvm` to align node versions across development, CI and production. If you're working on Windows, you should consider [nvm-windows](https://github.com/coreybutler/nvm-windows)
- A working [Chia installation](https://docs.chia.net/installation/#using-the-cli) running wallet and datalayer (full node recommended)

To install from source:

Expand Down
15 changes: 0 additions & 15 deletions babel.config.json

This file was deleted.

23 changes: 23 additions & 0 deletions change-build-package-type-commonjs.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const fs = require('fs');
const path = require('path');

const packageJsonPath = path.resolve(__dirname, './build/package.json');

fs.readFile(packageJsonPath, 'utf8', (err, data) => {
if (err) {
console.error('Error reading package.json:', err);
process.exit(1);
}

const packageJson = JSON.parse(data);
packageJson.type = 'commonjs';

fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8', (err) => {
if (err) {
console.error('Error writing package.json:', err);
process.exit(1);
}

console.log('build package.json type updated to commonjs');
});
});
50 changes: 50 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import mocha from "eslint-plugin-mocha";
import es from "eslint-plugin-es";
import globals from "globals";
import babelParser from "@babel/eslint-parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends("eslint:recommended", "plugin:mocha/recommended"), {
plugins: {
mocha,
es,
},

languageOptions: {
globals: {
...globals.commonjs,
...globals.node,
},

parser: babelParser,
ecmaVersion: 13,
sourceType: "module",

parserOptions: {
requireConfigFile: false,
},
},

settings: {
es: {
deprecatedAssertSyntax: true,
allowImportExportEverywhere: true,
importAssertions: true,
},
},

rules: {
"es/no-dynamic-import": "error",
},
}];
Loading

0 comments on commit ec48c37

Please sign in to comment.