Tag: laravel docker

Laravel MySQL错误只在计划任务(通过cron)

我有一个使用Laravel任务调度器的任务,而不是完美的开火。 它触发了一个名为Task::checkSpiders()的公共方法。 这打到一个API(工作正常),然后应相应地更新本地数据库。 如果我创build一个路由如此… Route::get('/test', function () { $test = Task::checkSpiders(); } 它运行完美。 当我从CRON运行它,但它会引发这个错误… #0 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(55): PDO->__construct('mysql:host=loca…', 'forge', '', Array) #1 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=loca…', Array, Array) #2 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(61): Illuminate\Database\Connectors\MySqlConnector->connect(Array) #3 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}() #4 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(920): call_user_func(Object(Closure)) #5 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(788): Illuminate\Database\Connection->getPdo() #6 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(673): Illuminate\Database\Connection->reconnectIfMissingConnection() #7 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(479): Illuminate\Database\Connection->run('update `tasks` …', Array, Object(Closure)) #8 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php(422): Illuminate\Database\Connection->affectingStatement('update `tasks` …', Array) #9 […]

将Laravel应用程序包装入Docker映像

我创build了一个Laravel 5.2应用程序,我想创build它的泊坞窗图像,但我是新的Docker。 有人可以指导我通过这个过程,或者通过networking链接帮助我获得有关构buildLaravel泊坞窗图像的信息。 谢谢。

使用envvariablesprepend命令 – 包括子命令

我需要将一个环境variables添加到Laravel的php artisan migrate命令中,以便与docker一起使用,例如: env DB_HOST=127.0.0.1 php artisan migrate 我在我的.zshrc文件中创build了一个函数,如下所示: function migrate() { (env DB_HOST=127.0.0.1 php artisan migrate $*) } 然而,Laravel的指挥结构的工作方式是这样的: migrate migrate:install Create the migration repository migrate:refresh Reset and re-run all migrations migrate:reset Rollback all database migrations migrate:rollback Rollback the last database migration migrate:status Show the status of each migration 所以这不适用于这样的命令: migrate:refresh –seed 有没有一种方法可以编写函数,也为所有这些“子”命令添加variables?

在dockerfile中,在RUN语句中创build或复制文件或目录后,它不存在

我面临下面的dockerfile下面的问题ilustrated: FROM richarvey/nginx-php-fpm WORKDIR /var/www/html RUN touch test.txt CMD while true; do sleep 1000; done 在Docker上面运行作为项目容器并通过login docker exec -it project /bin/bash 我们将si'/var/www/html/test.txt'不存在。 这是更大的问题,尤其是如果我们而不是创build一个文件想要例如在PHP laravel项目中使用composer php: WORKDIR /var/www/html COPY ./composer.json . COPY ./composer.lock . RUN composer install –no-scripts –no-autoloader 然后,我们不幸地发现, 供应商的目录不存在…

Laravel cron执行两个php版本的命令

在尝试使用Laravel的调度程序执行cron作业时,我在日志文件中看到,使用php7和php7.1执行的命令是奇怪的! 谁能解释发生了什么? 以下是日志文件内容的截图: 我的crontab文件如下所示: * * * * * cd /var/www/ && php /var/www/artisan schedule:run >> /var/www/storage/logs/cron.log 2>&1

未find文件 – Docker中的Nginx

描述 我有一个docker容器与此 nginx.conf server { listen 80; index index.php index.html; root /var/www/public; location / { try_files $uri /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass app:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } } 泊坞窗,compose.yaml version: '2' services: # The Application app: build: context: ./ dockerfile: app.dockerfile working_dir: /var/www volumes: […]

Laravel Cron php_network_getaddresses:getaddrinfo失败

你好! 所以我有这个烦人的问题,为Laravel调度设置一个cron作业。 要了解这个问题,下面是项目架构: 该项目使用docker(我们有一个PHP的容器,MySQL和Nginx的容器) 该Web应用程序build立在Laravel 5.3上 我们想要自动化一些任务,所以我们创build了3个命令,并且将它们在日程安排中进行收集,以便每天运行它们,下面是kernel.php样子: protected $commands = [ 'App\Console\Commands\IncompleteAccount', 'App\Console\Commands\TirageSoon', 'App\Console\Commands\WinzExpiration', ]; protected function schedule(Schedule $schedule) { $schedule->command('incompleteaccount:run')->everyFiveMinutes()->sendOutputTo(storage_path('logs/cron.log')); $schedule->command('tiragesoon:run')->everyFiveMinutes()->sendOutputTo(storage_path('logs/cron.log')); $schedule->command('winzExpire:run')->everyFiveMinutes()->sendOutputTo(storage_path('logs/cron.log')); } 我们的crontab看起来像: * * * * * php /var/www/artisan schedule:run >> /var/www/storage/logs/cron.log 2>&1 在日志文件中我们得到这个: [Illuminate\Database\QueryException] SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from `booking` where `created_at` […]

Dockerize laravel队列:听

我有docker应该运行laravel队列的图像。 在图像我有命令的php artisan queue:listen但是当我启动容器什么也没有发生,容器运行。 这是基本的形象 FROM php:5.6-apache COPY ./000-default.conf /etc/apache2/sites-available/000-default.conf RUN ln -s /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-enabled/000-default.conf RUN curl -sS https://getcomposer.org/installer | php — –install-dir=/usr/local/bin –filename=composer RUN apt-get update && \ apt-get install -y \ git \ cron \ libpq-dev \ postgresql-client \ libfreetype6-dev \ libjpeg62-turbo-dev \ libmcrypt-dev \ libpng12-dev \ php5-gd \ && docker-php-ext-install -j$(nproc) iconv […]

如何在kubernetes上运行一个完整的laravel?

我想知道有没有办法在Kubernetes上运行(也许)LaraDock? 因为我需要一个有nginx,phpfpm,redis,mysql,mongodb,neo4j在一个地方结合在一起的环境,同时我也需要可扩展性。 有没有最好的办法做到这一点我的项目? 参考laradock: https : //github.com/LaraDock/laradock

AngularJS不适用于LARAVEL泊坞窗

我一直在关注这个 教程 ,问题是当我去localhost我得到这个: 有人看到这个问题? 我在focker container dockervel中 运行 LAravel5 要在这个容器项目中安装节点模块,我运行 dnodejs npm install 这是错误! localhost/:65 The specified value "{{email}}" is not a valid email address. http://localhost/css/bootstrap.min.css Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/app/lib/angular/angular.min.js Failed to load resource: the server responded with a status of 404 (Not Found) […]