GithubHelp home page GithubHelp logo

odin's Introduction

ODIN

ODIN: Open Data INitiative

Build Status Codacy Badge License: GPL v3 Docs

Documentación en Español

English Documentation

English

ODIN is an API first open source DMS (data management system) created to help governments publish and share their data.

It takes in CSV, XLS and XLSX files and exposes them in a paginated REST API. The associated metadata is also available, with search and filter capabilities.

The UI is kept in two separate projects (Angular.js 1.x clients):

  1. Admin
  2. Frontend

The authentication, ACL, rate-limiting, CORS and related features must be handled by a Kong instance.

Requirements

ODIN is a Node.js app, built on top of the Sails.js framework.

It uses two databases: a relational one for storing metadata, and a NoSQL database (MongoDB) for storing the file contents. As with any Sails app, you can use whatever relational database you wish, as long as there's a Waterline connector for it. The default is PostgreSQL, and its Waterline connector comes preinstalled.

Currently there's no support for other NoSQL databases.

So, all in all you'll need:

  • Node.js >= 4.5.x
  • Npm >= 3.10.x
  • A relational database (PostgreSQL 9.5)
  • MongoDB >= 3.2.x

ODIN has not been tested with earlier versions of Node.js and MongoDB.

How to install

Kong

  1. Install kong according their web page instructions (depending on OS) Note: Use 0.8.x version

Ubuntu instructions:

        1. Download the package from https://github.com/Mashape/kong/releases/tag/0.8.3
        2. sudo apt-get update
        3. sudo apt-get install netcat openssl libpcre3 dnsmasq procps
        4. sudo dpkg -i kong-0.8.3.*.deb

Redhat instructions:

        1. Download the package from https://github.com/Mashape/kong/releases/tag/0.8.3
        2. Execute the following command: ``EL_VERSION=`cat /etc/redhat-release | grep -oE '[0-9]+\.[0-9]+'` && \ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-${EL_VERSION%.*}.noarch.rpm``
        3. Install Kong `sudo yum install kong-0.8.3.el7.noarch.rpm --nogpgcheck`
  1. Create the postgres database: db name: kong

  2. Move the configuration file odin/etc/kong.yml on /etc/kong

  3. Modify kong.yml configurations according needs

  • Line 102 to line 113, with kong database parameters
  • Line 244 with the path to mime.types file(odin/etc/mime.types)
  • Line 313 with odin-frontend path (odin-frontend/dist)
  • Line 387 with odin-admin path (odin-admin/dist)
  1. Open the file /usr/local/share/lua/5.1/kong/plugins/jwt/handler.lua and modify line 61, replace the content with ngx.redirect("/"); line 60 to 62 should look like:
  if not token then
      ngx.redirect("/")
   end
  1. Load the database dump odin/etc/kong_9.4.sql
  2. Start Kong
    $ sudo kong start

Odin

  1. Clone the repo
      $ git clone https://github.com/gcba-odin/odin.git
  1. Install dependencies. npm >= 3.10.x
      $ cd odin
      $ npm install
  1. Create Odin postgres database.

  2. Create the file config/local.js with the corresponding config/odin.js configurations according your needs

module.exports.odin = {
    baseUrl: 'http://localhost:3000', // --> Url where the api is hosted
    kongHost: 'http://kongexample.com', // --> Url where kong is hosted
    kongAdmin: 'http://kongexample.com:8001', // --> Kong port to acces configurations

    recaptchaSecret: 'GoogleRecaptchaSecretForTheAdminHere',

    uploadFolder: 'files', // --> Path to the folder where the datasets files will be stored
    datasetZipFolder: 'datasets', // --> Path where the datasets zips will be stored

    defaultEncoding: 'utf8',
    dataStorage: {  //--> NoSql database host and port
        host: 'localhost',
        port: '27017'
    },
    logFile: 'sailsApp.log', // --> File name and path of the log file
    logFolder: 'logs', // --> Folder where the logs will be saved
    logLevel: 'error', // --> Log level
    statisticsPath: 'stats', // -->Path where the statistics will be saved each month
    backupFolder: 'backups' // --> Folder where the backups will be saved
};
module.exports.email = {
  service: 'Gmail',
  auth: {user: '[email protected]', pass: 'accountpassword'},
  alwaysSendTo: '[email protected]',
  testMode: false,
  templateDir: 'api/views'
};

