Install All Components: Difference between revisions
(One intermediate revision by the same user not shown) | |||
Line 70: | Line 70: | ||
=== Install Apache2 === | === Install Apache2 === | ||
sudo apt-get install apache2 | |||
The web application use Laravel and can be run on Apache server. | The web application use Laravel and can be run on Apache server. | ||
Line 105: | Line 107: | ||
create database scotchbox with owner root; | create database scotchbox with owner root; | ||
===Install web application to apache=== | |||
More information about install Laravel application: https://laravel.com/docs/5.4/installation | More information about install Laravel application: https://laravel.com/docs/5.4/installation | ||
#Clone project to /var/www | #Clone project to /var/www | ||
cd /var/www | cd /var/www | ||
git clone https://gitlab.com/unamur_iot/web-app-server-unamur | git clone https://gitlab.com/unamur_iot/web-app-server-unamur | ||
#Set folder permission. The folder storage and bootstrap/cache should be writable by the web server: | |||
cd web-app-server-unamur | |||
sudo chown -R www-data:www-data storage/ bootstrap/cache | |||
#Install composer dependency | #Install composer dependency | ||
composer install | composer install |
Latest revision as of 15:05, 22 December 2017
BLE Proxy
Install python library
- Install paho-mqtt library:
sudo pip install paho-mqtt
- Install bluepy
sudo apt-get install python-pip libglib2.0-dev sudo pip install bluepy
More information about installation:
mqtt: https://pypi.python.org/pypi/paho-mqtt
bluepy: https://github.com/IanHarvey/bluepy/
Run BLE proxy on Raspberry Pi 3
I upload my code to gitlab.com: https://gitlab.com/unamur_iot/python-rpi-component
- Clone the repository to a Raspberry Pi 3
git clone https://gitlab.com/unamur_iot/python-rpi-component
- Go to folder called proxy_ble
- Configure MQTT Broker
edit config.txt file update broker host, port, username, etc.
- Run the code with:
sudo python main.py
LoRa Proxy
Install paho-mqtt
LoRa Proxy also use paho-mqtt library. We don't need to install it again, if we installed it already.
- Install paho-mqtt library:
sudo pip install paho-mqtt
More information about installation:
mqtt: https://pypi.python.org/pypi/paho-mqtt
Run LoRa Proxy on Raspberry Pi
I upload my code to gitlab.com: https://gitlab.com/unamur_iot/python-rpi-component
- Clone the repository to a Raspberry Pi 3
git clone https://gitlab.com/unamur_iot/python-rpi-component
- Go to folder called proxy_lora_client
- Configure MQTT Broker
edit broker.txt file update host, port, etc.
- If we want to configure TTN, and private LoRaWAN
edit network_info.txt update ttn username, etc.
- Run the LoRa proxy module
sudo python proxy.py
Web Application
I upload my code into: https://gitlab.com/unamur_iot/web-app-server-unamur use the username: unamur_iot, password: lora1234
Install php
sudo apt-get install php
Install Apache2
sudo apt-get install apache2
The web application use Laravel and can be run on Apache server.
- Install php library that laravel use:
sudo apt-get install php-pgsql php-xml php-common php-mcrypt php-mbstring
- Enable mode rewrite on Apache
Run
a2enmod rewrite
Add "AllowOverride all" to apache config file in /etc/apache2/apache2.conf
Change "AllowOverride" none in directory we of our application (ex: /var/www) to "AllowOverride all"
Restart Apache
service apache2 restart
Install composer
Laravel use composer to manage dependency. we need to install composer. More information about how to install composer: https://getcomposer.org/download/ Run the following command to download and install composer:
- Download composer setup php file
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- Execute composer setup php file
php composer-setup.php
- Remove composer setup php file
php -r "unlink('composer-setup.php');"
- Add composer to execute command
sudo mv composer.phar /usr/local/bin/composer
- Create database and user on postgresql
Note:To install postgresql for different machine is available on official website: https://www.postgresql.org/download/
Enter this command to go to psql console:
sudo -u postgres psql
Create user name "root" with:
create role root with login password 'root';
Create database name "scotchbox" for user "root":
create database scotchbox with owner root;
Install web application to apache
More information about install Laravel application: https://laravel.com/docs/5.4/installation
- Clone project to /var/www
cd /var/www git clone https://gitlab.com/unamur_iot/web-app-server-unamur
- Set folder permission. The folder storage and bootstrap/cache should be writable by the web server:
cd web-app-server-unamur sudo chown -R www-data:www-data storage/ bootstrap/cache
- Install composer dependency
composer install
- Copy .env file from .env.example
cp .env.example .env
- Generate Application key by running:
php artisan key:generate
- Update database, username, password in .env file to match machine configuration
edit .env file update database name, username, password, etc.
- Migrate database and seed database
php artisan migrate --seed
- Install Laravel Passport for API Authentication:
php artisan passport:install
- Change apache root directory to project public folder:
cd /etc/apache2/sites-available nano 000-default.conf Change the "DocumentRoot /var/www/html" to "DocumentRoot /var/www/web-app-server-unamur/public"
Cache Module
Install redis cache to server
- Before installation:
sudo apt-get update
- Install Build tool and tcl:
sudo apt-get install build-essential sudo apt-get install tcl8.5
- Install Redis
wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make make test sudo make install cd utils sudo ./install_server.sh
More information about redis installation:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis
https://redis.io/topics/quickstart
Install cache module for web application to get MQTT data from sensor
- Clone the module code into the server
git clone https://gitlab.com/unamur_iot/python-rpi-component
- Go to folder named redis-client
- Edit mqtt-config.txt
- Update host, port, etc.
- Run the module
python main.py
Android TV App
I upload my android tv code to: https://gitlab.com/unamur_iot/TVAppIOT.git
- Install android studio:
Follow the official guide for installation: https://developer.android.com/studio/index.html
- Clone the project:
- Run android studio
- Select File->New->Project From Version Control->Git
- Parse the project url:
- Edit folder name and click "clone"
- Edit network configuration:
In project source code there is a file call "Application" Update "AUTH_BASE_URL" for web application url, "CLIENT_SECRET" OAuth password grant client secret
- Build Apk file:
In android studio click: Build -> Build APK(s): The build API is located at: app\build\outputs\apk\debug
Note: We can use dropbox to upload the apk to android tv device.