Skip to content

Commit

Permalink
dockerizing and updating packages
Browse files Browse the repository at this point in the history
  • Loading branch information
FDonati committed Dec 8, 2021
0 parents commit 6fb6f9a
Show file tree
Hide file tree
Showing 12,494 changed files with 2,304,206 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# pull the official base image
FROM python:3.8-alpine

RUN mkdir /usr/src/app

# Set environmental variables
RUN export DJANGO_SETTINGS_MODULE=config/circumatMasterProject.config.dev
RUN export DATASETS_VERSION=v4
RUN export DATASETS_DIR=data/
RUN export OPENBLAS_NUM_THREADS=3

# set work directory
WORKDIR /usr/src/app/backend

# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt /usr/src/app
RUN pip install -r requirements.txt

# add project
ADD . /usr/src/app/backend




127 changes: 127 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# CircuMat
---
CircuMat is a modified (forked) version of Rama-Scene EIT Raw Materials project related to analyzing Environmentally Extended Input-Output (EEIO) tables. CircuMat focuses on NUTS2 level classification as opposed to Rama-Scene country level analysis tool.

[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](resources/docs/CONTRIBUTING.md)

# Developers Guide
---
For more information on the tool architecture, please refer to Rama-Scene's documenation: http://rama-scene.readthedocs.io/en/latest/

# Getting started
---
### Retrieve the raw datasets


* EXIOBASE-Rama-Scene (v4 - modified version including secondary materials + CircuMat Eurostat data):

https://surfdrive.surf.nl/files/index.php/s/bEVnoyJUeYMUiyr

pass: circumat

Download the circumat_v4_clean.zip folder.

### Clone the project
```
$ git clone https://[email protected]/CML-IE/circumat.git
```

### Create a virtual environment (python3.5 or higher) and install the app requirements (make sure you have python-dev installed via apt-get)
```
$ pip3 install -r requirements.txt
```

### Install node.js (node version: 3.10.10 or higher)
```
$ sudo apt-get update
$ sudo apt-get install nodejs
```
> Note: On debian apt install nodejs-legacy
### Install redis (for Django Channels)
```
$ sudo apt install redis-server
```

### Install rabbitMQ (for Celery)

``$ sudo apt-get install -y erlang``

``$ sudo apt-get install rabbitmq-server``

Then enable and start the RabbitMQ service:

``$ sudo systemctl enable rabbitmq-server``

``$ sudo systemctl start rabbitmq-server``

Check the status to make sure everything is running:
``$ sudo systemctl status rabbitmq-server``


> Note: Perform all next steps in the virtualenv and in the rootfolder of the project
### Set the following environment variables (see sample-dev-env.sh):
```
export DJANGO_SETTINGS_MODULE=circumatMasterProject.config.dev
export DATASETS_VERSION=[version downloaded e.g. v3]
export DATASETS_DIR=my/path/to/datasets (make sure that inside this folder is a folder containing the year 2011)
export OPENBLAS_NUM_THREADS=<adjust according to how many cores you want to use>
```
If you are on Linux and using the OpenBlas library for Numpy.
It is advised to set the number of threads Numpy uses. To find which library is used in python:
```
>>>import numpy as np
>>>np.__config__.show()
```


### Prepare the database
```
$ python3 manage.py makemigrations
$ python3 manage.py migrate
```

### Populate the database
```
$ python3 manage.py populateHierarchies
```

### Prepare static resources (npm version 4.6.1 or higher)
```
$ npm install
```

### Built React bundle
```
$ ./node_modules/.bin/webpack --config dev-webpack.config.js
```

### Start Celery
Start the celery module to enable handling of calculations:
```
$ celery -A circumatMasterProject worker -l info --concurrency 1
```

### Start the development server
```
$ python3 manage.py runserver
```

Access the app via the webbrowser: http://127.0.0.1:8000/circumat/


### Core dependencies
---
#### TO BE UPDATED
The app uses Celery [4.1.0] (http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html), Django channels [2.1.5] (https://channels.readthedocs.io/en/latest/)


# Contributers
(Ramascene & Circumat) Back-end developer: Sidney Niccolson & Franco Donati (CML)
(Ramascene) Front-end developer: Franco Donati (CML) & Bart Daniels (VITO)
(Ramascene) IO calculations: Arjan de Koning, Hale Cetinay & Franco Donati (CML)
(Ramascene) IO modelling: Franco Donati (CML)
Eurostat data: Elmer Rietveld (TNO)
Project manager: Hale Cetinay Iyicil & Franco Donati (CML)
Binary file not shown.
Loading

0 comments on commit 6fb6f9a

Please sign in to comment.