-
Notifications
You must be signed in to change notification settings - Fork 168
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
How to connect to external database? #188
Comments
For anyone looking at this in the future... Everything is there for you to build a local docker image based on this github repo. If you are using Windows switch over to WSL2 using vscode. IN the root of the project run:
which will generate local versions of each php version specified in the /images/ folder of the repo. For myself I still had issues running this process, specifically with outdated packages in any of the php 7.* dockerfiles. I just deleted those folders from the project, which got me further but I still ran into build issues with the php8 image. I had to modify how it grabbed python-certbot-apache as it is now python3-certbot-apache. Here is my modified Dockerfile:
This got me an image built locally to use, I then needed to modify the docker-compose.yaml file to use this image:
This got the wordpress docker install launched and working, then I wanted to make it work connecting with Planetscale cloud database rather than local mariadb. I created a custom wp-config.php file and placed it in /example/custom/wp-config.php, then volume mounted it like:
This has got it working as a base level for me. I will come back with further refinements to the build script once I reach another checkpoint, as now I do not need things like |
How can I use this to connect to an external cloud database from the local site?
It seems like in your base docker image you have
which is shown in the root run.sh.
Do i need to extend your image to overwrite this value?
I tried just replacing the DB Host env variable but I am getting database connection errors, presumably because it is still trying to use
<mycloudhost>:3306
as the connection string.Can you provide a quick tutorial for building the docker image custom?
The text was updated successfully, but these errors were encountered: