peartreedigital / boilerplate

My boilerplate for multi-tenancy websites using Laravel 5.7 and Hyn/Tenancy 5.3. Highly based on the tutorial by Ashok Gelal (https://blog.usejournal.com/writing-a-full-featured-multi-tenant-laravel-app-from-scratch-a0e1a7350d9d, I've kept the name Townhouse to honor him) and on the collective work you can find on Discord's Tenancy server
13 stars 6 forks source link

Error: Database [tenant] not configured #1

Open clemir-legon opened 6 years ago

clemir-legon commented 6 years ago

Good morning, I am using the boilerplate and I think it is an excellent job, I am a user without much experience in laravel and less experience in multi tenant, I have a project in which I would like to implement it, but when downloading the boilerplate and creating the database and make the configuration in the respective database.php and .env files, I proceed to create the tenants using the php artisan tenant: create command and said tenant is created successfully, but when entering the web page of the project and start session, register the user, or request the password, I get the error Database [system] not configured, I've already used different development environments and I'm reading the code and I could not find the solution, I do not know if I'm making any mistakes or I'm skipping some step. Thank you!

crodrigor commented 6 years ago

I have error. "Database [tenant] not configured"

theWhK commented 6 years ago

Hi there! Have the same problem (specifically, "...[tenant] not conf..."), if my mind isn't fooling me... Problem was misconfiguration on .env. I'm using Laradock, so the MySQL was running on a container.

Which database are you guys using? Can you post the traceroute, or a log, where we can dig deeper on the problem?

[]'s

crodrigor commented 6 years ago

I tried with mysql e postgres, postgres with docker ubuntu, both with error. Sorry my english

theWhK commented 6 years ago

Try to undo the modifications in database.php file. It is not necessary to change the parameters over there when you already defined the connection on the .env file.

(Também sou brasileiro, colega! Caso tenha muita dificuldade em digitar algo, escreva em português, traduza-o no Google e coloque o texto nos dois idiomas aqui. Farei o mesmo se for o caso, pois lhe facilita, além de não interferir no entendimento dos gringos :D)

crodrigor commented 6 years ago

rsrs.. Cool, I'll try again, anything I return. Thank you!!

LarryBarker commented 5 years ago

@theWhK Having the same issue after following Steps 3 and 4 of the tutorial (which I know was done with 5.1).

InvalidArgumentException thrown with message "Database [tenant] not configured."

Stacktrace:
#73 InvalidArgumentException in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:140
#72 Illuminate\Database\DatabaseManager:configuration in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:103
#71 Illuminate\Database\DatabaseManager:makeConnection in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:74
#70 Illuminate\Database\DatabaseManager:connection in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:1239
#69 Illuminate\Database\Eloquent\Model:resolveConnection in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:1205
#68 Illuminate\Database\Eloquent\Model:getConnection in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:1035
#67 Illuminate\Database\Eloquent\Model:newBaseQueryBuilder in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:952
#66 Illuminate\Database\Eloquent\Model:newModelQuery in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:988
#65 Illuminate\Database\Eloquent\Model:newQueryWithoutScopes in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:941
#64 Illuminate\Database\Eloquent\Model:newQuery in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Auth\EloquentUserProvider.php:114
#63 Illuminate\Auth\EloquentUserProvider:retrieveByCredentials in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Auth\Passwords\PasswordBroker.php:190
#62 Illuminate\Auth\Passwords\PasswordBroker:getUser in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Auth\Passwords\PasswordBroker.php:60
#61 Illuminate\Auth\Passwords\PasswordBroker:sendResetLink in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Auth\SendsPasswordResetEmails.php:34
#60 App\Http\Controllers\Auth\ForgotPasswordController:sendResetLinkEmail in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:54
#59 call_user_func_array in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:54
#58 Illuminate\Routing\Controller:callAction in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php:45
#57 Illuminate\Routing\ControllerDispatcher:dispatch in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Route.php:212
#56 Illuminate\Routing\Route:runController in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Route.php:169
#55 Illuminate\Routing\Route:run in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Router.php:682
#54 Illuminate\Routing\Router:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
#53 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\app\Http\Middleware\RedirectIfAuthenticated.php:24
#52 App\Http\Middleware\RedirectIfAuthenticated:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#51 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#50 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php:41
#49 Illuminate\Routing\Middleware\SubstituteBindings:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#48 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#47 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php:75
#46 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#45 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#44 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php:49
#43 Illuminate\View\Middleware\ShareErrorsFromSession:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#42 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#41 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php:63
#40 Illuminate\Session\Middleware\StartSession:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#39 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#38 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php:37
#37 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#36 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#35 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php:66
#34 Illuminate\Cookie\Middleware\EncryptCookies:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#33 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#32 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:104
#31 Illuminate\Pipeline\Pipeline:then in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Router.php:684
#30 Illuminate\Routing\Router:runRouteWithinStack in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Router.php:659
#29 Illuminate\Routing\Router:runRoute in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Router.php:625
#28 Illuminate\Routing\Router:dispatchToRoute in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Router.php:614
#27 Illuminate\Routing\Router:dispatch in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:176
#26 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
#25 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\fideloper\proxy\src\TrustProxies.php:57
#24 Fideloper\Proxy\TrustProxies:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#23 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#22 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php:31
#21 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#20 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#19 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php:31
#18 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#17 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#16 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php:27
#15 Illuminate\Foundation\Http\Middleware\ValidatePostSize:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#14 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#13 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php:62
#12 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#11 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#10 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\hyn\multi-tenant\src\Middleware\EagerIdentification.php:29
#9 Hyn\Tenancy\Middleware\EagerIdentification:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#8 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#7 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\hyn\multi-tenant\src\Middleware\HostnameActions.php:76
#6 Hyn\Tenancy\Middleware\HostnameActions:handle in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:151
#5 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#4 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:104
#3 Illuminate\Pipeline\Pipeline:then in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:151
#2 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in C:\Users\lbarker\Code\townhouse\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:116
#1 Illuminate\Foundation\Http\Kernel:handle in C:\Users\lbarker\Code\townhouse\public\index.php:55
#0 require_once in C:\Users\lbarker\Code\townhouse\server.php:21
serkandyck commented 5 years ago

Problem on dns resolving, if you try real server not local that work.