crater
crater copied to clipboard
setup.sh fails
Describe the bug After the docker-compose up -d build process is finished I went and executed the /docker-compose/setup.sh. Sadly it fails with
[RuntimeException]
/var/www/vendor does not exist and could not be created.
Warning: require(/var/www/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/artisan on line 18
Fatal error: require(): Failed opening required '/var/www/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/artisan on line 18
Warning: require(/var/www/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/artisan on line 18
Fatal error: require(): Failed opening required '/var/www/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/artisan on line 18
Expected behavior For it to work.
Screenshots
Please complete the following information:
- Crater version: Git Repo version from 2022-03-14
- PHP version: built in docker-compose
- Database type and version: see docker-compose.yml
Optional info
- OS: Ubuntu Server 20.04
Fail for me also
You have to apply chown to your app folder to the user/group 1000. (check in the docker-compose, for the app container, the user ID is 1000).
chown -R 1000:1000 app/
@Skuair doesn't work for me, can you tell me what else i should do after chowing?
As far as i remember, I just changed the owner to 1000, and relaunched setup.sh, nothing more.
Okay got it, you have to chown whole folder containing docker-compose.yml file not just that app one
Anyway, after this I still can't run app, on web setup I managed to fix 775 error but on next page it says it can't connect to database
Did you follow in the doc the access for database ?
Database Host: db
Database Name: crater
Database Username: crater
Database Password: crater
Yeah by following docs, this is the error that I'm getting:
SQLSTATE[HY000] [1130] Host '172.24.0.5' is not allowed to connect to this MariaDB server
Maybe a network configuration in your docker. But i'm not skilled enough on docker-compose to help you on this part. Let's wait for another answer.
For information, I installed it on a Synology NAS, with docker, i just used the docker-compose by changing the network port and added some "container_names" to be clearer, but that's all. And it worked, but i remember at first install i had some database access problems, maybe like yours, i restarted from 0 and it was ok.
Deleting volume with database solved issue, everything working fine, thanks!
Indeed, the chown command worked for me.
From inside the crater
directory, I've run :
sudo chown -R 1000:1000 .
And the ./docker-compose/setup.sh
ran without any problems!
I have the same issue, even after trying "sudo chown -R 1000:1000 ." Any other fix for this issue?
I managed to get it running with rootless podman.
Sidenote: Unfortunately there is a bug in the latest podman 4.1.1 with the default podman-compose from the epel repo, so you have to execute the commands manually or install podman-compose 1.0.3 via pip3.
-
What's actually the idea behind this installation process? I mean, using docker but then each user has to build an own image. Isn't that defeating the purpose of containers? Why don't you just build a container and push it to the docker hub (provide some ENV vars for configuration and that's it)? This seems like pretty strange strategy to me.
-
In case someone wants to know how to deploy it with rootless podman:
git clone https://github.com/crater-invoice/crater
cd crater
cp .env.example .env
vi .env
# created and sourced access.txt with credentials
mkdir -p /srv/crater/crater/docker-compose/db/data
podman unshare ls -la /srv/crater/crater/
podman unshare chown 1000:1000 -R /srv/crater/crater/
sudo restorecon -vv -r -F /
podman-compose up -d
# instead of setup.sh execute adapted commands
podman-compose exec app composer config --no-plugins allow-plugins.pestphp/pest-plugin true
podman-compose exec app composer install --no-interaction --prefer-dist --optimize-autoloader
podman-compose exec app php artisan storage:link || true
podman-compose exec app php artisan key:generate
The command php artisan storage ...
was throwing:
Warning: require(/var/www/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/artisan on line 18
Fatal error: require(): Failed opening required '/var/www/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/artisan on line 18
After adding:
podman-compose exec app composer config --no-plugins allow-plugins.pestphp/pest-plugin true
the autoload.php issue is gone.