Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悑 Need some help with Docker #837

Closed
alexjustesen opened this issue Oct 3, 2023 · 32 comments
Closed

馃悑 Need some help with Docker #837

alexjustesen opened this issue Oct 3, 2023 · 32 comments
Assignees
Labels
馃悑 docker Pull requests that update Docker code 馃槙 help wanted Extra attention is needed

Comments

@alexjustesen
Copy link
Owner

alexjustesen commented Oct 3, 2023

In a nutshell, I'm looking to make the Docker image used for this project lighter, faster and more efficient but I'm focused on adding features at the moment.

Could really use some help from the community to improve the image. Bonus points of someone can get LinuxServer involved to craft an awesome image.

There are also changes coming to the base image outline in #750

@alexjustesen alexjustesen added 馃槙 help wanted Extra attention is needed 馃悑 docker Pull requests that update Docker code labels Oct 3, 2023
@alexjustesen alexjustesen self-assigned this Oct 3, 2023
@alexjustesen alexjustesen pinned this issue Oct 3, 2023
@repcsi
Copy link

repcsi commented Nov 21, 2023

Hi Alex,

Would be happy to help but I'm lacking the knowledge about laravel, still learning it. I will try to build the image and see how I can slim it down a little bit, if that helps.

@alexjustesen
Copy link
Owner Author

Hi Alex,

Would be happy to help but I'm lacking the knowledge about laravel, still learning it. I will try to build the image and see how I can slim it down a little bit, if that helps.

On hold for the moment, I'm using Serverside Up's image as the base which is currently going through some changes: #750

@repcsi
Copy link

repcsi commented Nov 22, 2023

Alright, do you need help with it? I can test drive also on docker and I have an rpi somewhere I can spin up.

@alexjustesen
Copy link
Owner Author

At some point def, I just pinged the authors to see where they stand. Ideally I don't want to start using a new base until it hits at least beta.

@thespad
Copy link

thespad commented Nov 23, 2023

Linuxserver team member here, I'd be happy to take a look at this, it's a fairly standard setup.

I've had a quick play around and I've knocked about 120Mb off the image size, but I am getting a production.ERROR: Trying to access array offset on value of type null error when actually running tests, which I've not been able to narrow down a cause of yet.

I was trying to be too clever, got a working POC now, about half the size of the current image.

docker.io/thespad/playground:speedtest-tracker if you want to give it a try, all the envs, etc. should be the same, though it only needs a /config mount. I've not tested with mysql/mariadb but it should work - postgres and sqlite both do.

@alexjustesen
Copy link
Owner Author

Linuxserver team member here, I'd be happy to take a look at this, it's a fairly standard setup.

Dude this is 馃敟馃敟馃敟 thank you! I'm on a mini vacation until Monday but will get right on testing that image.

@alexjustesen
Copy link
Owner Author

@thespad couple of questions before testing later today or tomorrow...

  1. How does the container utilize Laravel's queue and scheduler? Are you using cron or some task scheduler and process manager?
  2. In the past I've had some issues with permissions within the container that effected how the cache works and writing of files, any changes there?

@thespad
Copy link

thespad commented Nov 27, 2023

I pretty much just copied what you were already doing; the queue is a service, the scheduler is a cron job running every minute. I'm open to changing things around if you think there's a better way to approach it.

Permissions-wise I'm currently chowning:
/app/www/bootstrap/cache
/app/www/storage
/app/www/database
/config

To the running user.

@alexjustesen
Copy link
Owner Author

Any chance you mind sharing the Dockerfile? In all honesty the Docker side of this project is my weakness so looking to boost my education there.

@thespad
Copy link

thespad commented Nov 27, 2023

Sure, https://bin.spad.uk/?51ac931610eba73b#5RxDXYThJP3RWiUqy9869faehRKFTRf9Q4pVU8oFpRyk

Obviously doesn't include the s6 init/service components, crontabs, etc.

@thespad
Copy link

thespad commented Dec 5, 2023

If you want to see the full image build I've pushed it to a dev branch here https://github.com/linuxserver/docker-speedtest-tracker/tree/initial

@alexjustesen
Copy link
Owner Author

@thespad just checking in to let you know I haven't forgotten.

Currently the app's image builds with PHP 8.3 and to reduce variables I definitely want to keep that in the short term. However after the first of the year would like to migrate to 8.3. What's your process for that, just a PR?

@thespad
Copy link

thespad commented Dec 13, 2023

Our Alpine 3.18 Nginx base has php 8.2 and 3.19 has php 8.3, so we'd build with 3.18 and then when you want to switch to php 8.3 we'd just update the base image (and the names of any packages/paths from php82 to php83).

@thespad
Copy link

thespad commented Dec 13, 2023

The only thing I haven't been able to properly test is email notifications because I don't have a quick and easy way to rig it up in my testlab.

I've pushed a new build for 0.14.0 to ghcr.io/linuxserver/lsiodev-speedtest-tracker:version-v0.14.0 if you're able to test email specifically and make sure it works as expected. I think everything else should be functional from what I've been able to test.

@alexjustesen
Copy link
Owner Author

Thanks man, will also add that to my test criteria.

One thing on the wish list for the ci/cd pipeline for me was to add building the front end assets, I know it's a changing requirement but is this possible? At this time the downloaded npm packages don't need to be kept as none of them are referenced and Vite puts the assets into public/build.

Build commands would be...

npm ci && npm run build

@thespad
Copy link

thespad commented Dec 21, 2023

Thanks man, will also add that to my test criteria.

One thing on the wish list for the ci/cd pipeline for me was to add building the front end assets, I know it's a changing requirement but is this possible? At this time the downloaded npm packages don't need to be kept as none of them are referenced and Vite puts the assets into public/build.

Build commands would be...

npm ci && npm run build

Does it need to be run before/after any other part of the build?

@alexjustesen
Copy link
Owner Author

Does it need to be run before/after any other part of the build?

After composer installs deps please

@thespad
Copy link

thespad commented Dec 21, 2023

ghcr.io/linuxserver/lsiodev-speedtest-tracker:version-v0.14.1 includes the npm builds - though in practice I'm assuming isn't actually doing anything if you're currently pre-building the frontend as it'll get copied in from the release artifact.

@thespad
Copy link

thespad commented Feb 8, 2024

Did you get an opportunity to test the email functionality?

@alexjustesen
Copy link
Owner Author

Did you get an opportunity to test the email functionality?

I have not, got back from vaca a few days ago and been deep in trying to fix the DQ issue the last couple of days. I owe ya some time on this so putting it at the top of it pile.

@alexjustesen
Copy link
Owner Author

While I'm at the day job do you mind bumping the image to the latest build? v0.15.2 fixes a few issues.

@thespad
Copy link

thespad commented Feb 8, 2024

Already have :)

@alexjustesen
Copy link
Owner Author

Had a few between meetings, found this in the logs when testing w/ mysql database on a fresh install.

image

@thespad
Copy link

thespad commented Feb 8, 2024

The sqlite db symlink in /config should only get created

if [[ ${DB_CONNECTION:="sqlite"} = "sqlite" ]]

But if it has somehow been created previously and you're not using sqlite then it'll throw an error because the file at the other end of the link doesn't exist in the container. I'll have the init touch the file just to avoid the error in that case.

@alexjustesen
Copy link
Owner Author

Solved, had a typo in my DB_CONNECTION var which seems to have caused the issue. Also confirmed all notification channels worked (database, mail, Telegram and webhooks).

@thespad
Copy link

thespad commented Feb 8, 2024

Excellent, I've just pushed a fix for the sqlite db init as well so it shouldn't break now if you make a typo or intentionally choose sqlite

@alexjustesen
Copy link
Owner Author

Cool and I just saw the change for making the scheduler quieter too.

Locally this is working well, tonight I'll deploy to my RPI Docker Swarm cluster, Unraid NAS and Synology NAS to test further.

@alexjustesen
Copy link
Owner Author

Well good news, I didn't run into any issues with the hosts above. Performance improvements were wicked (I'm from New England) nice, image is about 1/2 the size and ran into no issues using the file cache driver.

I think we can get this rolling. Maybe run them side by side for a couple of versions to give people time to cut over and get the communication out there.

Open to your thoughts.

@thespad
Copy link

thespad commented Feb 8, 2024

Sounds good, I've opened a PR to put the branch live, once it's reviewed and built we'll make the packages live.

You can continue building your image for as long as you think is necessary; we don't have any expectations of exclusivity or anything like that. You might want to consider adding a message to the container init with a deadline for when you intend to stop supporting it - we find a lot of users never read them, but don't want to interfere with the running application so it's our best option.

@thespad
Copy link

thespad commented Feb 9, 2024

Image is now live: lscr.io/linuxserver/speedtest-tracker:latest

@alexjustesen
Copy link
Owner Author

Image is now live: lscr.io/linuxserver/speedtest-tracker:latest

Hell yeah! Guess it's time to update the docs and get this advertised.

@thespad
Copy link

thespad commented Feb 9, 2024

Forgot to mention; if you need changes made or find any issues that need addressing, etc. you can either open an issue against the repo, or jump on our Discord and we'll get it sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃悑 docker Pull requests that update Docker code 馃槙 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants