This repo is one of a few repos that make up the whole project. RoboHome-Web is the codebase that represents the frontend of the RoboHome project. The web interface provides a way to create users, add and manage devices, and an additional way to control devices. RoboHome-Web is primarily built using PHP with Laravel for MVC and routing, MySQL for the database, and Bootstrap for layout and basic mobile support.
RoboHome is a SaaS tool that also integrates with Amazon's Echo to enable control of semi-connected devices (think IR, and RF) in your house over wifi! This is done using an MQTT pub-sub network to send messages between the website or Echo to a microcontroller like the ESP8266 which has various transmitters hooked up to it (like IR and RF transmitters) to send signals to these devices. This can be used to control RF outlets with lights plugged into them, or to turn on your TV and change channels for instance.
- Web server with PHP 7.1.3 or greater with MySQL
- SSL/TLS cert available for Free with Let's Encrypt. Note, we must use slightly less secure ciphers than the max due to hardware limitations of the ESP8266 which will need to talk to the RoboHome-Web API over HTTPS to gather information about devices. If set up correctly, by entering your website in SSL Lab's SSL Server Test, you should still get an "A" rating. To get the appropiate ciphers for your server visit Cipherli.st and click "Yes, give me a ciphersuite that works with legacy / old software."
- MQTT broker for pub-sub. I personally use CloudMQTT. This service is used to send messages from a web service to a microcontroller.
- Composer dependency manager for PHP
- Rename
.env.example
to.env
and populate the information needed to connect to your MQTT broker and MySQL database (underDB_CONNECTION
). - Run
composer install
from the root folder to download and install third-party PHP dependencies. - Run
php artisan key:generate
from the root folder. This will populate theAPP_KEY
field in the.env
file. - Run
php artisan migrate
from the root folder. This will setup the database using the connection settings defined in the.env
file. - Run
php artisan passport:install
from the root folder and save the output to a safe location. The output will be needed later to help configure 3rd parties (like Amazon) to authenticate with RoboHome. - Run
php artisan serve
from the root folder to start the website. This command will print to the terminal the local URL where you can visit the website in your browser.
This project uses Docker Compose to help easily emulate a test environment for rapid development and testing. This container has the PHP, MySQL, and phpMyAdmin services.
- Start Docker and execute
./StartDockerAndRunTests.sh
. This will create a backup of the.env
file, download and start all the containers, configure Laravel, run all the tests, and then restore the.env
file.- Once running, visit
http://localhost
to view the website. To access phpMyAdmin, navigate tohttp://localhost:8183
and login with the following credentials; username:root
, password:password
(these credentials come from.env.docker
if you want to change them). - This is a good step to execute before contributing code.
- Once running, visit
- To run custom commands inside the container running Laravel, pass the command to
web.sh
like./web.sh composer install
.
Contributions are always welcome! Please fork this repo and open a pull request from a new branch with your code or feel free to make an issue. All pull requests will need to be reviewed and pass automated checks. If feedback is given on a pull request, please submit updates to the original pull request in the form of fixup! commits which will later be squashed before the pull request is merged.
For more information, consult the contributing guidelines.
This repo supports the principles of Bob Martin's Clean Code.
- Before you release this application...
- If you're using Docker Compose, please take the time to update the username and default password to be more secure. The current implementation is designed for running this application locally.
- Secure your Laravel installation by making the following changes to your
.env
file:- Change
APP_ENV
toproduction
- Change
APP_DEBUG
tofalse
- Change