Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Feb 21, 2024
2 parents bad2e3d + c0e6d8a commit bf4329e
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 153 deletions.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Ignore MacOS files
.DS_Store

# Ignore logs
*.log
nohup.out
.vsco
de/
.idea
data/

# JS
node_modules/
db.sqlite3

# Python
__pycache__/
.pytest_cache/
.ipynb_checkpoints/

luce_vm/brownie/build
23 changes: 8 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9
FROM --platform=linux/amd64 python:3.9

USER root
WORKDIR /luce
Expand All @@ -8,16 +8,10 @@ ENV USE_TZ=False
RUN apt-get update && \
apt-get install -y wget build-essential software-properties-common libssl-dev postgresql-client libpq-dev

RUN pip install eth-brownie
RUN pip install Django==4.1.12
RUN pip install django-filter
RUN pip install django-extensions
RUN pip install djangorestframework
RUN pip install django-cors-headers
RUN pip install psycopg2
RUN pip install matplotlib
RUN pip install django-haystack
RUN pip install Sphinx

ADD ./requirements.txt .
RUN pip install -r requirements.txt

# Install Ethereum
# RUN add-apt-repository -y ppa:ethereum/ethereum && \
# apt update && \
Expand All @@ -31,16 +25,15 @@ RUN pip install Sphinx

RUN brownie pm install OpenZeppelin/[email protected]

COPY luce_vm/scripts/entrypoint.sh /entrypoint.sh
ADD ./luce_vm/scripts/entrypoint.sh /entrypoint.sh
RUN chmod 744 /entrypoint.sh

# brownie networks add [environment] [id] host=[host] [KEY=VALUE, ...]
RUN brownie networks add LUCE luce host=http://ganache_db:8545 chainid=72



COPY . .
# RUN cd luce_vm/brownie && brownie compile

RUN cd luce_vm/brownie && brownie compile

# RUN pip install -e .

Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,17 @@ please deploy a LUCERegistry contract in `admin/deployRegistry/` endpoint.
For how to maintain the documentation, please refer to: [Documentation mantaince](./docs/README.MD)

For how to develop in LUCE, please refer to: [LUCE development tips](./manual/LUCE%20Development%20tips.MD)

1. Start the database and blockchain in docker for development:

```bash
docker compose -f docker-compose.dev.yml up
```

2. Start the backend:

```bash

```

3. Start the frontend:
65 changes: 65 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
version: "3"

# Docker compose to use top deploy database in development
# Backend and webapp are expected to be run separately

services:
image: kunlium/luceweb
ports:
- 8001:80
restart: unless-stopped

ganache_db:
image: trufflesuite/ganache:v7.7.3
restart: unless-stopped
command: -l 300000000 --database.dbPath /ganache_db --chain.chainId 72 -h 0.0.0.0 --wallet.accounts "0xd49df1af2d195c2c56cb4aa9119d188889c8c28c011501a339a1eafcdcb790d8, 1000000000000000000000000" --wallet.accounts "0x56c6de6fd54438dbb31530f5fdeeaada0b1517880c91dfcd46a4e5fec59a9c79, 1000000000000000000000000" "0xcd4fc6fe57bb44764562df4abae6e9673a4b9db250ea94a0a42ac8500e0275eb, 1000000000000000000000000"
ports:
- 8545:8545
# environment:
# - VIRTUAL_PORT=8545
# - VIRTUAL_HOST=ganache.luce.137.120.31.102.nip.io
# - LETSENCRYPT_HOST=ganache.luce.137.120.31.102.nip.io
volumes:
- ${STORAGE_PATH:-./data}/ganache_db:/ganache_db

postgres_db:
image: postgres
restart: unless-stopped
depends_on:
- ganache_db
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=luce123456
- POSTGRES_USER=luce
- POSTGRES_DB=lucedb
volumes:
- ${STORAGE_PATH:-./data}/postgres_db:/var/lib/postgresql/data
- ./luce_vm/scripts/init_postgres.sh:/docker-entrypoint-initdb.d/init_postgres.sh

zkp_service:
build: ./luce_vm/js
ports:
- 8888:8888

# jupyterlab:
# # image: jupyter/base-notebook
# build: ./luce_vm/jupyter
# restart: unless-stopped
# user: root
# ports:
# - 8888:8888
# volumes:
# - ./luce_vm/jupyter:/home/jovyan/work
# environment:
# - JUPYTER_TOKEN=password
# - GRANT_SUDO=yes
# - JUPYTER_ENABLE_LAB=yes

# ethereum-node:
# image: ethereum/client-go
# ports:
# - "30303:30303"
# command: "--rpc --rpcaddr 0.0.0.0"
# volumes:
# - ./data/ethereum:/root/.ethereum
68 changes: 35 additions & 33 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,43 @@ services:
webapp:
image: kunlium/luceweb
ports:
- 8000:80
- 8001:80
restart: unless-stopped

luce_server:
build:
context: .
# NOTE: required when building on Mac M1/M2
# platform: linux/amd64
# entrypoint: sleep infinity
depends_on:
- postgres_db
- ganache_db
ports:
- 8000:8000
restart: unless-stopped
# volumes:
# - ./:/luce
environment:
- JUPYTER_TOKEN=luce
# Nginx reverse proxy
- VIRTUAL_PORT=8000
- VIRTUAL_HOST=luce.137.120.31.102.nip.io
- LETSENCRYPT_HOST=luce.137.120.31.102.nip.io
# PostgreSQL config
- DJANGO_USE_PSQL=true
- POSTGRES_PASSWORD=luce123456
- POSTGRES_USER=luce
- POSTGRES_DB=lucedb
# Ganache config
- GANACHE_PORT=8545
# Ideally the users/password should be defined here
# And automatically added to the database at start
- [email protected]
- PROVIDER_PASSWORD=provider
- [email protected]
- REQUESTER_PASSWORD=requester

ganache_db:
image: trufflesuite/ganache:v7.7.3
restart: unless-stopped
Expand Down Expand Up @@ -39,38 +73,6 @@ services:
ports:
- 8888:8888

luce_server:
build: .
# image: vjaiman/luce
depends_on:
- postgres_db
- ganache_db
# ports:
# - 8000:8000
restart: unless-stopped
# entrypoint: tail -f /dev/null
volumes:
- ./:/luce
environment:
- JUPYTER_TOKEN=luce
# Nginx reverse proxy
- VIRTUAL_PORT=8000
- VIRTUAL_HOST=luce.137.120.31.102.nip.io
- LETSENCRYPT_HOST=luce.137.120.31.102.nip.io
# PostgreSQL config
- DJANGO_USE_PSQL=true
- POSTGRES_PASSWORD=luce123456
- POSTGRES_USER=luce
- POSTGRES_DB=lucedb
# Ganache config
- GANACHE_PORT=8545
# Ideally the users/password should be defined here
# And automatically added to the database at start
- [email protected]
- PROVIDER_PASSWORD=provider
- [email protected]
- REQUESTER_PASSWORD=requester

# jupyterlab:
# # image: jupyter/base-notebook
# build: ./luce_vm/jupyter
Expand Down
101 changes: 0 additions & 101 deletions luce_vm/Vagrantfile

This file was deleted.

8 changes: 4 additions & 4 deletions luce_vm/luce_django/luce/lucehome/settings_psql.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# This will override the DATABASES variable in settings.py

# Use Postgresql Database:
#connect to database: psql -U vagrant --port 5432 -d lucedb
# connect to database: psql -U vagrant --port 5432 -d lucedb
import os
if os.environ.get('SIMULATION') == 'true':
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'lucedb',
'USER': 'vagrant',
'PASSWORD': 'luce',
'USER': 'luce',
'PASSWORD': 'luce123456',
'HOST': '127.0.0.1',
'PORT': '5432',
}
Expand All @@ -26,4 +26,4 @@
'HOST': 'postgres_db',
'PORT': '5432',
}
}
}
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
eth-brownie
Django ==4.1.12
django-filter
django-extensions
djangorestframework
django-cors-headers
psycopg2
matplotlib
django-haystack
Sphinx

0 comments on commit bf4329e

Please sign in to comment.