2022-01-01 18:53:17 +00:00
|
|
|
# Set up
|
|
|
|
## Django development environment
|
|
|
|
### Install Python and pip
|
|
|
|
`sudo apt install python3 python3 pip`
|
|
|
|
|
|
|
|
### Install virtual environments
|
2022-01-06 16:54:37 +00:00
|
|
|
```
|
|
|
|
pip install virtualenvwrapper
|
|
|
|
```
|
2022-01-01 18:53:17 +00:00
|
|
|
|
|
|
|
### Add to .bashrc
|
2022-01-01 23:58:44 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
export WORKON_HOME=$HOME/.virtualenvs
|
2022-01-01 18:53:17 +00:00
|
|
|
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
|
|
|
|
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=' -p /usr/bin/python3 '
|
|
|
|
export PROJECT_HOME=$HOME/Devel
|
2022-01-01 23:58:44 +00:00
|
|
|
source /usr/local/bin/virtualenvwrapper.sh
|
|
|
|
```
|
2022-01-01 18:53:17 +00:00
|
|
|
|
|
|
|
### Reload startup file
|
|
|
|
`source ~/.bashrc`
|
|
|
|
|
|
|
|
### Create virtual environment
|
|
|
|
`mkvirtualenv robosats_env`
|
|
|
|
|
|
|
|
### Activate environment
|
|
|
|
`workon robosats_env`
|
|
|
|
|
|
|
|
### Install Django and Restframework
|
|
|
|
`pip3 install django djangorestframework`
|
|
|
|
|
2022-01-05 11:20:08 +00:00
|
|
|
## Install Django admin relational links
|
|
|
|
`pip install django-admin-relation-links`
|
|
|
|
|
2022-01-13 14:08:21 +00:00
|
|
|
## Install dependencies for websockets
|
|
|
|
Install Redis
|
|
|
|
`apt-get install redis-server`
|
|
|
|
Test redis-server
|
|
|
|
`redis-cli ping`
|
|
|
|
|
|
|
|
Install python dependencies
|
|
|
|
```
|
|
|
|
pip install channels
|
|
|
|
pip install django-redis
|
|
|
|
pip install channels-redis
|
|
|
|
```
|
2022-01-16 12:31:25 +00:00
|
|
|
## Install Celery for Django tasks
|
|
|
|
```
|
|
|
|
pip install celery
|
|
|
|
pip install django-celery-beat
|
|
|
|
pip install django-celery-results
|
|
|
|
```
|
|
|
|
|
|
|
|
Start up celery worker
|
|
|
|
`celery -A robosats worker --beat -l info -S django`
|
2022-01-13 11:07:20 +00:00
|
|
|
|
2022-01-16 12:31:25 +00:00
|
|
|
*Django 3.2.11 at the time of writting*
|
|
|
|
*Celery 5.2.3*
|
2022-01-01 23:58:44 +00:00
|
|
|
|
|
|
|
### Launch the local development node
|
|
|
|
|
|
|
|
```
|
|
|
|
python3 manage.py makemigrations
|
|
|
|
python3 manage.py migrate
|
|
|
|
python3 manage.py runserver
|
|
|
|
```
|
|
|
|
|
2022-01-10 18:47:16 +00:00
|
|
|
### Install other python dependencies
|
2022-01-02 15:19:49 +00:00
|
|
|
```
|
|
|
|
pip install robohash
|
2022-01-10 18:47:16 +00:00
|
|
|
pip install python-decouple
|
|
|
|
pip install ring
|
|
|
|
```
|
|
|
|
|
|
|
|
### Install LND python dependencies
|
|
|
|
```
|
|
|
|
cd api/lightning
|
|
|
|
pip install grpcio grpcio-tools googleapis-common-protos
|
|
|
|
git clone https://github.com/googleapis/googleapis.git
|
|
|
|
curl -o lightning.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/lightning.proto
|
|
|
|
python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. lightning.proto
|
2022-01-02 15:19:49 +00:00
|
|
|
```
|
2022-01-11 20:49:53 +00:00
|
|
|
We also use the *Invoices* and *Router* subservices for invoice validation and payment routing.
|
2022-01-10 23:27:48 +00:00
|
|
|
```
|
|
|
|
curl -o invoices.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/invoicesrpc/invoices.proto
|
|
|
|
python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. invoices.proto
|
2022-01-11 20:49:53 +00:00
|
|
|
curl -o router.proto -s https://raw.githubusercontent.com/lightningnetwork/lnd/master/lnrpc/routerrpc/router.proto
|
|
|
|
python3 -m grpc_tools.protoc --proto_path=googleapis:. --python_out=. --grpc_python_out=. router.proto
|
2022-01-10 23:27:48 +00:00
|
|
|
```
|
2022-01-11 01:02:06 +00:00
|
|
|
Relative imports are not working at the moment, so some editing is needed in
|
2022-01-11 20:49:53 +00:00
|
|
|
`api/lightning` files `lightning_pb2_grpc.py`, `invoices_pb2_grpc.py`, `invoices_pb2.py`, `router_pb2_grpc.py` and `router_pb2.py`.
|
2022-01-11 01:02:06 +00:00
|
|
|
|
2022-01-11 20:49:53 +00:00
|
|
|
For example in `lightning_pb2_grpc.py` , add "from . " :
|
2022-01-11 01:02:06 +00:00
|
|
|
|
|
|
|
`import lightning_pb2 as lightning__pb2`
|
|
|
|
|
|
|
|
to
|
|
|
|
|
|
|
|
`from . import lightning_pb2 as lightning__pb2`
|
2022-01-02 15:19:49 +00:00
|
|
|
|
2022-01-11 20:49:53 +00:00
|
|
|
Same for every other file
|
|
|
|
|
2022-01-01 23:58:44 +00:00
|
|
|
## React development environment
|
|
|
|
### Install npm
|
|
|
|
`sudo apt install npm`
|
|
|
|
|
2022-01-04 15:00:34 +00:00
|
|
|
npm packages we use
|
2022-01-01 23:58:44 +00:00
|
|
|
```
|
|
|
|
cd frontend
|
|
|
|
npm init -y
|
|
|
|
npm i webpack webpack-cli --save-dev
|
|
|
|
npm i @babel/core babel-loader @babel/preset-env @babel/preset-react --save-dev
|
|
|
|
npm i react react-dom --save-dev
|
|
|
|
npm install @material-ui/core
|
|
|
|
npm install @babel/plugin-proposal-class-properties
|
|
|
|
npm install react-router-dom@5.2.0
|
|
|
|
npm install @material-ui/icons
|
2022-01-02 21:41:22 +00:00
|
|
|
npm install material-ui-image
|
2022-01-04 15:00:34 +00:00
|
|
|
npm install @mui/system @emotion/react @emotion/styled
|
2022-01-09 14:07:05 +00:00
|
|
|
npm install react-native
|
|
|
|
npm install react-native-svg
|
|
|
|
npm install react-qr-code
|
2022-01-09 22:17:15 +00:00
|
|
|
npm install @mui/material
|
2022-01-13 19:22:54 +00:00
|
|
|
npm install websocket
|
2022-01-14 00:43:26 +00:00
|
|
|
npm install react-countdown
|
2022-01-14 12:00:53 +00:00
|
|
|
npm install @mui/icons-material
|
2022-01-14 21:40:54 +00:00
|
|
|
npm install @mui/x-data-grid
|
2022-01-01 23:58:44 +00:00
|
|
|
```
|
2022-01-11 20:49:53 +00:00
|
|
|
Note we are using mostly MaterialUI V5 (@mui/material) but Image loading from V4 (@material-ui/core) extentions (so both V4 and V5 are needed)
|
2022-01-01 23:58:44 +00:00
|
|
|
|
|
|
|
### Launch the React render
|
|
|
|
from frontend/ directory
|
|
|
|
`npm run dev`
|