budget icon indicating copy to clipboard operation
budget copied to clipboard

Create Docker image that includes database and PHP without seperating it, similar to LSIO containers

Open recklessnl opened this issue 4 years ago • 24 comments

Linuxserver.io containers (or LSIO for short) run some of the most popular docker containers in the world, with billions of pulls. One of the main reasons for this is because they make it incredibly easy for users to run the containers: you won't need to run seperate databases. nginx and PHP version for every app - instead, the bundle everything inside the container in the most lightweight OS possible, while still allowing you to set things like PGID and PUID for easy permission mapping as well.

My request is that you change the docker container to contain the database + nginx + PHP, instead of requiring them as seperate containers. This will make it so much easier to maintain and oversee for users, especially those that run multiple containers, and makes it much easier for yourself to troubleshoot things too, as you won't have to worry about dealing with botched installs of PHP, nginx, etc, as it will all be included within your container.

See here for more info: https://docs.linuxserver.io/general/understanding-puid-and-pgid

Heimdall is a good example of a web app that already includes nginx and other dependencies, making it a breeze to install for users: https://docs.linuxserver.io/images/docker-heimdall

I think this would make it much easier for people to start using Budget.

recklessnl avatar Jun 21 '20 20:06 recklessnl

Great idea, this would really improve the OOTB experience.

I would advice against adding a database though, at least not as a default. Maybe we can go for an image with nginx + php and provide a "quick start" docker-compose.yml with the other dependencies like mysql and redis?

I could whip up something real quick if no one else is working on smth already?

saschahemleb avatar Jun 25 '20 18:06 saschahemleb

Sure, that'd be cool!

I heard that it's useful to keep the database in a separate Docker image tho, so you can easily back it up, what's your stance on that? Seeing as you're an advocate of having everything in a single image..?

range-of-motion avatar Jun 25 '20 18:06 range-of-motion

Totally, a different container should be the way to go. The same for redis.

We should not shoehorn users into running an included database server if they already got one running, backed up, maybe on a more powerful host..

If someone really wants a database included, they can just grab the docker-compose.yml and run the app, with the database, redis etc.. Still separate images, but at least it's quick to get started.

First things first tho, a production ready image with nginx + php, and after that we can tweak the docker-compose if necessary.

saschahemleb avatar Jun 25 '20 18:06 saschahemleb

Agreed.

I'm quite a pleb when it comes to Docker (as you can probably see by the Dockerfile 😛). You wanna take this on?

range-of-motion avatar Jun 25 '20 18:06 range-of-motion

Got it. I'll start hacking on a Dockerfile asap and let you know ;)

saschahemleb avatar Jun 25 '20 19:06 saschahemleb

+1 for keeping the database separate but merge the webserver (Apache and/or nginx) and php.

If your not familiar with docker maybe you could ask for help over at LSIO (Linuxserver.io) I guess that they would love to help a fellow developer

BobWs avatar Jun 26 '20 14:06 BobWs

Separating the database makes sense. Thanks for working on this, this should make it easier for everyone to manage. Also, please make sure to allow users to set PGID and PUID as well for easy permission mapping. See here for more info: https://docs.linuxserver.io/general/understanding-puid-and-pgid

recklessnl avatar Jun 30 '20 00:06 recklessnl

I hope a docker installation steps would be published soon as I want to try Budget from few weeks now, but I'm using Unraid and can't use the docker-compose method :(

guim31 avatar Jul 09 '20 15:07 guim31

Any progress on this request?

BobWs avatar Jul 26 '20 06:07 BobWs

I will continue with this tonight, and hopefully make a decision rather soon.

range-of-motion avatar Jul 27 '20 15:07 range-of-motion

Alright, there are 2 images, which I'm going to attempt to summarize and compare in this comment.

There is #170, made by @saschahemleb.

  • Uses Supervisor (which I am, but I assume many others are too, quite familiar with)
  • Specifies the version number for the programs we need (Composer, Yarn, NGINX, etc.)
  • Seems to utilize multi-staging

And there is #169, made by @jbrunink.

  • Uses s6, which I am not quite familiar with
  • Doesn't seem to utilize mult-staging

If I had to choose, I'd go for @saschahemleb's PR, because it seems easier to use and maintain. However, since I am not an expert on Docker, I'm going to ask you guys to vote as well.

🎉 for @saschahemleb's PR, 🚀 for @jbrunink's PR

Whichever PR will be picked, I want to thank both authors for their contribution. I appreciate it.

range-of-motion avatar Jul 27 '20 20:07 range-of-motion

How can I test the image from @saschahemleb?

BobWs avatar Aug 08 '20 06:08 BobWs

I would love to test it too :+1:

guim31 avatar Aug 28 '20 17:08 guim31

Any progress to report on this issue/request?

BobWs avatar Sep 30 '20 07:09 BobWs

Ah, yes. I shall revisit this soon, thanks for bringing it up (kinda lost track 😰 ).

range-of-motion avatar Sep 30 '20 08:09 range-of-motion

I didn't dare to talk about it .... haha Great news !

guim31 avatar Sep 30 '20 13:09 guim31

Apologies for asking again but what is the status on this request? Any progress? Can we expect a image soon or is this a long term implementation?

BobWs avatar Dec 09 '20 07:12 BobWs

Apologies for the delay. I tested it again tonight, and it works. Apart from some cosmetics (code style, etc.) it's approved from my side. I'll try and get in touch with @saschahemleb to finalize this.

@BobWs perhaps you can try his branch and let me know if it works for you?

range-of-motion avatar Dec 09 '20 18:12 range-of-motion

Apologies for the delay. I tested it again tonight, and it works. Apart from some cosmetics (code style, etc.) it's approved from my side. I'll try and get in touch with @saschahemleb to finalize this.

@BobWs perhaps you can try his branch and let me know if it works for you?

Okay I could test his branch. Where can I find it?

BobWs avatar Dec 10 '20 13:12 BobWs

In his fork. However I haven't been able to get in touch with him.

I have recently gotten more experienced with Docker myself so I'm attempting my own PR. I will keep you updated.

range-of-motion avatar Dec 11 '20 12:12 range-of-motion

@BobWs you are free to check out #267 and take it for a test drive.

range-of-motion avatar Dec 18 '20 02:12 range-of-motion

@BobWs you are free to check out #267 and take it for a test drive.

Thanks I will give it a spin and let you know if it is working for me.

BobWs avatar Dec 19 '20 07:12 BobWs

@BobWs you are free to check out #267 and take it for a test drive.

So where can I find the docker image?

BobWs avatar Dec 19 '20 12:12 BobWs

So where can I find the docker image?

It should be the Dockerfile and docker-compose.yml in the PR that I referenced above. Check out the README.md for the latest instructions on how to get it running.

range-of-motion avatar Dec 19 '20 17:12 range-of-motion

Closing this, as we have a (seemingly working) Docker setup now.

range-of-motion avatar Mar 29 '23 00:03 range-of-motion