module.exports.connections = {
    postgres: {
        adapter: 'sails-postgresql',
        database: 'odin',
        host: 'localhost',
        user: 'postgres',
        password: 'postgres',
        port: 5432,
        pool: false,
        ssl: false
    }
};
  1. Start the app
      npm start
  1. Install sails-migrations sudo npm install -g sails-migrations
  2. Migrate databse sails-migrations migrate
  3. To make sure your app server will start back up if it crashes use pm2 npm install -g pm2
  4. Start the app with pm2 start process.json. For more information read pm2 docs
  5. Execute pm2 save and pm2 startup to generate the startup script

Troubleshooting

  • sh: 1: node: not found nodejs: Link node to nodejs. First whereis nodejs Then soft link node to nodejs ln -s [the path of nodejs] /usr/bin/node
  • fatal error: gssapi/gssapi.h: No such file or directory: Try installing the Kerberos Development Package: apt-get install libkrb5-dev
  • If g++ compiler is not installed, execute the following command: yum groupinstall 'Development Tools'
  $ cd /tmp && wget http://unicode.org/Public/UNIDATA/UnicodeData.txt
   $ export NODE_UNICODETABLE_UNICODEDATA_TXT=/tmp/UnicodeData.txt
   $ cd asi-75-odin-api/source
   $ npm install

Spanish

ODIN es una plataforma de gestión de datos, creada para ayudar a gobiernos a publicar y compartir sus datos

Toma archivos de tipo CSV, XLS y XLSX y los expone mediante una API REST. A su vez la metadata asociada está disponible, con funciones de busqueda y filtros

La interfaz gráfica está separada en dos proyectos separados (Angular.js):

  1. Admin
  2. Frontend

La autenticación, ACL, rate-limiting, CORS y funcionalodades asociadas, deben ser manejadas por una instancia de Kong.

Requerimientos

ODIN es una aplicación creada en Node.js, sobre el framework Sails.js.

Usa dos bases de datos: Una base de datos relacional para guardar metadata, y una base de datos NoSQL para almacenar el contenido de los archivos. Como en cualquier aplicación Sails, es posible usar cualquier base de datos relacional, siempre y cuando exista un conector Waterline para dicha base.

Actualmente no se cuenta con soporte para otra base de datos NoSQL.

Todo lo que se necesita:

  • Node.js >= 4.5.x
  • Npm >= 3.10.x
  • Base de datos relacional (PostgreSQL 9.5)
  • MongoDB >= 3.2.x

ODIN no fue probada con versiones anteriores de Node.js y MongoDB

Como instalar

Kong

  1. Instalar kong siguiendo sus instrucciones (dependiendo del SO) Note: Use 0.8.x version

Instrucciones para Ubuntu:

        1. Descargar el paquete desde https://github.com/Mashape/kong/releases/tag/0.8.3
        2. sudo apt-get update
        3. sudo apt-get install netcat openssl libpcre3 dnsmasq procps
        4. sudo dpkg -i kong-0.8.3.*.deb

Instrucciones para Redhat:

        1. Descargar el paquete desde https://github.com/Mashape/kong/releases/tag/0.8.3
        2. Ejecutar el siguiente comando: ``EL_VERSION=`cat /etc/redhat-release | grep -oE '[0-9]+\.[0-9]+'` && \ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-${EL_VERSION%.*}.noarch.rpm``
        3. Instalar Kong `sudo yum install kong-0.8.3.el7.noarch.rpm --nogpgcheck`
  1. Crear la base de datos en postgres: db name: kong

  2. Mover el archivo de configuración odin/etc/kong.yml a /etc/kong

  3. Modificar las configuraciones del archivo kong.yml

  • Linea 102 a linea 113, con los parametros de la base de datos de kong
  • Linea 244 con la ruta al archivo mime.types (odin/etc/mime.types)
  • Linea 313 con la ruta al repositorio del frontend (odin-frontend/dist)
  • Linea 387 con la ruta al repositorio del admin (odin-admin/dist)
  1. Modificar la linea 61 del archivo /usr/local/share/lua/5.1/kong/plugins/jwt/handler.lua reemplazando su contenido con ngx.redirect("/"); lineas 60 a 62 deberían verse de la siguiente manera:
  if not token then
      ngx.redirect("/")
   end
  1. Cargar el dump de la base de datos de kong odin/etc/kong_9.4.sql
  2. Iniciar Kong
    $ sudo kong start

