Cybrarist / Discount-Bandit

Track your wishlist items and get notified across multiple amazon stores
GNU General Public License v3.0
235 stars 8 forks source link

Build error (dockerfile name) #4

Closed Aerya closed 1 year ago

Aerya commented 1 year ago

Describe the bug Build error on UNRAID

To Reproduce Steps to reproduce the behavior: While adding D-Bandit using docker-compose plugin

Screenshots

[+] Running 1/1
 ! discount-bandit Warning                                                                                                                                         1.3s 
[+] Building 0.5s (2/2) FINISHED                                                                                                                                        
 => [internal] load build definition from Dockerfile                                                                                                               0.3s
 => => transferring dockerfile: 2B                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                  0.4s
 => => transferring context: 2B                                                                                                                                    0.0s
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount2897552841/Dockerfile: no such file or directory
Cybrarist commented 1 year ago

gonna push an update in the following couple of days, i'll ping you to check if the problem is solved

Cybrarist commented 1 year ago

@Aerya can you check now if the issue is solved

Borlean commented 1 year ago

@Aerya

I was waiting for a docker option to run on my unraid box. If it now works with the latest update, could you share your docker-compose file?

Cybrarist commented 1 year ago

@Borlean docker-compose file is already there, if you want docker image, it's already available on docker hub with the same name

Borlean commented 1 year ago

Still receiving the error message

[+] Running 1/1 ! discount-bandit Warning 0.9s [+] Building 0.6s (2/2) FINISHED
=> [internal] load build definition from Dockerfile 0.5s => => transferring dockerfile: 2B 0.0s => [internal] load .dockerignore 0.6s => => transferring context: 2B 0.0s failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount35360899/Dockerfile: no such file or directory

I did change one thing in the YAML file from GitHub, the port.

services:
  discount-bandit:
    build:
      context: '.'
    image: cybrarist/discount-bandit
    volumes:
      - .:/var/www/html/discount-bandit
    ports:
      - 8165:80
    networks:
      - bandit_bridge

networks:
  bandit_bridge:
    driver: bridge
Cybrarist commented 1 year ago

can you tell me your system setp and the steps you did.

Borlean commented 1 year ago

Unraid version 6.11.5

Docker Compose using the Compose.Manager version 2023.05.24

Added the docker-compose.yaml file that was shared above and started the container. I've used the same compose.manager plugin for a more complex docker-compose container stack and it's worked great.

Cybrarist commented 1 year ago

@Borlean can you try to specify a tag first.

Borlean commented 1 year ago

Updated the docker-compose.yaml to

services:
  discount-bandit:
    build:
      context: '.'
    image: cybrarist/discount-bandit:latest-amd64
    volumes:
      - .:/var/www/html/discount-bandit
    ports:
      - 8165:80
    networks:
      - bandit_bridge

networks:
  bandit_bridge:
    driver: bridge

Docker image was able to be pulled and no longer receiving the original error message. However, the below error showed up:

Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "Docker/entrypoint.sh": stat Docker/entrypoint.sh: no such file or directory: unknown

Cybrarist commented 1 year ago

@Borlean can you try to remove the volume first and check it

Borlean commented 1 year ago

commenting out the volume lines lets the container get past the last error message.

Current log.

102 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
cp: cannot stat '.env.example': No such file or directory
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.2. Set the 'ServerName' directive globally to suppress this message
[Fri Aug 11 20:03:02.856522 2023] [mpm_prefork:notice] [pid 657] AH00163: Apache/2.4.57 (Debian) PHP/8.1.21 configured -- resuming normal operations
[Fri Aug 11 20:03:02.856559 2023] [core:notice] [pid 657] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
  alperenersoy/filament-export .......................................... DONE
  awcodes/filament-quick-create ......................................... DONE
  barryvdh/laravel-dompdf ............................................... DONE
  blade-ui-kit/blade-heroicons .......................................... DONE
  blade-ui-kit/blade-icons .............................................. DONE
  filament/filament ..................................................... DONE
  filament/forms ........................................................ DONE
  filament/notifications ................................................ DONE
  filament/support ...................................................... DONE
  filament/tables ....................................................... DONE
  filipfonal/filament-log-manager ....................................... DONE
  flowframe/laravel-trend ............................................... DONE
  laravel/sail .......................................................... DONE
  laravel/sanctum ....................................................... DONE
  laravel/tinker ........................................................ DONE
  leandrocfe/filament-apex-charts ....................................... DONE
  livewire/livewire ..................................................... DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/collision .................................................. DONE
  nunomaduro/termwind ................................................... DONE
  pxlrbt/filament-spotlight ............................................. DONE
  ryangjchandler/blade-capture-directive ................................ DONE
  ryangjchandler/filament-profile ....................................... DONE
  shuvroroy/filament-spatie-laravel-health .............................. DONE
  spatie/laravel-health ................................................. DONE
  spatie/laravel-ignition ............................................... DONE
  wire-elements/spotlight ............................................... DONE

