Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 0 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,3 @@ jobs:
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
#
#- name: Release dev-frontend on Docker Hub
# if: ${{ github.event_name == 'push' }}
# run: |
# docker-compose build
# docker-compose push
# working-directory: ./packages/dev-frontend
# env:
# TAG: ${{ fromJSON('{ "refs/heads/master":"latest", "refs/heads/main":"next" }')[github.ref] }}
108 changes: 2 additions & 106 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ Visit the [Sovryn website](https://www.sovryn.app/zero) to find out more and joi
- [Run all tests](#run-all-tests)
- [Deploy contracts to a testnet](#deploy-contracts-to-a-testnet)
- [Start a local blockchain and deploy the contracts](#start-a-local-blockchain-and-deploy-the-contracts)
- [Start dev-frontend in development mode](#start-dev-frontend-in-development-mode)
- [Start dev-frontend in demo mode](#start-dev-frontend-in-demo-mode)
- [Build dev-frontend for production](#build-dev-frontend-for-production)
- [Configuring your custom frontend](#configuring-your-custom-frontend)
- [Running a frontend with Docker](#running-a-frontend-with-docker)
- [Prerequisites](#prerequisites-1)
Expand Down Expand Up @@ -227,7 +224,6 @@ Economically, Recovery Mode is designed to encourage collateral top-ups and debt

### Directories

- `packages/dev-frontend/` - Zero Beta: a fully functional React app used for interfacing with the smart contracts during development
- `packages/fuzzer/` - A very simple, purpose-built tool based on Zero middleware for randomly interacting with the system
- `packages/lib-base/` - Common interfaces and classes shared by the other `lib-` packages
- `packages/lib-ethers/` - [ethers](https://github.com/ethers-io/ethers.js)-based middleware that can read Zero state and send transactions
Expand Down Expand Up @@ -1153,7 +1149,7 @@ E.g.:
yarn deploy --network ropsten
```

Supported networks are currently: rsk testnet, rsk mainnet. The above command will deploy into the default channel (the one that's used by the public dev-frontend). To deploy into the internal channel instead:
Supported networks are currently: rsk testnet, rsk mainnet. The above command will deploy into the default channel. To deploy into the internal channel instead:

```
yarn deploy --network ropsten --channel internal
Expand Down Expand Up @@ -1191,7 +1187,7 @@ yarn start-dev-chain

Starts an RSK node in a Docker container, running the [private development chain](https://github.com/rsksmart/rskj), then deploys the contracts to this chain.

You may want to use this before starting the dev-frontend in development mode. To use the newly deployed contracts, switch MetaMask to the built-in "Localhost 8545" network.
To use the newly deployed contracts, switch MetaMask to the built-in "Localhost 8545" network.

> Q: How can I get RBTC on the local blockchain?
> A: There are some already unlocked accounts
Expand All @@ -1202,52 +1198,6 @@ Once you no longer need the local node, stop it with:
yarn stop-dev-chain
```

#### Start dev-frontend in development mode

```
yarn start-dev-frontend
```

This will start dev-frontend in development mode on http://localhost:3000. The app will automatically be reloaded if you change a source file under `packages/dev-frontend`.

If you make changes to a different package under `packages`, it is recommended to rebuild the entire project with `yarn prepare` in the root directory of the repo. This makes sure that a change in one package doesn't break another.

To stop the dev-frontend running in this mode, bring up the terminal in which you've started the command and press Ctrl+C.

#### Start dev-frontend in demo mode

This will automatically start the local blockchain, so you need to make sure that's not already running before you run the following command.

```
yarn start-demo
```

This spawns a modified version of dev-frontend that ignores MetaMask, and directly uses the local blockchain node. Every time the page is reloaded (at http://localhost:3000), a new random account is created with a balance of 100 RBTC. Additionally, transactions are automatically signed, so you no longer need to accept wallet confirmations. This lets you play around with Zero more freely.

When you no longer need the demo mode, press Ctrl+C in the terminal then run:

```
yarn stop-demo
```

#### Build dev-frontend for production

In a freshly cloned & installed monorepo, or if you have only modified code inside the dev-frontend package:

```
yarn build
```

If you have changed something in one or more packages apart from dev-frontend, it's best to use:

```
yarn rebuild
```

This combines the top-level `prepare` and `build` scripts.

You'll find the output in `packages/dev-frontend/build`.

### Configuring your custom frontend

Your custom built frontend can be configured by putting a file named `config.json` inside the same directory as `index.html` built in the previous step. The format of this file is:
Expand All @@ -1259,29 +1209,10 @@ Your custom built frontend can be configured by putting a file named `config.jso
}
```

## Running a frontend with Docker

The quickest way to get a frontend up and running is to use the [prebuilt image](https://hub.docker.com/r/liquity/dev-frontend) available on Docker Hub.

### Prerequisites

You will need to have [Docker](https://docs.docker.com/get-docker/) installed.

### Running with `docker`

```
docker pull liquity/dev-frontend
docker run --name Zero -d --rm -p 3000:80 liquity/dev-frontend
```

This will start serving your frontend using HTTP on port 3000. If everything went well, you should be able to open http://localhost:3000/ in your browser. To use a different port, just replace 3000 with your desired port number.

To stop the service:

```
docker kill liquity
```

### Configuring a public frontend

If you're planning to publicly host a frontend, you might need to pass the Docker container some extra configuration in the form of environment variables.
Expand All @@ -1290,41 +1221,6 @@ If you're planning to publicly host a frontend, you might need to pass the Docke

This is an optional parameter. If you'd like your frontend to use Infura's [WebSocket endpoint](https://infura.io/docs/RSK#section/Websockets) for receiving blockchain events, set this variable to an Infura Project ID.

### Next steps for hosting a frontend

You'll need to decide how you want to host your frontend. There are way too many options to list here, so these are going to be just a few examples.

#### Example 1: using static website hosting

A frontend doesn't require any database or server-side computation, so the easiest way to host it is to use a service that lets you upload a folder of static files (HTML, CSS, JS, etc).

To obtain the files you need to upload, you need to extract them from a frontend Docker container. If you were following the guide for setting a kickback rate and haven't stopped the container yet, then you already have one! Otherwise, you can create it with a command like this (remember to use your own `FRONTEND_TAG` and `INFURA_API_KEY`):

```
docker run --name Zero -d --rm \
-e FRONTEND_TAG=0x2781fD154358b009abf6280db4Ec066FCC6cb435 \
-e INFURA_API_KEY=158b6511a5c74d1ac028a8a2afe8f626 \
liquity/dev-frontend
```

While the container is running, use `docker cp` to extract the frontend's files to a folder of your choosing. For example to extract them to a new folder named "devui" inside the current folder, run:

```
docker cp liquity:/usr/share/nginx/html ./devui
```

Upload the contents of this folder to your chosen hosting service (or serve them using your own infrastructure), and you're set!

#### Example 2: wrapping the frontend container in HTTPS

If you have command line access to a server with Docker installed, hosting a frontend from a Docker container is a viable option.

The frontend Docker container simply serves files using plain HTTP, which is susceptible to man-in-the-middle attacks. Therefore it is highly recommended to wrap it in HTTPS using a reverse proxy. You can find an example docker-compose config [here](packages/dev-frontend/docker-compose-example/docker-compose.yml) that secures the frontend using [SWAG (Secure Web Application Gateway)](https://github.com/linuxserver/docker-swag) and uses [watchtower](https://github.com/containrrr/watchtower) for automatically updating the frontend image to the latest version on Docker Hub.

Remember to customize both [docker-compose.yml](packages/dev-frontend/docker-compose-example/docker-compose.yml) and the [site config](packages/dev-frontend/docker-compose-example/config/nginx/site-confs/liquity.example.com).



## Disclaimer

The content of this readme document (“Readme”) is of purely informational nature. In particular, none of the content of the Readme shall be understood as advice provided by Sovryn, any Zero Project Team member or other contributor to the Readme, nor does any of these persons warrant the actuality and accuracy of the Readme.
Expand Down
1 change: 0 additions & 1 deletion filter-repo/1-included-paths
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ registry/
docs/
packages/decimal/
packages/frontend/
packages/dev-frontend/
packages/examples/
packages/providers/
packages/subgraph/
Expand Down
7 changes: 0 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
},
"scripts": {
"build": "run-s build:*",
"build:dev-frontend": "yarn workspace @sovryn-zero/dev-frontend build",
"deploy": "yarn workspace @sovryn-zero/lib-ethers hardhat deploy",
"docs": "run-s docs:*",
"docs:collect-sdk-apis": "node scripts/collect-sdk-apis.js",
Expand Down Expand Up @@ -79,18 +78,12 @@
"start-dev-chain:deploy-contracts": "yarn deploy --network rskdev",
"start-dev-chain:prepare-lib-ethers": "yarn prepare:lib-ethers",
"stop-dev-chain": "docker kill regtest-node-rsk",
"start-dev-frontend": "yarn workspace @sovryn-zero/dev-frontend start",
"start-demo": "run-s start-demo:*",
"start-demo:dev-chain": "yarn start-dev-chain",
"start-demo:dev-frontend": "yarn workspace @sovryn-zero/dev-frontend start-demo",
"stop-demo": "yarn stop-dev-chain",
"test": "run-s test:*",
"test:lib-base": "yarn workspace @sovryn-zero/lib-base test",
"test:lib-ethers": "yarn workspace @sovryn-zero/lib-ethers test",
"test-deprecated:dev-frontend": "run-s --continue-on-error test:dev-frontend:*",
"test-deprecated:dev-frontend:start-dev-chain": "yarn start-dev-chain",
"test-deprecated:dev-frontend:run": "yarn workspace @sovryn-zero/dev-frontend test --watchAll=false --forceExit --detectOpenHandles",
"test-deprecated:dev-frontend:stop-dev-chain": "yarn stop-dev-chain",
"test:contracts": "yarn workspace @sovryn-zero/contracts test",
"test:sdk-contracts": "yarn workspace @sovryn-zero/sdk-contracts test",
"format-lint:contracts": "yarn workspace @sovryn-zero/contracts lint && yarn workspace @sovryn-zero/contracts prettier:write",
Expand Down
2 changes: 0 additions & 2 deletions package.public.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
},
"scripts": {
"build": "run-s build:*",
"build:dev-frontend": "yarn workspace @sovryn-zero/dev-frontend build",
"build:subgraph": "yarn workspace @sovryn-zero/subgraph build",
"docs": "run-s docs:*",
"docs:collect-sdk-apis": "node scripts/collect-sdk-apis.js",
Expand All @@ -31,7 +30,6 @@
"prepare:subgraph": "yarn workspace @sovryn-zero/subgraph prepare",
"prepare:docs": "run-s docs",
"rebuild": "run-s prepare build",
"start-dev-frontend": "yarn workspace @sovryn-zero/dev-frontend start"
},
"devDependencies": {
"@microsoft/api-documenter": "^7.12.6",
Expand Down
1 change: 0 additions & 1 deletion packages/dev-frontend/.dockerignore

This file was deleted.

3 changes: 0 additions & 3 deletions packages/dev-frontend/.env.example

This file was deleted.

4 changes: 0 additions & 4 deletions packages/dev-frontend/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions packages/dev-frontend/Dockerfile

This file was deleted.

Loading