phpvms icon indicating copy to clipboard operation
phpvms copied to clipboard

Dockerfile is missing??

Open rentasad opened this issue 10 months ago • 24 comments

Hi, I would like to get the DOCKER version of PHPVMS running and unfortunately the Dockerfile is missing from the repository? In addition, the image “sail-8.2/app” no longer seems to be correct?

Does anyone have a current running Docker version (Dockerfile + docker-compose.yml) for me? Thank you!

rentasad avatar Oct 15 '23 19:10 rentasad

Hi,

Sail is the official laravel docker stack recommanded for local development. It's not at all suitable for production. There is no Dockerfile in it since everything is done via docker-compose and their custom binary (vendor/bin/sail). I'm interested why the "sail-8.2/app" image wouldn't be correct ?? It works very well for me.

As far as I know there is no official laravel docker stack for production and I don't know much about unoffical ones. I use docker locally but for production I kept an old school installation with everything on the machine directly.

I heard about a stack called laradock but I don't know if it would work well in production.

Hope this helps you a little

arthurpar06 avatar Oct 15 '23 20:10 arthurpar06

Hi, Thank you very much for your quick answer. First I want to get PHPVMS7 running at all, because we want to check whether we can migrate from PHPVMS5 to PHPVMS7. To do this, I want to get it running in a local Docker environment. If I try to run the docker-compose up command, I got this error:

unable to prepare context: path "C:\\Users\\%username%\\PhpstormProjects\\phpvms\\vendor\\laravel\\sail\\runtimes\\8.2" not found

grafik

I don't have the folder "vendor" - maybe I have to download anything and put it into this folder?

rentasad avatar Oct 15 '23 20:10 rentasad

Oh okay, this is indeed something we should work on. In fact sail needs part of the vendor folder to work. This is supposed to be installed while you are creating a new laravel app with their curl request but since you are installing an existing app you don't have that (which is normal). You can download the laster phpvms build here, take the vendor folder in it and put it in your phpvms folder (the one you cloned from github). Then you can run ./vendor/bin/sail up -d in the phpvms folder and it should work.

When I have some time I'll try to think about how can we solve this bug for new docker installations, the sail doc is available here if you wanna take a look about the commands (it doesn't go through docker-compose directly)

arthurpar06 avatar Oct 15 '23 20:10 arthurpar06

Considering this is a fresh fork or pull (which will not have the vendors at all) can't you run composer install before running docker-compose up ?

Just an idea :)

FatihKoz avatar Oct 15 '23 20:10 FatihKoz

Hi, Thank you very much for the valuable tip. I got the vendor folder from the release - it contains a lot of files and directories. Unfortunately ./vendor/sail/... is still missing There is also no "sail" in the ./vendor/bin folder, which is why unfortunately I can't run it in the phpvms folder either.

I will probably need an executable Dockerfile version with which I can get an image with all the image files to be generated? I'm happy if you have a better idea. Best regards

rentasad avatar Oct 15 '23 20:10 rentasad

Considering this is a fresh fork or pull (which will not have the vendors at all) can't you run composer install before running docker-compose up ?

Just an idea :)

Hi, Thank you for your good idea - this would work if I had PHP installed outside of Docker with all the necessary extensions. However, I don't have this on my Windows machine, so I'll have to get it to work under Docker - I'm sure it can be done so that the .vendor directory can then be generated - but I still don't have the knowledge to do that. Still a good idea - I will continue to try this approach.

rentasad avatar Oct 15 '23 20:10 rentasad

Considering this is a fresh fork or pull (which will not have the vendors at all) can't you run composer install before running docker-compose up ?

Just an idea :)

That should work but you have to have composer installed on your machine. I was trying to think about how to do that with just docker.

arthurpar06 avatar Oct 15 '23 20:10 arthurpar06

Hi, Thank you very much for the valuable tip. I got the vendor folder from the release - it contains a lot of files and directories. Unfortunately ./vendor/sail/... is still missing There is also no "sail" in the ./vendor/bin folder, which is why unfortunately I can't run it in the phpvms folder either.

I will probably need an executable Dockerfile version with which I can get an image with all the image files to be generated? I'm happy if you have a better idea. Best regards

Ok i understood why, this vendor only contains the dependencies required for production but sail is only supposed to be installed in local so not in this vendor...

arthurpar06 avatar Oct 15 '23 20:10 arthurpar06

While I think about a good solution here is a vendor which contains the sail files. With this vendor and ./vendor/bin/sail up -d phpvms should work

vendor.zip

arthurpar06 avatar Oct 15 '23 20:10 arthurpar06

Hi, i edited my local php.ini (enable missing extensions) and installed the composer in my (windows) environment. Now I could installed laravel with "composer require laravel/sail --dev" - maybe the installation has missing features for the following reason:

The Docker Container Start is failed with this step: grafik

rentasad avatar Oct 15 '23 20:10 rentasad

Sail is supposed to use PHP8.2 but normally it should install it with the sail-8.2/app image

arthurpar06 avatar Oct 15 '23 20:10 arthurpar06

Yes, you are right, that was purely a mistake on my part. I'm now trying it again with the vendor files from your ZIP file - it's currently still running - I'll let you know when it's finished and whether it's running without errors.

rentasad avatar Oct 15 '23 20:10 rentasad

Okay, after digging around a bit, I found this on the Laravel doc.

https://laravel.com/docs/10.x/sail#installing-composer-dependencies-for-existing-projects

Delete the vendor folder, run their docker command to install everything and then you should be able to doe ./vendor/bin/sail up -d

arthurpar06 avatar Oct 15 '23 20:10 arthurpar06

You need to clone it from the git repo, the release zip doesn't include these dependencies

nabeelio avatar Oct 15 '23 21:10 nabeelio

You need to clone it from the git repo, the release zip doesn't include these dependencies

Yes but the git repo doesn't include these too since we ignore the vendor folder. If he doesn't have composer he can't install sail. Normally what I just sent is a good solution since it comes from the official doc.

If this command works we might need to update the Makefile and the Readme to have a command that groups this process together and make it more clear.

arthurpar06 avatar Oct 15 '23 21:10 arthurpar06

Hm - the same error grafik Maybe it have problems to work in my windows WSL Docker Environment. Next Week I will retry your tip - now I have to end my work for today. Thanks for your help!

rentasad avatar Oct 15 '23 21:10 rentasad

Hm maybe that's it, I don't really have any ideas anywork. For me phpvms is in /home/username/phpvms in my WSL2 - Ubuntu and it works well as I'm using docker in wsl

arthurpar06 avatar Oct 15 '23 21:10 arthurpar06

If I have gained further insights, I would be happy to share them with you. I keep you updated.

Thank you for your time and see you next time!

rentasad avatar Oct 15 '23 21:10 rentasad

I would also recommend you to switch to a Linux based OS, things will be a lot easier...just my opinion :) Have you checked if the user and group id are the same on the system you are installing and the ones set on your env variables?

wbox avatar Oct 19 '23 17:10 wbox

Hey @rentasad I have exactly the same issues as yours, too much dependecies missing on my PC when I run composer installer. Where you able to find a solution ? Cheers

tomihbk avatar Jan 28 '24 14:01 tomihbk

Hi, Have you tried following what is explained here ?? https://github.com/nabeelio/phpvms?tab=readme-ov-file#development-environment-with-docker

arthurpar06 avatar Jan 28 '24 14:01 arthurpar06

Hi, Have you tried following what is explained here ?? https://github.com/nabeelio/phpvms?tab=readme-ov-file#development-environment-with-docker

Hi there, Thanks for the link. I was indeed able to get to the installation part of the process thanks to the discussions above and the link you provided.

I am now facing issues connecting to my DB.

Docker side : image

.env file:

WWWGROUP=1000
WWWUSER=1000
PWD=test
DB_USERNAME=test
DB_PASSWORD=test
DB_DATABASE=MainDB_test

I keep getting "Failed! SQLSTATE[HY000] [2002] Connection refused " I have tried with port 3306, 3336. Also between localhost and 127.0.0.1. Sadly no resolve. image

tomihbk avatar Jan 28 '24 15:01 tomihbk

You should use mariadb as the DB_HOST instead of 127.0.0.1. If it still doesn't work, you can use root with no password and the database named testing, but I believe changing the DB_HOST should be sufficient.

arthurpar06 avatar Jan 28 '24 15:01 arthurpar06

You should use mariadb as the DB_HOST instead of 127.0.0.1. If it still doesn't work, you can use root with no password and the database named testing, but I believe changing the DB_HOST should be sufficient.

mariadb did the thing. Thanks a bunch. The documentation is quite lacking essential info. I'll take some time to do some PRs 😁

tomihbk avatar Jan 28 '24 18:01 tomihbk

@nabeelio / @arthurpar06 i think this one can be closed.

ArthurHetem avatar May 09 '24 00:05 ArthurHetem