-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DB_HOST is used by apps such as the realworld.io laravel demo app #11
Comments
Hi did you get a resolution for this not working, as I am having the same problem, but using my own app... basically using this template migrations fail as the DB cannot be reached. Is it as simple as adding the following to the env section?
|
@J5Dev The working env vars are shown here: https://github.com/simbo1905/laravel-realworld-example-app/blob/master/.env.example If you use those settings it will work. I don't like having the settings outside of a here is where I mount the secret as the environment of the deployment https://github.com/simbo1905/laravel-realworld-example-app/blob/1a6c256a36a831dd56dc655cd015073b1cbecdbd/openshift-template.json#L182 it uses $NAME so the name of the secret has to match the name of the deployment which is a good convention. Here is the script that creates the So I run that with Obviously, you don't want to commit your secrets into Git! So the Finally, we use |
@J5Dev I documented all the steps to use both laravel and reactjs on openshift at https://gist.github.com/simbo1905/d27ba7218a2fd71fcb4f0fcede82fd6d#build--run-the-realworldio-laravel-backend-demo so you might want to try those out using my version of the code. Note it is using my copy of the demo which is listed at the top of that page not the version at this repo. |
Thanks for this super useful, more than enough to get me on my way :) For reference, here's what I am putting together... basically similar to this repo, but based from an Ubuntu image, (I prefer it to CentOs, Im just me :) ), and with Redis, and plan to build a few other things in as well. My Laravel App: https://github.com/J5Dev/laravel-test-app |
Our stuff is proprietary code in production on Openshift Online Pro on AWS so we run rhel7 images to get long-term support security patches. In the oc and k8s world the distro shouldn't really make any difference as it allows us to focus on the application and not the incidentals of the environment. |
Totally with you, and in the same boat going a very similar way, and will most likely end up on the RHEL images... though with IMB not AWS. I'm more using this as a vanilla way to build up the config/templates etc. without exposing any prod code. After all once I know it will build and run the base Laravel, anything after that is easy to find and quash :) Thanks for your help though, put me on the right track, I just need to add the secret generation to my build config and have it bind it into the env. Will post the code once done for anyone else finding this :) |
Cool. Here's a script that scans RedHat long term support s2i image and compares with what you have in your openshift registry and outputs the commands of import new images and apply it to your builds https://github.com/UniqKey/openshiftbot/blob/master/bin/nodejs-8-rhel7.sh Thats the node version about to setup the same for the PHP s2i. |
Awesome, thanks for the help! |
Just thought I would leave an update, should anyone else land here... In order to get this to work still using my template approach, I have had to add an additional parameter which captures the project name as it isn't yet available to just reference within a template, (see here for details). So what I now have is: Parameter reference
And then using this added it to the env declaration in the nginx/php containers deployment config
This solved my problem. |
The template sets DB_SERVICE_NAME but an app like laravel-realworld-example-app need DB_HOST which can be set by the template as mysql.{project}.svc.
The code at https://github.com/simbo1905/laravel-realworld-example-app.git is the realworld.io demo app setup to run on this openshift template yet it wont run unless the php deployment is edited to set the DB_HOST correctly.
The text was updated successfully, but these errors were encountered: