Coder Social home page Coder Social logo

arais's Introduction

ARAIS

ARAIS is a Recursive Acronym for an IoT Server

What it is

Welcome to ARAIS. ARAIS is an IoT server, written in PHP, using no dependences at all. Everything it needs is part of the code. It use SQLite for data storage and provide a very clean REST collection of APIs, to make it easy to be consumed by small IoT devices.

The collection of APIs can handle device and sensors registration, save and retrieve data from sensors and also the users and permissions management.

It use JWT to garatee the data integrity, and provide authentication and authorization compoenents as well.

The goal of this project is not to replace complex IoT servers already in the market, but provide a lightweight solution for the hobbist that have some knowledge and skills as a PHP developer.

The final result is so simple and light that I can run it inside my NAS server at home using PHP 5.5 and Lighttpd webserver or in a free hosting server with Apache and lots the restricions (I run it at AwardSpace with a free account).

Motivation

I start this project as a personal project and decide to publish it in the hope to help other developers with similar requeriments. In my free time I like to play with Arduino, Raspberry Pi and other small devices, and one key point on these kind of solution is to send the data from sensors to somewhere in the internet, where I can read it later, create dashboards and so on.

One can find many IoT servers in the internet, huge and complex open sources projects or many of then as PaaS solutions, offering some kind of free plan... with many limitations. As a developer, I could not find a simple and easy IoT server's source code to use as an start point for my projects and avoid the limitations of the free PaaS plans.

So I decide to start this project.

Installation

Quite straight forward. Get the code, copy it to your webserver, update the environment variables from the next section with ones that make sense for your setup and using the database.sql dump from the repository create a SQLite file called data.sqlite.

The database requirements is quite simple, so it's possible to port to a MySQL database. I have added some env variables in the next section. Small changes in the query db abstraction class will be necessary, but anyone with some PHP background should handle it.

If you find any difficuties, let me know and we can update this document with more steps.

Environment variables:

ARAIS need a couple of env. vars to work. This vars can be added inside your .htaccess file, if you have mod_env enabled in your Apache server or equivalent. If you don't have access to it, you can simple add a .env.php file in the root folder, together with your index.php file. Bellow you have an example of this last case, with a list of all Env Vars needed by ARAIS.

Please, be aware that index.php have a line requering .env.php. If you decide to create the vars inside your .htaccess, you need to create an empty .env.php or remove the require inside the index.php.

The ideia behind this env vars is to separe the information that change in differents environment where you run your application (e.g. your localmachine vs your production server).

// SQLite env
putenv('SQLITE_FILE_NAME=data.sqlite');

// MySQL env example
// putenv('MYSQL_HOST=[my_arais_mysql_server]:[port]'); // Database Server Host
// putenv('MYSQL_DB=[my_arais_db]');       // Database Name
// putenv('MYSQL_USER=[my_db_user]');           // Database Username
// putenv('MYSQL_PASSWD=[my_db_passwd]');         // Database Password

// Time Zone of the application
putenv('APP_TIME_ZONE=America/Sao_Paulo');

// LOGGING INFORMATION
// PHP
putenv('PHP_ERROR_REPORTING=E_ALL');
putenv('PHP_DISPLAY_ERROS=1');

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.