budget
budget copied to clipboard
148 Docker image (Web + Cron + PHP)
This PR will extend our application docker image:
- NGINX, so we can get rid of the nginx service in docker-compose.yml
- crond, now laravels scheduler should work ootb
- php-fpm (as before)
- supervisord as our init
There are a few gotchas:
-
Because we now include a .dockerignore, a few host files aren't included in the image anymore. Most prominent is the .env file, which was used by the docker-compose setup to set the APP_ENV, APP_KEY etc. It's probably fine to just address it in the README accordingly
-
The image is now build in multiple stages and I pulled all the npm stuff into their own stage. Upside is that we do not need the npm tools in our final image. But if someone or something was relying on those tools they are out of luck now.
Is this a functional Docker image? I haven't tried it yet, but it seems promising enough to try and get it set up.
Also, take a look at your commits, I think the author is fucky? 😛
Is this a functional Docker image? I haven't tried it yet, but it seems promising enough to try and get it set up.
Also, take a look at your commits, I think the author is fucky? 😛
Thanks for letting me know about the author, I fixed it.
And yeah, as far as I can tell everything is working with the image. I hadn't had time to test if the schedules are working, so a maybe for the crond stuff. But other than that the image is good to go!
Trying the image right now. For some reason it keeps saying SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO)
, while I specify the DB_HOST
explicitly (as seen below).
docker build --no-cache -t testing_sascha . && docker run --env DB_HOST=host.docker.internal -it testing_sascha
Any ideas? Can you walk me through the steps it took to get it working for you?
You are missing the other environment variables for the database connection, for example DB_USERNAME and DB_PASSWORD. If you want to run it standalone you have to provide those too.
Another way would be to use the docker-compose.yml, that's how I tested it. Make sure the .env file is loaded by docker (which is configured correctly if you use my latest branch).
Is this the docker container I should be using or the other PR?
Is this the docker containers I should be using or the other PR?
Depends on what you mean by "using". This is one of the candidates for the Docker image, but you can use it already if you want.
Ah, thanks for your comment @saschahemleb, I got it working. I think this looks pretty good.
What am I supposed to do with the .env
? It doesn't exist after I clone the repository, should I manually create it and run php artisan key:generate
, or is that something the Docker image should do?
@saschahemleb seems like this PR is the winner in the vote, and can therefor become the Docker image for this project.
- Can you modify the instructions for Docker in
README.md
? - Do you want to keep the
docker-compose.yml
, as well as the database server that's inside?
Hey, sounds good to me.
Regarding the APP_KEY
/.env
: The key should be fairly static in a live environment, so the generation during container startup is a no go, at least without persisting the key someway. For someone just cloning the repo and running a docker-compose up
I will add a note in the README. It boils down to copying .env.example
to .env
, reviewing and changing any existing value (and adding a key).
We can keep the docker-compose.yml
for now. It's a good starting point for quickly spinning up an environment.
I will push some changes to the README
tonight as well so this can be merged soon.
Great work @saschahemleb.
Would this also allow users to set up PGID and PUID as env variables, for easy permission mapping to bind mounts? The way LSIO does it is by far the best method in my experience: https://docs.linuxserver.io/general/understanding-puid-and-pgid
Great work @saschahemleb.
Would this also allow users to set up PGID and PUID as env variables, for easy permission mapping to bind mounts? The way LSIO does it is by far the best method in my experience: https://docs.linuxserver.io/general/understanding-puid-and-pgid
Hey @recklessnl,
maybe I'm missing something but what are you binding into the container that is used by budget?
I intentionally left any user/group id stuff out of this as I saw no use for that.
I think this is almost done. Sorry it took so long for me to review it.
It took it for another spin tonight, and it mostly works. I think the remaining to-do's are as follows.
- There is an error about the version of nginx-light not being found (do you have that too?)
- Perhaps a rebase on master, but I don't know if that's truly necessary 🤷
- Clean up instructions for README.md (remove any dots and backslashes at the end of the lines, so it's the same as the other instructions in that file)
- Squash commits into a few (or single) commit (something like "Rework Dockerfile", whatever)
If anyone has something to say that I missed, please speak up 🙂
There is an error about the version of nginx-light not being found (do you have that too?)
Yeah I get that too. This specific version of the nginx-light package does not exist in the debian repository anymore. I'll remove the version constraints for now. Debian itself wouldn't allow major version upgrades in the same release so there is no need for us to force the package version.
It looks pretty decent to me, I'm thinking of accepting it.
Anyone else that has something to say?
Going to close this as it's a bit stale, and we've had a Docker setup for a while now. That being said, I greatly appreciate the time and effort everybody put in here. Thanks 🙏