Odin

  1. Clonar el repositorio
      $ git clone https://github.com/gcba-odin/odin.git
  1. Instalar las dependencias. npm >= 3.10.x
      $ cd odin
      $ npm install
  1. Crear una base de datos relacional de ODIN (postgres).

  2. Crear el archivo odin/config/local.js con las configuraciones correspondientes de config/odin.js basado en sus necesidades

module.exports.odin = {
    baseUrl: 'http://localhost:3000', // --> Url donde la api esta hosteada
    kongHost: 'http://kongexample.com', // --> Url donde kong esta hosteado (no modificar si está en el mismo servidor)
    kongAdmin: 'http://kongexample.com:8001', // --> Puerto para acceder a las configuracioens de kong (no modificar si está en el mismo servidor)

    recaptchaSecret: 'GoogleRecaptchaSecretForTheAdminHere',

    uploadFolder: 'files', // --> Ruta donde se guardaran los archivos de los datasets
    datasetZipFolder: 'datasets', // --> Ruta donde se guardaran los zip de los datasets

    defaultEncoding: 'utf8',
    dataStorage: {  //--> Configuracion de MongoDB
        host: 'localhost',  //--> en caso de tener un usuario y contraseña, ingrasar 'username:password@localhost'
        port: '27017'
    },
    logFile: 'sailsApp.log', // --> Nombre del archivo de logs
    logFolder: 'logs', // --> Carpeta donde los logs se guardaran
    logLevel: 'error', // --> Nivel de logeo
    statisticsPath: 'stats', // -->Ruta donde las estadisticas de la api se guardaran cada mes
    backupFolder: 'backups' // --> Ruta donde se guardaran los backups
};
module.exports.email = { // --> Configuraciones para el envío de mail
  service: 'Gmail',
  auth: {user: '[email protected]', pass: 'accountpassword'}, // --> Nombre de usuario y contraseña
  alwaysSendTo: '[email protected]',
  testMode: false,
  templateDir: 'api/views'
};

module.exports.connections = { // --> Configuraciones de la base de datos postgres
    postgres: {
        adapter: 'sails-postgresql',
        database: 'odin',
        host: 'localhost',
        user: 'postgres',
        password: 'postgres',
        port: 5432,
        pool: false,
        ssl: false
    }
};
  1. Inicia la aplicacion
      npm start
  1. Instalar sails-migrations sudo npm install -g sails-migrations
  2. Migrar la base de datos sails-migrations migrate
  3. Para asegurarse de que la aplicacion reinicie en caso de algún problema usaremos pm2 npm install -g pm2
  4. Iniciar la aplicación con el comando pm2 start process.json. Para mas información leer la documentación de pm2
  5. Ejecutar pm2 save y pm2 startup para generar el script de inicio

Troubleshooting

  • sh: 1: node: not found nodejs: Linkear node a nodejs. Primero ejecutar whereis nodejs luego linkear node a nodejs ln -s [la ruta de nodejs] /usr/bin/node
  • fatal error: gssapi/gssapi.h: No such file or directory: Instalar Kerberos Development Package: apt-get install libkrb5-dev
  • Si el compilador g++ no está instalado, ejecutar el siguiente comando: yum groupinstall 'Development Tools'
  $ cd /tmp && wget http://unicode.org/Public/UNIDATA/UnicodeData.txt
   $ export NODE_UNICODETABLE_UNICODEDATA_TXT=/tmp/UnicodeData.txt
   $ cd asi-75-odin-api/source
   $ npm install

odin's People

Contributors

widcket avatar maxiejbe avatar hpieroni avatar mtebele avatar labgcba avatar

Stargazers

Pablo avatar

Watchers

James Cloos avatar  avatar Gestión Digital avatar  avatar

Forkers

usuariobkp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.