crater-invoice / crater

Open Source Invoicing Solution for Individuals & Businesses
https://craterapp.com
GNU Affero General Public License v3.0
7.71k stars 1.6k forks source link

setup.sh fails #844

Open Gibdos opened 2 years ago

Gibdos commented 2 years ago

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:

Optional info

kdurek commented 2 years ago

Fail for me also

Skuair commented 2 years ago

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/

kdurek commented 2 years ago

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

Skuair commented 2 years ago

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

kdurek commented 2 years ago

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

kdurek commented 2 years ago

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

Skuair commented 2 years ago

Did you follow in the doc the access for database ?

Database Host: db
Database Name: crater
Database Username: crater
Database Password: crater
kdurek commented 2 years ago

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

Skuair commented 2 years ago

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.

kdurek commented 2 years ago

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

3isenHeiM commented 2 years ago

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!

heyiamsven commented 2 years ago

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

leonidas-o commented 2 years ago

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.