DigitalOcean App (Laravel) is Not Connecting to Managed MySQL database, times out - laravel

I have a rather large Laravel 8 Project I am moving from Digital Ocean Droplet into Apps.
I specified all DB_* environmental App-Level Environment Variables exactly like they are in my prod .env
I have added that Database as resource in my App (with username/database).
I made sure my App is in Trusted Sources on that Database.
Yes, I am using public credentials as Apps do not live in VPC
I push Deploy and build goes fine until it reaches php artisan package:discover and it just times out there for 30+ seconds and deploy crashes.
If I omit database configuration altogether (i.e. empty DB_* App-Level Environmental Variables) - package:discover runs fine, however, there is no connection to db.
Even if I skip package discovery and allow build to finish, I am UNABLE to connect to database from Apps with credentials provided by DigitalOcean.
Unfortunately build never happens so I cannot even see the logs.
The same Laravel code connects to the same database with same credentials on a Droplet without a problem.
Again this is DO managed Database. I cannot really access it and mess with users. Also Apps does not have static IP address to add it to Trusted Sources. Only can be added by name.

Related

Laravel DotEnv not reading server environment variables

I'm trying to get a Laravel app working in an automated deployment setup.
Everything deploys fine, but I get the following 500 hundred error.
Illuminate\Encryption\MissingAppKeyException: No application encryption key has been specified.
Now, there is no .env file but the variables are all defined already on the server. If I ssh into my server and type env I can see APP_KEY in the list with the right value, but my Laravel app can not see it.
I have tried refreshing caches etc, but still, it doesn't work.
Can Laravel not use server environment variables?
if APP_KEY already in .env, may you run php artisan config:cache.

Accessing a Firebase-deployed App over a VPN

I built an app to offer a client of the company I work for that I deployed to Firebase. It uses Firebase storage for retrieving files as well as the realtime database. It's actually just the front-end portion of a two-app suite I made; the backend portion is used by an admin for uploading files, checking data, etc --- which data then becomes available to view over the frontend. Both use firebase.
It turns out the devices that would need to access the app (tablets mostly) are inside of an extranet with a server that can establish VPN connections only. Now I'm being asked how I can build the app so these devices can access the app.
I don't know much about the inner-workings of Firebase but it seems to me I may have couple of options:
1) Figure out how to make the FB database accessible over VPN (preferable)
2) Reconfigure the app to use something like MongoDB. Instead of deploying on a remote server, let the on-site server service the devices using the app. Send files that are needed by the server via FTP over the VPN, then process these files on-site.
Problem: I'm using a Mac and the on-site server uses Windows. It will be a pain to install things on a Windows machine remotely, let alone set up the VPN.
Any ideas? I'm sure there are parts of this question where I've made wrong assumptions --- I've never needed to do things over a VPN before.

how to upload Laravel project on Bitbucket?

i want to share my Laravel(version 5.4.12) project with client, but i didn't use BitBucket before and i have no idea how to upload my Local project on Bitbucket with Database and how to access. My client want to update him daily.. so please help me out
Just create a new repo on bitbucket, then select the option that reads
I have an existing project
They will give you all instructions how to upload existing project to bitbucket.
You cannot upload your local database to bitbucket by default, unless you manually download it and place it somewhere in your project, then on your next push, it will be uploaded.
But your project already goes online with all migrations. So you can use migration on the server to install the database.
How to link with website
Once on bitbucket, your code is now available online. Then you need to connect on your server on ssh. Once connected, you can navigate where you want to install it and clone the repo.
after cloning the repo on the server when you want to link the website, you can run usual commands like php artisan migrate --seed to create and populate the database.
Make sure you create .env file online. It won't be available on bitbucket.
You can use ngrok to expose your locally hosted project over secure tunnels to the public internet even if your local host is behind NATs and firewalls . It is very easy to use, for example after you have downloaded ngrok, by running ngrok http 8000 from the command line and it will give you a URL which will expose what is normally localhost:8000 for you. Give that URL to your client and they will be able to access your localhost.
You can find ngrok here - https://ngrok.com
You can only show the progress to the client if you have deployed the project on a server or if the client can pull from bitbucket and run on their own localhost but am assuming you are not going that way so upload it on a test server.

Setup Laravel 5 Application without command-line access

Is it possible to Setup Laravel 5 Application without command-line access?
It's a common task do these commands with Laravel 5:
composer install
php artisan migrate
php artisan db:seed
gulp
[...]
Consider a non-dedicated server without SSH access, how can I setup the application in that environment?
Yes it is possible.
Briefly, when you have developed your Laravel on local environment you need to use FTP client/software (Like FileZilla FTP client) to upload the content to your host provider.
Before that you need to ensure some technical details so it can work
Ensure have write permission to folder Storage.
All Laravel folder should be upload, but the domain should point to Public folder.
You need to configure your host MySQL database information in your project.
And it should work, the only challenge left here is to ensure you find host providers that allow make modifications on 1 and 2.
I suggest you to try it before distributing it to your customers and make a step-by-step guideline, as there is risk for unseen scenarios.
In addition to my answer, few links for reading:
http://novate.co.uk/deploy-laravel-5-on-shared-hosting-from-heart-internet/
https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e#.vv4wgkdrw
Deploy Laravel 5 using only FTP in a shared hosting

Connect to a Heroku app after directory (and all other data) deleted on local machine

I lost all the data on my localmachine (Macbook Pro) and, to make matters worse, the repo for a Rails app hosted on Heroku has also been deleted on github. Since I lost all the data on my localmachine, whatever security keys I had installed have also been deleted so if I try to connect to Heroku it won't even recognize me. What can I do in this situation to download the app and export the database?
Are you still able to log into heroku.com? If so, you should be able to set up the heroku CLI again with a new public key. Then you should be able to use heroku git:clone APP to get the code from heroku.
With your database, there should be options for managing it on heroku.com or via the heroku CLI (e.g. heroku pg:pull if you're using postgres).

Resources