Open nonsintetic opened 5 years ago
Thanks. I'am trying to install this also locally. Apache, PHP, mysql and Composer is installed. When I run: php artisan migrate I get the error: PHP Warning: require(/var/www/xxx/web/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/xxx/web/artisan on line 18
I just downloaded the zip from github and put the web folder in /var/www/xxx/. I have indeed no vendor directory in the web folder. It is also not in the download from github. How do I get this directory?
Hey @glsf91,
I didn't manage to make the entire setup work (and I'll reply with the details of my current issue as soon as possible), but I stumbled upon that error and got it working by first issuing:
composer install
in the /web directory.
Afterwards you can resume with artisan. Best regards!
@nonsintetic @ispeaknousa I'am completed the installation. I can also login on my local gbrigde.
At google account linking I have to add a url like /gbrigde/gapi/auth. But at my local website there is no /gbrigde/gapi/auth.
What to do?
Also something else:
https://
The link you need depends on how you setup your webserver. It's basically
Make sure you use https for the url and it actually works. You can access the url before entering it into google, if it gives you something (not 404, page not found etc.) it should be ok.
@nonsintetic Thanks now I understand a little more. Problem is my login is: https://yourdomain.com/index.php/login. And indeed https://yourdomain.com/index.php/login/gapi/auth is working.
But how do I get rid off index.php in de url ? I only kan get access to the site with https://yourdomain.com/index.php instead of https://yourdomain.com/
I use apache and in my virtual host there is: DocumentRoot /var/www/yourdomain/web/public/
You need to enable the 'mod_rewrite' php module. That will rewrite the URLs to not have index.php. The website has a .htaccess file that will handle all that part
Thanks. rewrite was enable but I had to add AllowOverride All
It is working now. I did a lot of things to make it work. Biggest problem was the vendor folder was not there. I first created a new laravel project with the right version (5.5) and copied it from there.
The vendor folder is usually created by composer install
when it pulls the proper dependencies listed in the composer config file (there's one in the web folder). Glad you got it working though.
Ok, here's my issue: whenever I try to change the user password, the next error is being raised by laravel:
preg_match(): Compilation failed: escape sequence is invalid in character class at offset 46 at /opt/gBridge/web/vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php:1069)
which appears to be the function which validates password characters.
This seems strange because my password matches the regex from here (it includes letters, numbers and a special character).
Is anyone else experiencing the same behavior?
Software versions:
That password error only appears in PHP 7.3+ where they changed the PHP PCRE engine version. The new version is incompatible in some cases. The problem is most likely related to a hyphen not being escaped. You can either modify the pattern used by preg_match in that file, or use a lower php version. Should be a different issue since it's not related to self-hosted or not.
Is anyone else experiencing the same behavior?
Software versions:
- PHP: 7.3.12
- Laravel: 5.5.45
- Composer: 1.9.1
No issue here. I use PHP 7.2
Thank you both!
I've left it running with 7.3 (manually changed the password in the database) and I'll open a separate ticket for it.
Another thing related to self-hosting: the .env
properties file is cached by artisan, so if anyone has to adjust some properties, the command php artisan config:clear
has to be run, otherwise the new changes will not be taken into consideration.
Do you think it can run on a raspberry pi model b? Would it be possible to download an image with everything setup or does it need to be installed separately?
Do you think it can run on a raspberry pi model b? Would it be possible to download an image with everything setup or does it need to be installed separately?
That's what I run it on, it barely uses any resources, you'd probably be able to run it on a Pi Zero too. The SSL certificate and domain setup would have to be automated somehow since it's different on each install.
Is this solution still works? I see the messages are 1 year old and I want to install it for myself. I know gbridge is not developed anymore.
Have not used it since then. Can't say for sure.
I'am still using it.
@glsf91
I setuped the code and its working for me. I have an issue
can you please help me out with google auth with response_type as code instead token
Google stopped Oauth implicit method
https://gbridge.kappelt.net/gapi/auth? response_type=token &client_id=yBNscwpWneC3MfBp2t3crxfKSDnpz5MYKMbLg2affznBRtPU &redirect_uri=https://oauth-redirect.googleusercontent.com/r/kappelt-gbridge &state=AGsGMl1UTVQiyrwwXcN9bRD_VOoVjOdpQDrzOV8XkadjixFPIzaeRuX5rAeV6G7UqfJZn0zuJ55o6SRUi5mlpXXKweVA1cJBGMGVBYbTTi1RnB8ucg9xY9t7xROKk9p5G56b5OOThnjSbP_uixtRgm_rQSZchCF0tReNk7UpaZJU3xo9t_OtkGDDfONODMIM11JUPImcwcT_hszUwFc4uuQvzVl3RU50dES18vfLRSRkoI0hppSF9NSAaAv9l_DYyr486A7Bi1q_Q0KMS6Tu9r3jyoWoTYfR8Qa69Eir9Zr7RtLP-6m4ULE7BU9I21Zu1SMpETBuo483pH3iXS9dDg0OL4Gsc8up2WhbNS22ssEfx8j_VPRsm9Gb7MEU145IipZ8gwdjy-PhCvMpGYRcTDmkFuUzuWyjJSL2S4IGfDtKh4DVvTPGQbuQWFVF5aaVBqmsRB9xG1evXW5P-RGbK2PTPs_J4FzRgdossUMrPziFbDFCw3UtRDXa2jfT3R5SBedGhR5mYJOKBXIowX8Vmx3PnHGwHXiXnu5dDNrrbjbh4X0-ogJXaNVRBQ99XkzMrhDcpEMw4E-1LZ-fnqrS_fVWPNBCFYVNYIQU_qAzg3ONns01bDemuRYAD1j174-jYKM99mV1Qu1b90y8Nvs-Ejs3AVza6g3n8w
/gapi/auth? response_type=code &client_id=12345600457 &redirect_uri=https://oauth-redirect.googleusercontent.com/r/gbridge-999b &state=AGsGMl0FqwFDxsArzV92Pj
Thank You
I've managed to get the whole system up and running without Docker, so here's more of an outline on what you need to do. The whole thing works fine on a Raspberry Pi 4, should work on any modern Linux system, all the things used are very basic programs.
Follow the gBridge tutorial up to the 'docker' parts and then follow the steps below. I'll try to do a more detailed tutorial with commands, but this is for people having trouble with the recent server outage. There's two parts you need to get running for this to work: an admin website which handles creating accounts/devices and the oAuth part required by Google, and two nodejs apps that handle the actual bridging of commands from the Homekit API to the MQTT server. The admin app is just a normal PHP website built in Laravel. Here's some basic steps you have to follow:
First you need to setup a basic webserver WITH PHP, MYSQL AND SSL (apache/nginx + mariadb/mysql + letsencrypt's certbot) to serve the Laravel website (in the /web folder) just like any other website. Laravel's public stuff is in the /web/public folder, so you either need to add a .htaccess in the /web root to rewrite everything to /public, or you can setup the directory in your webserver's config (in Apache it's a VirtualHost directive). You also need some sort of domain name, a dynamic DNS if you have a dynamic ip, or just a classic domain if you're on a static IP. You'll also need some PHP extensions installed: php-xml, php-mysql.
(If you already have a webserver with PHP up and running, then you're absolutely gold. Just copy the /web folder and do a redirect. Make sure you have a domain name and SSL certificate.)
All the settings for the Laravel app are in the
.env.example
file, which you have to rename to.env
for it to work. The actual values you can copy from the docker generator mentioned in the gBridge tutorial (the part about docker). You'll have to run your database locally, so the link to it would be 'localhost', same for any other services. You also have to skip the whole Proxy setup in Apache/Nginx that is mentioned in the main tutorial. This will be a run of the mill, basic PHP+MYSQL setup, just like for Wordpress or any other website.(For this whole webserver part you can google individual tutorials for each piece 'php mysql ssl server setup raspberry pi' for example, or 'apache php install debian', 'certbot install debian' etc. Since it's Laravel, you can also find tutorials on how to install a Laravel app/website on a server, it should be pretty straightforward.)
Next step is to navigate to the root folder of the website in SSH or console (not browser) and run the 'artisan' script using php's commandline tool. The command is
php artisan migrate
. 'artisan' is part of the Laravel (the framework used to build this admin website). It's a php script that can do various tasks in Laravel, like importing database entries. This will create all the necessary database tables for the website. That might give you errors about various PHP extensions missing on your machine, just install and enable those until it all works (usually it's justapt-get install <extension name>
).You'll know the whole website part is correct when you can access the website on your own server and log in (artisan will ask you for an e-mail, it will create a first account and setup a password for you). Once logged in everything on the web side is exactly like the hosted solution, you can make multiple accounts, add devices for each of them, setup mqtt topics etc.
During device creation you'll get some errors, this is because you're still missing 2 nodejs apps. (these are not required for linking your account, but it's better to just install them too before linking, less errors). These two apps handle the sending and receiving of the actual actions, in essence these do all the hard work magic that makes the system work.
To run these you need to first install nodejs, if you have node-red you already have it (nodered is a nodejs app). You also need Redis, a caching system, install that too. After all this you need to run
npm install
in each of the 'redis-worker' and 'rs-worker' folders. This will install all the required nodejs libraries for each app. You then need to add the Redis server's IP to each 'config.sample.js' file in these folders and rename them to 'config.js'. To run a node app as a test donode index.js
and the app should start, it should output some text and tell you it's connected. You only need the 'redis-worker' to actually control devices, so just run that in the console for testing at first. The rs-worker will handle sending the state of the devices back to google so you see the device state there too, it's not 100% required to just turn stuff on/off etc. You can create systemd services to keep these running in the background on most Linux distros that have systemd (ubuntu, debian, rasbian etc.). Google 'nodejs systemd' and you'll find tutorials, it's just making a text file and running some commands, then you can run them on startup just like any other service (there's also pm2 as a way to turn nodejs apps into services, but that's way more involved, it's a separate app).If you managed to get all that crap working, it should work just like the hosted solution. Whatever issues you encounter, just google search and hope for the best. It is 100% running with the code here on a Raspberry Pi 4, I've done it today, i can confirm it. All the required pieces should be available as 'apt-get' packages, easy to install on any common linux system.