Skip to content

Commit

Permalink
feat: migrate server to dedicated repo
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 8, 2024
1 parent 7f81e2d commit 16b7a60
Show file tree
Hide file tree
Showing 36 changed files with 7,899 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.dig
dist
dig.config.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.16
256 changes: 256 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.0.0](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.49...v1.0.0) (2024-09-06)


### Features

* add auto melt server coin ([a63713f](https://github.com/Datalayer-Storage/dig-cli/commit/a63713f394079f1608e44e87f6e11b047eada716))
* create Wallet class ([60f0697](https://github.com/Datalayer-Storage/dig-cli/commit/60f06977a06a8a9473b76711f615d3b2e6e05570))
* refactor to Dig classes ([d973d0b](https://github.com/Datalayer-Storage/dig-cli/commit/d973d0baf1f9208a5ce022fa4d31083920181ec5))
* set up incentives module ([85104a4](https://github.com/Datalayer-Storage/dig-cli/commit/85104a45d60f0b4a558cce9e46050ae8b0fabc86))
* upgrade datalayer-driver ([62e9f46](https://github.com/Datalayer-Storage/dig-cli/commit/62e9f4653b2d9ac759f85035b34e7f554627a6bd))

### [0.0.49](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.48...v0.0.49) (2024-08-30)


### Bug Fixes

* cmd tree in yargs ([e1e416e](https://github.com/Datalayer-Storage/dig-cli/commit/e1e416ec1cbe4c29fe6442ed70edd014e9bec2a4))

### [0.0.48](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.47...v0.0.48) (2024-08-30)


### Bug Fixes

* cmd tree in yargs ([0add73a](https://github.com/Datalayer-Storage/dig-cli/commit/0add73ac120bdd632b5438474899ff626fb1175c))

### [0.0.47](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.46...v0.0.47) (2024-08-30)


### Bug Fixes

* cmd tree in yargs ([6c236fb](https://github.com/Datalayer-Storage/dig-cli/commit/6c236fb64967fc48865c05c7fa18476a96d65a0a))

### [0.0.46](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.45...v0.0.46) (2024-08-30)


### Bug Fixes

* cmd tree in yargs ([89cf1fa](https://github.com/Datalayer-Storage/dig-cli/commit/89cf1fa580798c0a7d59c81acb30f0cc26c313cc))

### [0.0.45](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.44...v0.0.45) (2024-08-30)


### Bug Fixes

* yargs parsing ([968a0ef](https://github.com/Datalayer-Storage/dig-cli/commit/968a0ef65d322fc281fa52b537fd3f18f9d23a81))

### [0.0.44](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.43...v0.0.44) (2024-08-29)


### Features

* content server improvements ([b69e241](https://github.com/Datalayer-Storage/dig-cli/commit/b69e24161b00614e94d9f5d647e0b24eda86feb6))

### [0.0.43](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.42...v0.0.43) (2024-08-27)

### [0.0.42](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.41...v0.0.42) (2024-08-27)

### [0.0.41](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.40...v0.0.41) (2024-08-26)

### [0.0.40](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.39...v0.0.40) (2024-08-26)

### [0.0.39](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.38...v0.0.39) (2024-08-26)

### [0.0.38](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.37...v0.0.38) (2024-08-26)

### [0.0.37](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.36...v0.0.37) (2024-08-26)

### [0.0.36](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.35...v0.0.36) (2024-08-26)

### [0.0.35](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.34...v0.0.35) (2024-08-26)

### [0.0.34](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.33...v0.0.34) (2024-08-26)

### [0.0.33](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.32...v0.0.33) (2024-08-26)

### [0.0.32](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.31...v0.0.32) (2024-08-26)

### [0.0.31](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.30...v0.0.31) (2024-08-26)

### [0.0.30](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.29...v0.0.30) (2024-08-26)

### [0.0.29](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.28...v0.0.29) (2024-08-26)

### [0.0.28](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.27...v0.0.28) (2024-08-26)


### Features

* remote seed management ([3bb8ad5](https://github.com/Datalayer-Storage/dig-cli/commit/3bb8ad520c6c560a84e80bc596015412da741062))

### [0.0.27](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.26...v0.0.27) (2024-08-26)


### Features

* add peer timeout logic ([fb4e209](https://github.com/Datalayer-Storage/dig-cli/commit/fb4e209e2ecef812a94b902ef652400f0e005f19))

### [0.0.26](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.25...v0.0.26) (2024-08-26)


### Features

* add peer timeout logic ([48c4d4f](https://github.com/Datalayer-Storage/dig-cli/commit/48c4d4f7fc1a85883ae590e51f512b215267932c))

### [0.0.25](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.24...v0.0.25) (2024-08-26)


### Features

* add peer timeout logic ([f1865f2](https://github.com/Datalayer-Storage/dig-cli/commit/f1865f24a020e162bd13f1980e1db81cb0679be4))

### [0.0.24](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.23...v0.0.24) (2024-08-26)


### Features

* add keyring ([672a57f](https://github.com/Datalayer-Storage/dig-cli/commit/672a57ff0210c984debfc6731c5d015c638e62ad))

### [0.0.23](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.22...v0.0.23) (2024-08-26)


### Features

* add keyring ([7a1e912](https://github.com/Datalayer-Storage/dig-cli/commit/7a1e912faf577c3f253c843a2414b1fde874575d))

### [0.0.22](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.21...v0.0.22) (2024-08-26)


### Features

* add keyring ([a9ec64c](https://github.com/Datalayer-Storage/dig-cli/commit/a9ec64ccc99a068f5f52802eaaf688ced40f1d20))

### [0.0.21](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.20...v0.0.21) (2024-08-26)


### Features

* add keyring ([cd46f3b](https://github.com/Datalayer-Storage/dig-cli/commit/cd46f3b754cf528b2c6a0a6d03ad1d8e780adef7))

### [0.0.20](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.19...v0.0.20) (2024-08-26)

### [0.0.19](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.18...v0.0.19) (2024-08-25)

### [0.0.18](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.17...v0.0.18) (2024-08-25)

### [0.0.17](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.16...v0.0.17) (2024-08-25)

### [0.0.16](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.15...v0.0.16) (2024-08-25)


### Bug Fixes

* upload multibar ([309d322](https://github.com/Datalayer-Storage/dig-cli/commit/309d3220bfed8e18fd02f5c79847cf4e87b9fad3))

### [0.0.15](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.14...v0.0.15) (2024-08-25)


### Features

* add mnemonic endpoint ([c76eeee](https://github.com/Datalayer-Storage/dig-cli/commit/c76eeeea785c9b5f812cae7afaa81f1ea1934e0c))


### Bug Fixes

* retry logic and burst caching for peers ([055317e](https://github.com/Datalayer-Storage/dig-cli/commit/055317ed6054c0df57a8cc6cac90816a2f8c7ac2))

### [0.0.14](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.13...v0.0.14) (2024-08-25)


### Bug Fixes

* tweak rate limiting in upload ([6d90c71](https://github.com/Datalayer-Storage/dig-cli/commit/6d90c71ecc51f691a55c33ae4bc2d5f564ad24b1))

### [0.0.13](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.12...v0.0.13) (2024-08-24)


### Features

* add propagation server and content server ([c2a49ed](https://github.com/Datalayer-Storage/dig-cli/commit/c2a49edfa2e5f2da0d292c81bba39eadec8fcc0c))

### [0.0.12](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.10...v0.0.12) (2024-08-24)


### Features

* add propagation server and content server ([5d0d765](https://github.com/Datalayer-Storage/dig-cli/commit/5d0d7657809c73456f6b354aee168ebb19d95bdc))

### [0.0.11](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.10...v0.0.11) (2024-08-24)

### [0.0.10](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.9...v0.0.10) (2024-08-24)


### Bug Fixes

* server ([3cbd1af](https://github.com/Datalayer-Storage/dig-cli/commit/3cbd1afea003d21c68e2a5259c76df2286975ae0))

### [0.0.9](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.8...v0.0.9) (2024-08-24)

### [0.0.8](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.7...v0.0.8) (2024-08-24)

### [0.0.7](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.6...v0.0.7) (2024-08-24)


### Features

* add proof of inclusion to server header response ([b95fa9e](https://github.com/Datalayer-Storage/dig-cli/commit/b95fa9e5485c13825a915b67849b5d5d730bbf95))

### [0.0.6](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.5...v0.0.6) (2024-08-24)

### [0.0.5](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.4...v0.0.5) (2024-08-23)


### Features

* multi store support ([edd7fab](https://github.com/Datalayer-Storage/dig-cli/commit/edd7fabc092cdb89cb24625b2a2678fb24ff2f98))


### Bug Fixes

* merge conflicts ([e7300c3](https://github.com/Datalayer-Storage/dig-cli/commit/e7300c38f372aad74a076776cec69e549b1e10e2))
* ts errors ([a982a68](https://github.com/Datalayer-Storage/dig-cli/commit/a982a687bba531258cbfcf10f788ff2f242d15b6))

### [0.0.4](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.3...v0.0.4) (2024-08-23)

### [0.0.3](https://github.com/Datalayer-Storage/dig-cli/compare/v0.0.2...v0.0.3) (2024-08-23)

### 0.0.2 (2024-08-23)


### Features

* add cli tools ([613aa7b](https://github.com/Datalayer-Storage/dig-cli/commit/613aa7bc2c558d052e7ea583707e49b8a661c86a))
* add more cleanup ([f73e4b5](https://github.com/Datalayer-Storage/dig-cli/commit/f73e4b522d773b71918d27f6e9456230eb86f335))
* add peer selection by highest peak ([dee7ab4](https://github.com/Datalayer-Storage/dig-cli/commit/dee7ab4dafa734e9775276b06de3c89b4ce35bc5))
* add pull down from origin ([4be05d3](https://github.com/Datalayer-Storage/dig-cli/commit/4be05d3b3cf6445a7caa3f27e860930293cbb5bf))
* add store integrity check ([5da819d](https://github.com/Datalayer-Storage/dig-cli/commit/5da819dd7b1972347dc16bf69f957fba060158bf))
* added --user and --password options to login command ([0cd8f1a](https://github.com/Datalayer-Storage/dig-cli/commit/0cd8f1a0f3bcddec5062edb00dc93ce0c547f41a))
* added login command ([f210f68](https://github.com/Datalayer-Storage/dig-cli/commit/f210f685b77a25d05670d33161a2eb81a1b64a62))
* added logout command ([5abf929](https://github.com/Datalayer-Storage/dig-cli/commit/5abf929bde5ea1e1170953c40f23dc781091651a))
* completed remote set command ([1eac417](https://github.com/Datalayer-Storage/dig-cli/commit/1eac41711be2a5c62218ac8ac23c89076d29dd6f))
* gzip file storage ([7d2edfb](https://github.com/Datalayer-Storage/dig-cli/commit/7d2edfb976538dfb17347d3d55159970b67e574a))
* peer selection, commit logic ([7964eec](https://github.com/Datalayer-Storage/dig-cli/commit/7964eec7ba79a87d62cab063f758567b2dcd309d))
* preview server ([6e3543a](https://github.com/Datalayer-Storage/dig-cli/commit/6e3543afaa43b432595bf73083a4fe635fa15b2d))
* stuff ([25228cd](https://github.com/Datalayer-Storage/dig-cli/commit/25228cd7de7504cac323b89ee74bbe6f5eccd1ca))
* working init, commit, push cmds ([cc84cd9](https://github.com/Datalayer-Storage/dig-cli/commit/cc84cd93a61f58c6455352be2a0bb0521e13780d))
* working merkle tree ([a99f31c](https://github.com/Datalayer-Storage/dig-cli/commit/a99f31cc3865fa393d6ff5841a22448aa1e95ec2))
* working upload ([3f30bf0](https://github.com/Datalayer-Storage/dig-cli/commit/3f30bf0b9d4ca9e7db164fe3d13afd40f96dd1e2))


### Bug Fixes

* typo ([d5ac971](https://github.com/Datalayer-Storage/dig-cli/commit/d5ac971b5736b1e65dbc7e12b204fd34e7cb5f40))
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Use the official Ubuntu image as the base image
FROM ubuntu:latest

# Set the working directory inside the container
WORKDIR /app

# Install curl, build-essential, and other dependencies
RUN apt-get update && apt-get install -y \
curl \
build-essential \
libsecret-1-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

# Install Node.js 20
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest

# Copy the current directory contents into the container at /app
COPY . .

# Install any needed packages specified in package.json
RUN npm install
RUN npm i datalayer-driver-linux-x64-gnu
RUN npm i chia-server-coin-linux-x64-gnu
RUN npm run build

# Rebuild any native modules for the current environment
RUN npm rebuild

# Run the application
CMD ["node", "dist/index.js"]

7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2024 Michael Taylor

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
83 changes: 82 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,82 @@
# dig-propagation-server
# Introduction To DIG and the DIG Network

The DIG Network offers a robust solution for ensuring data integrity and censorship resistance by leveraging decentralized technology. When you add your data to DIG, it is encoded and served from a Merkle tree, with the Merkle root securely stored on the blockchain by the data owner. This structure guarantees that the data can be verified by anyone, ensuring that what they consume is exactly what was intended, free from manipulation or tampering.

This capability is particularly valuable for decentralized applications (dApps). With DIG, a dApp developer can have their application backed up and served globally by a network of peers. The decentralized nature of the DIG Network means that even if a dApp is served by a random peer, users can trust that it remains unaltered.

The network's ability to stitch together all the peers serving your content creates a unified Decentralized Content Delivery Network (D-CDN), making it easier for end-users to access the data without needing to manually locate the peers. The philosophy behind DIG suggests that if there are enough peers distributed across various legal jurisdictions worldwide, the dApp achieves a significant level of censorship resistance. This is because the chance of every peer being simultaneously shut down is extremely low.

Moreover, DIG opens up possibilities for creating dApps where write access is controlled by a cryptographic key, potentially owned by a Decentralized Autonomous Organization (DAO). This could lead to the development of dApps that are not owned by any single entity but are maintained by anonymous DAO members, further enhancing the censorship resistance and resilience of the application.

### Using DIG: A Step-by-Step Guide

To effectively use the DIG Network, it's essential to become familiar with the DIG CLI commands. While it is recommended to explore all available commands, this guide focuses on the core workflow that developers will frequently use.

**Before You Begin:** Ensure your DIG environment is properly set up by following the [SETUP.md](./SETUP.md) guide.

---

#### Step 1: Prepare Your Project

1. **Add `.dig` to `.gitignore`:**
- Open your dApp project.
- Add `.dig` to your `.gitignore` file to ensure that DIG-related files are not tracked by Git.

2. **Build Your Project:**
- Compile your project, directing the output to the `./dist` folder (or any build folder of your choice). By default, the DIG CLI looks for the `./dist` folder.

---

#### Step 2: Initialize DIG for Your Project

1. **Initialize DIG:**
- Run the following command in your project directory:
```bash
dig init
```
- This will create a `.dig` folder in your project directory. An empty data store will also be created and committed to the blockchain. Wait for the blockchain transaction to confirm before proceeding to the next step.

---

#### Step 3: Commit Your Build to the Data Store

1. **Commit the `dist` Folder:**
- Use the following command to commit your `dist` folder to the DIG data store:
```bash
dig commit
```
- This command inserts all files from the `./dist` folder into the Merkle root of your new data store and updates the blockchain with the resulting Merkle root. This process involves another blockchain transaction, which you must wait to confirm.

---

#### Step 4: Push Your Data to the DIG Node

1. **Push to the DIG Node:**
- To make your data available on a DIG Node, run the following command:
```bash
dig push
```
- This command uploads your files to the DIG Node, verifying integrity and permissions along the way. Ensure your DIG Node is set up according to the [SETUP.md](#) guide.

---

#### Step 5: Verify Your dApp on the DIG Network

1. **Check Availability:**
- After a few moments, your DIG Node will detect the new store and register it with the DIG Network. You can verify this by visiting:
```http
http://your.ip.address
```
- You should be able to find and access your dApp. Congratulations, your dApp is now live on the DIG Network!

---

#### Step 6: Accessing Your dApp via the Network

Once your dApp is on the network, it can be discovered and accessed by any client, browser, or domain acting as a cache service using a unified identifier called the **Universal DataLayer Identifier (UDI)**. This feature is still under development and will be available soon. Updates will be provided as the UDI and associated technologies come online.

**In the Meantime:**
- You can use **nginx** or a **reverse proxy** to map your store to a domain on your local machine and serve it like a traditional website.
- In the future, a custom browser will automatically load your app from the network using the UDI, potentially integrated with a decentralized name service.

By following this workflow, you can securely deploy your dApp to the DIG Network, ensuring that it is backed up, served globally, and resistant to censorship.
Loading

0 comments on commit 16b7a60

Please sign in to comment.