Copying Environment File

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: No address associated with hostname (Connection: mysql, SQL: select * from information_schema.tables where table_schema = discount-bandit and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:795
    791▕         // If an exception occurs when attempting to run a query, we'll format the error
    792▕         // message to include the bindings with SQL, which will make this exception a
    793▕         // lot more helpful to the developer instead of just the database's errors.
    794▕         catch (Exception $e) {
  ➜ 795▕             throw new QueryException(
    796▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    797▕             );
    798▕         }
    799▕     }

      +38 vendor frames 

  39  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

   INFO  The [public/storage] link has been connected to [storage/app/public].  

   ErrorException 

  file_get_contents(/var/www/html/discount-bandit/.env): Failed to open stream: No such file or directory

  at vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php:100
     96▕     {
     97▕         $replaced = preg_replace(
     98▕             $this->keyReplacementPattern(),
     99▕             'APP_KEY='.$key,
  ➜ 100▕             $input = file_get_contents($this->laravel->environmentFilePath())
    101▕         );
    102▕ 
    103▕         if ($replaced === $input || $replaced === null) {
    104▕             $this->error('Unable to set application key. No APP_KEY variable was found in the .env file.');

      +15 vendor frames 

  16  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

   INFO  Configuration cache cleared successfully.  

   INFO  Route cache cleared successfully.  

   INFO  Application cache cleared successfully.  
Cybrarist commented 1 year ago

@Borlean it looks like you don;t have a MYSQL instance running, create a new mysql image and pass the needed parameter to to discount bandit image

Aerya commented 1 year ago

Hi,

Sorry for late feedback. I ended up using a friend's repo for UNRAID. But yeah, on Linux, using your compose (with a DB) is making it.

@Borlean (thanks to Waazaa from SuperBoki's French UNRAID Discord)

git clone the repo to /mnt/user/appdata/discount-bandit/data copy/edit the .env with your email/password etc like that:

[...]
DB_CONNECTION=mysql
DB_HOST=discount-bandit-db
DB_PORT=3306
DB_DATABASE=bandit
DB_USERNAME=root
DB_PASSWORD=example
[...]
MEMCACHED_HOST=discount-bandit-memcached
[...]
REDIS_HOST=discount-bandit-redis
REDIS_PASSWORD=null
REDIS_PORT=6379
[...]

Use this compose:

services:
  db:
    image: mariadb
    container_name: discount-bandit-db
    restart: always
    environment:
      MARIADB_ROOT_PASSWORD: xxxx
    volumes:
      - "/mnt/user/appdata/discount-bandit/db:/var/lib/mysql"

  redis:
    image: redis
    container_name: discount-bandit-redis
    restart: always

  memcached:
    image: memcached
    container_name: discount-bandit-memcached
    restart: always

  site:
    image: waaman/apache2-php8:AMD64 
    container_name: discount-bandit
    restart: always
    ports:
      - 924:80
    volumes:
      - "/mnt/user/appdata/discount-bandit/data:/var/www/html"
    depends_on:
      - db
      - redis
      - memcached
  adminer:
    image: adminer
    container_name: adminer
    restart: always
    ports:
      - 7777:8080

Compose up then use Adminer to create a DB: http://your_unraid:7777 server=discount-bandit-db user=root password=xxx Login and create a new DB: bandit Once done, edit our compose and remove the Adminer part and remove the Adminer container for security reasons.

Enter your bandit container console and run those commands:

composer install
php artisan migrate:fresh --seed --no-interaction
php artisan key:generate

You have to create 2 scripts (where you want): discount-bandit-cron.sh

docker exec -t discount-bandit /usr/local/bin/php /var/www/html/artisan queue:work --stop-when-empty >> /dev/null 2>&1

discount-bandit-cron-5.sh

docker exec -t discount-bandit /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1

and run them using User Scripts: discount-bandit-cron.sh: discount-bandit-cron-5.sh: /5

And here you go!

BTW thanks for the work @Cybrarist :)

Cybrarist commented 1 year ago

@Aerya Glad you liked it.