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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker setup for testing and dev failure #64

Closed
thesquib opened this issue Jan 14, 2024 · 5 comments
Closed

Docker setup for testing and dev failure #64

thesquib opened this issue Jan 14, 2024 · 5 comments
Assignees
Labels
waiting for creator Further information is requested

Comments

@thesquib
Copy link

Hi team,

I saw this interesting project and spun up a test/dev environment with docker following the readme, however I'm greeted with the errors below when trying to browse to the main page (port 8101). It looks like the Symfony runtime isn't available. I'm thinking the readme may have left off some additional requirements but I'm not sure. I'll keep having a look but wondered if you'd spot what was going on straightaway! Thanks!

Warning: require_once(/var/www/html/vendor/autoload_runtime.php): Failed to open stream: No such file or directory in /var/www/html/public/index.php on line 7

Fatal error: Uncaught Error: Failed opening required '/var/www/html/vendor/autoload_runtime.php' (include_path='.:/usr/local/lib/php') in /var/www/html/public/index.php:7 Stack trace: #0 {main} thrown in /var/www/html/public/index.php on line 7

@Macavity
Copy link
Collaborator

Hi @thesquib 👋
Thank you for trying out the project. A couple of question to clarify:

  • On which commit on the master are you, have you tried the latest one? We did a couple of fixes in the meantime.
  • Do the containers show up as running in Docker Desktop or when running docker ps?

For comparison, docker ps gives me this result:

CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS                    PORTS                                              NAMES
9bd3e1d6fffe   money-sprouts-server        "docker-php-entrypoi…"   47 seconds ago   Up 41 seconds             0.0.0.0:8101->80/tcp                               money_sprouts-server
27aec81c74fc   phpmyadmin/phpmyadmin:5.2   "/docker-entrypoint.…"   47 seconds ago   Up 41 seconds             0.0.0.0:8102->80/tcp                               money_sprouts-db-admin
df6826b9cc06   mariadb:10.4.4              "docker-entrypoint.s…"   47 seconds ago   Up 46 seconds (healthy)   0.0.0.0:33016->3306/tcp                            money_sprouts-db
a02c1ce97f0e   schickling/mailcatcher      "sh -c 'mailcatcher …"   47 seconds ago   Up 46 seconds             0.0.0.0:60555->1025/tcp, 0.0.0.0:60556->1080/tcp   money-sprouts-mailer-1

@Macavity Macavity self-assigned this Feb 11, 2024
@Macavity Macavity added the waiting for creator Further information is requested label Feb 11, 2024
@thesquib
Copy link
Author

thesquib commented Feb 19, 2024

Hi @Macavity, thanks for getting back to me. I got the same issue running the current commit (as of writing) of main, and I confirmed I had the four containers running. I did figure it out out though, so here's some of my trial and error below. The quick summary is:

  • Symfony was not available in the docker container
  • npm task build:dev needed to be run

When exploring what is going on I tried to execute the console executable:
docker exec 48ac9d16faf5 ./bin/console doctrine:migrations:migrate OCI runtime exec failed: exec failed: unable to start container process: exec: "./bin/console": stat ./bin/console: no such file or directory: unknown

So I installed composer, and then installed symphony (within the docker container) and reran the above.
docker exec 0e6764912658 php composer-setup.php
docker exec 0e6764912658 composer require symfony/runtime

Now I get a Symfony Exception page! So I'm getting somewhere. At a guess it seems the container setup steps are missing something to ready composer and Symfony.
An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "/var/www/html/public/dist/entrypoints.json" does not exist.").

I'm thinking something needs to be built still, so looking at the package.json there was a task execute 'encore dev'. To run this I needed to use npm to install sass-loader, sass and ts-loader. After that I get webpack compiled successfully and a I can finally load the home page of Money Sprouts!

@thesquib thesquib reopened this Feb 19, 2024
@thesquib
Copy link
Author

At this point I had an empty database (no accounts, no users), so I ran
./bin/console doctrine:migrations:migrate
./bin/console doctrine:fixtures:load

This loaded several users and accounts including my Admin account. However I cannot login with the password as set.

I feel I'm missing some important setup steps along the way here! Thanks for your time :)

@Macavity
Copy link
Collaborator

@thesquib The issue you are mentioning with the admin account is fixed in the PR #113 which I just merged, just pull recent changes and load the fixtures again using

./bin/console doctrine:fixtures:load

I don't think it's possible to migrate the database and load fixtures from outside the container as both commands are interactive and require you to "confirm". 🤔

It's quite strange that composer wasn't working in your container, as that is what should be setup inside https://github.com/Paneon/money-sprouts/blob/main/docker/server/Dockerfile

@thesquib
Copy link
Author

For interactive commands I opened a shell into the container and ran them that way.

PR 113 fixed the login! I haven't had a chance to get back to looking at this properly though.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for creator Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants