crater icon indicating copy to clipboard operation
crater copied to clipboard

setup.sh fails

Open Gibdos opened this issue 2 years ago • 13 comments

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

Gibdos avatar Mar 14 '22 07:03 Gibdos

Fail for me also

kdurek avatar Mar 14 '22 07:03 kdurek

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 avatar Mar 14 '22 08:03 Skuair

@Skuair doesn't work for me, can you tell me what else i should do after chowing?

kdurek avatar Mar 14 '22 11:03 kdurek

As far as i remember, I just changed the owner to 1000, and relaunched setup.sh, nothing more.

Skuair avatar Mar 14 '22 12:03 Skuair

Okay got it, you have to chown whole folder containing docker-compose.yml file not just that app one

kdurek avatar Mar 14 '22 12:03 kdurek

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

kdurek avatar Mar 14 '22 13:03 kdurek

Did you follow in the doc the access for database ?

Database Host: db
Database Name: crater
Database Username: crater
Database Password: crater

Skuair avatar Mar 14 '22 14:03 Skuair

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

kdurek avatar Mar 14 '22 14:03 kdurek

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.

Skuair avatar Mar 14 '22 15:03 Skuair

Deleting volume with database solved issue, everything working fine, thanks!

kdurek avatar Mar 14 '22 20:03 kdurek

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!

3isenHeiM avatar May 02 '22 20:05 3isenHeiM

I have the same issue, even after trying "sudo chown -R 1000:1000 ." Any other fix for this issue?

heyiamsven avatar Aug 03 '22 22:08 heyiamsven

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.

  1. 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.

  2. 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.

leonidas-o avatar Aug 08 '22 14:08 leonidas-o