Skip to content
Snippets Groups Projects
Commit ecd2194c authored by adorda's avatar adorda
Browse files

docker-compose mejorados, README actualizado

parent 40ef4df1
No related branches found
No related tags found
1 merge request!1Development
......@@ -10,7 +10,7 @@ Python 3.5>= ó docker
### Instalación para desarrollo con virtual host
Crear virtual host y luego ejecutar los sig comandos
Crear virtual env (venv) y luego ejecutar los sig comandos
```sh
cd /carpeta/del/proyecto
pip install -r requirements.txt
......@@ -24,28 +24,28 @@ pip install coverage
pip install ipython
```
### Instalación para desarrollo con docker y pycharm
### Instalación para desarrollo con docker
```sh
cd /carpeta/del/proyecto/
docker build -t trazabilidad .
docker run --rm --name migrate -v $(pwd):/opt/project -w /opt/project trazabilidad python manage.py migrate
docker-compose -f docker-compose.yml up -d
```
En pycharm ir a Settings-> Project Interpreter y elegir Remote Python 3.5 Docker
Esto levantará la aplicación con un usuario superadmin "admin" con contraseña "Clave123!"
#### Si se está usando PyCharm
Ir a Settings-> Project Interpreter y elegir Remote Python 3.5 Docker
Esperar a que se carguen los skeletons
En Run/Debug Configurations agregar configuracion de django server con el intérprete de docker del proyecto, y en Host poner 0.0.0.0 y en Port 8000
En la carpeta trazabilidad/ hacer un local_settings.py que puede ser copia o link simbólico de los que vienen de ejemplo
Optativo:
```sh
docker-compose up -d
```
Los tests de la aplicación dapp son de integración y la idea es que corran sobre ganache para que ejecuten más rápido, ganache viene en el docker-compose, pero no hace falta para correr la aplicación
### Instalación productiva
Crear virtual host y luego ejecutar los sig comandos
Crear virtual env (venv) y luego ejecutar los sig comandos
```sh
cd /carpeta/del/proyecto
pip install -r requirements.txt
......@@ -69,7 +69,7 @@ cd /carpeta/de/aplicacion
python manage.py unlock_account
```
Si el smart contract del negocio no está deployado:
#### Si el smart contract del negocio no está deployado:
- Loggear en el admin
- Ir a Config Constance
......@@ -87,6 +87,14 @@ python manage.py deployar_trazabilidad
```
Opcional: dar el gas a usar cuando el prompt lo pida
Opcional: si se tiene docker instalado, se puede correr el siguiente comando
```sh
cd /carpeta/del/proyecto
docker-compose -f deploy-smart-contract-docker-compose.yml up -d
docker-compose -f deploy-smart-contract-docker-compose.yml logs --tail 2
```
El log que menciona Contract address: 0xalgunaddress
- De nuevo en el admin, en Config Constance
En la sección Contract Info cargar
- contract address con el output del comando deployar_trazabilidad
......
version: '3.1'
services:
deployment:
build:
dockerfile: Dockerfile
context: .
image: trazabilidad:dev
container_name: trazabilidad-deploy-smart-contract
volumes:
- .:/opt/project
command: python manage.py deployar_trazabilidad --wait --gas ${GAS_LIMIT:-4500000}
environment:
DEBUG: ${DEBUG:-1}
SECRET_KEY: ${SECRET_KEY:-secret}
\ No newline at end of file
......@@ -3,6 +3,45 @@ services:
blockchain:
image: trufflesuite/ganache-cli:latest
ports:
- "8545:8545"
- ${GANACHE_RPC_PORT:-8545}:8545
command: '-b 1'
container_name: ganache
api:
build:
dockerfile: Dockerfile
context: .
image: trazabilidad:dev
container_name: trazabilidad-api
volumes:
- .:/opt/project
ports:
- ${API_PORT:-8080}:8000
command: python manage.py runserver 0.0.0.0:8000
environment:
DEBUG: ${DEBUG:-1}
SECRET_KEY: ${SECRET_KEY:-secret}
depends_on:
- migrations
migrations:
build:
dockerfile: Dockerfile
context: .
image: trazabilidad:dev
container_name: trazabilidad-migrations
command: python manage.py migrate --noinput
volumes:
- .:/opt/project
environment:
DEBUG: ${DEBUG:-1}
SECRET_KEY: ${SECRET_KEY:-secret}
superuser:
depends_on:
- migrations
image: trazabilidad:dev
container_name: trazabilidad-superuser
command: python manage.py loaddata superuser
volumes:
- .:/opt/project
environment:
DEBUG: ${DEBUG:-1}
SECRET_KEY: ${SECRET_KEY:-secret}
\ No newline at end of file
[
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "participant",
"type": "address"
}
],
"name": "addParticipantRole",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "string",
"name": "message",
"type": "string"
},
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
}
],
"name": "addWorkflowStep",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "trackingAddress",
"type": "address"
},
{
"internalType": "bytes32",
"name": "hashEstado",
"type": "bytes32"
},
{
"internalType": "string",
"name": "message",
"type": "string"
},
{
"internalType": "bytes32",
"name": "_nextRole",
"type": "bytes32"
}
],
"name": "forward",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "trackingAddress",
"type": "address"
},
{
"internalType": "bytes32",
"name": "hashEstado",
"type": "bytes32"
}
],
"name": "forwardWorkflow",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "trackCount",
"type": "uint256"
}
],
"name": "PageReached",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "participant",
"type": "address"
}
],
"name": "ParticipantAdded",
"type": "event"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "trackingId",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "hashEstado",
"type": "bytes32"
},
{
"internalType": "string",
"name": "message",
"type": "string"
},
{
"internalType": "bytes32",
"name": "_nextRole",
"type": "bytes32"
}
],
"name": "startTrack",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"internalType": "bytes32",
"name": "trackingId",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "hashEstado",
"type": "bytes32"
}
],
"name": "startTrackWorkflow",
"outputs": [],
"payable": true,
"stateMutability": "payable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "trackingId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "hashEstado",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "trackingAddress",
"type": "address"
}
],
"name": "TrackingEnded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "trackingId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "hashEstado",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "trackingAddress",
"type": "address"
}
],
"name": "TrackingStarted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "trackingId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "hashEstado",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "trackingAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "string",
"name": "message",
"type": "string"
}
],
"name": "UnitMoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "string",
"name": "message",
"type": "string"
}
],
"name": "WorkflowStepAdded",
"type": "event"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "trackingAddress",
"type": "address"
}
],
"name": "currentHashState",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "trackingAddress",
"type": "address"
}
],
"name": "currentPosition",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "add",
"type": "address"
}
],
"name": "isOwner",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "participant",
"type": "address"
}
],
"name": "isParticipant",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
}
],
"name": "isRole",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "participant",
"type": "address"
},
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
}
],
"name": "participantHasRole",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "trackingAddress",
"type": "address"
},
{
"internalType": "address",
"name": "participant",
"type": "address"
}
],
"name": "participantIsAuthorizedForNextStep",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "trackingAddress",
"type": "address"
},
{
"internalType": "address",
"name": "participant",
"type": "address"
}
],
"name": "participantIsAuthorizedForNextStepWorkflow",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "participant",
"type": "address"
}
],
"name": "participantIsAuthorizedForStart",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "workflowIsDefined",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "uint256",
"name": "step",
"type": "uint256"
}
],
"name": "workflowStepMessage",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment