From ba19e0e0cfaad0341eadafefd3884ad306efee5e Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Sat, 27 Aug 2022 14:58:29 +0200 Subject: [PATCH] wip #5418 @4 --- .docker/config/crontab | 7 ++ .docker/config/php.ini | 5 ++ .docker/config/supervisor/default-worker.conf | 11 +++ .../config/supervisor/download-worker.conf | 11 +++ .../supervisor/fluidbook-process-worker.conf | 11 +++ .docker/config/supervisor/theme-worker.conf | 11 +++ .docker/docker-compose.yml | 8 +- .docker/image/Dockerfile | 19 +++-- .docker/image/overrides.conf | 7 ++ .docker/image/php-ini-overrides.ini | 2 - .docker/image/startup | 5 +- README.md | 78 ------------------- app/Jobs/FluidbookCompiler.php | 4 +- app/Providers/AppServiceProvider.php | 2 +- config/cache.php | 2 +- 15 files changed, 90 insertions(+), 93 deletions(-) create mode 100644 .docker/config/crontab create mode 100644 .docker/config/php.ini create mode 100644 .docker/config/supervisor/default-worker.conf create mode 100644 .docker/config/supervisor/download-worker.conf create mode 100644 .docker/config/supervisor/fluidbook-process-worker.conf create mode 100644 .docker/config/supervisor/theme-worker.conf delete mode 100644 .docker/image/php-ini-overrides.ini delete mode 100644 README.md diff --git a/.docker/config/crontab b/.docker/config/crontab new file mode 100644 index 000000000..d8ce4b2c5 --- /dev/null +++ b/.docker/config/crontab @@ -0,0 +1,7 @@ +MAILTO=sysadmin@cubedesigners.com +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +* * * * * runuser -l toolbox -c '/usr/bin/php /application/artisan schedule:run' > /proc/1/fd/1 2>/proc/1/fd/2 +* * * * * echo 'Test cron' > /proc/1/fd/1 2>/proc/1/fd/2 +20 5 * * * /application/scripts/restartworkers > /proc/1/fd/1 2>/proc/1/fd/2 diff --git a/.docker/config/php.ini b/.docker/config/php.ini new file mode 100644 index 000000000..702f901d9 --- /dev/null +++ b/.docker/config/php.ini @@ -0,0 +1,5 @@ +upload_max_filesize = 8G +post_max_size = 8G +error_log = /proc/self/fd/2 +log_errors = 1 +memory_limit = 12G diff --git a/.docker/config/supervisor/default-worker.conf b/.docker/config/supervisor/default-worker.conf new file mode 100644 index 000000000..4228ba9e8 --- /dev/null +++ b/.docker/config/supervisor/default-worker.conf @@ -0,0 +1,11 @@ +[program:default-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /application/artisan queue:work --queue=default --timeout=0 +autostart=true +autorestart=true +user=toolbox +group=www-data +numprocs=3 +redirect_stderr=true +stdout_logfile=/proc/self/fd/2 +stopwaitsecs=3600 diff --git a/.docker/config/supervisor/download-worker.conf b/.docker/config/supervisor/download-worker.conf new file mode 100644 index 000000000..b3031ef26 --- /dev/null +++ b/.docker/config/supervisor/download-worker.conf @@ -0,0 +1,11 @@ +[program:download-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /application/artisan queue:work --queue=download --timeout=0 +autostart=true +autorestart=true +user=toolbox +group=www-data +numprocs=6 +redirect_stderr=true +stdout_logfile=/proc/self/fd/2 +stopwaitsecs=3600 diff --git a/.docker/config/supervisor/fluidbook-process-worker.conf b/.docker/config/supervisor/fluidbook-process-worker.conf new file mode 100644 index 000000000..5a72019cb --- /dev/null +++ b/.docker/config/supervisor/fluidbook-process-worker.conf @@ -0,0 +1,11 @@ +[program:process-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /application/artisan queue:work --queue=fluidbookprocess --timeout=0 +autostart=true +autorestart=true +user=toolbox +group=www-data +numprocs=48 +redirect_stderr=true +stdout_logfile=/proc/self/fd/2 +stopwaitsecs=3600 diff --git a/.docker/config/supervisor/theme-worker.conf b/.docker/config/supervisor/theme-worker.conf new file mode 100644 index 000000000..b1421bc3d --- /dev/null +++ b/.docker/config/supervisor/theme-worker.conf @@ -0,0 +1,11 @@ +[program:theme-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /application/artisan queue:work --queue=theme --timeout=0 +autostart=true +autorestart=true +user=toolbox +group=www-data +numprocs=3 +redirect_stderr=true +stdout_logfile=/proc/self/fd/2 +stopwaitsecs=3600 diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index 8370757b4..676732bee 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -21,8 +21,8 @@ services: build: /data1/extranet/toolbox/.docker/image working_dir: /application volumes: -# - './config/passwd:/etc/passwd' - '/data1/extranet/toolbox/.docker/config/ssh/:/root/.ssh/' + - '/data1/extranet/toolbox/.docker/config/supervisor/:/etc/supervisor/conf.d/' - '/data1/extranet/toolbox/.docker/config/composer/:/root/.config/composer/' - '/data1/extranet/toolbox/.docker/config/npm/:/root/.npm/' - '/data1/extranet/toolbox/.docker/config/gitconfig:/root/.gitconfig' @@ -30,7 +30,11 @@ services: - '/home/extranet:/home/extranet' - '/mnt:/mnt' - '/data1/extranet/toolbox:/application' - - '/data1/extranet/toolbox/.docker/php-ini-overrides.ini:/etc/php/8.2/fpm/conf.d/99-overrides.ini' + - '/data1/extranet/toolbox/.docker/config/php.ini:/etc/php/8.1/fpm/conf.d/99-overrides.ini' + - '/data1/extranet/toolbox/.docker/config/crontab:/etc/crontab' + tmpfs: + - '/tmp:uid=1001,gid=33' + - '/application/storage/framework/cache:uid=1001,gid=33' networks: - fluidbook-toolbox restart: unless-stopped diff --git a/.docker/image/Dockerfile b/.docker/image/Dockerfile index c9bcb5e4d..84b58c3e9 100644 --- a/.docker/image/Dockerfile +++ b/.docker/image/Dockerfile @@ -65,19 +65,27 @@ RUN apt-get update \ STOPSIGNAL SIGQUIT -# PHP-FPM packages need a nudge to make them docker-friendly -COPY overrides.conf /etc/php/8.1/fpm/pool.d/z-overrides.conf - # Toolbox RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs + RUN apt-get -y --no-install-recommends install sudo -RUN apt-get -y --no-install-recommends install supervisor ssh +RUN apt-get -y --no-install-recommends install supervisor ssh rsync RUN apt-get -y --no-install-recommends install nsis -RUN apt-get -y --no-install-recommends install default-jre pdftk poppler-utils ghostscript imagemagick +RUN apt-get -y --no-install-recommends install default-jre pdftk poppler-utils ghostscript imagemagick netpbm libjpeg-turbo8 RUN apt-get -y --no-install-recommends install zip unzip gzip 7zip +RUN apt-get -y --no-install-recommends install icoutils fontforge +RUN apt-get -y --no-install-recommends install ffmpeg python3 +RUN apt-get -y --no-install-recommends install inkscape mupdf-tools +RUN apt-get -y --no-install-recommends install cron + RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* +RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp && chmod a+rx /usr/local/bin/yt-dlp && ln -s /usr/local/bin/yt-dlp /usr/local/bin/youtube-dl RUN useradd -d /application -g www-data -s /bin/bash -u 1001 toolbox +RUN npm install --unsafe-perm --global uglify-js less puppeteer + +# PHP-FPM packages need a nudge to make them docker-friendly +COPY overrides.conf /etc/php/8.1/fpm/pool.d/z-overrides.conf #CMD ["/usr/sbin/php-fpm8.1", "-O" ] COPY startup /usr/bin/startup @@ -85,4 +93,3 @@ CMD exec /usr/bin/startup # Open up fcgi port EXPOSE 9000 - diff --git a/.docker/image/overrides.conf b/.docker/image/overrides.conf index 7b16fcd6e..5d60f05fb 100644 --- a/.docker/image/overrides.conf +++ b/.docker/image/overrides.conf @@ -28,3 +28,10 @@ clear_env = no user = 1001 group = 33 + +pm = dynamic +pm.max_children = 80 +pm.start_servers = 24 +pm.min_spare_servers = 20 +pm.max_spare_servers = 40 +pm.max_requests = 1000 diff --git a/.docker/image/php-ini-overrides.ini b/.docker/image/php-ini-overrides.ini deleted file mode 100644 index bf24fefb3..000000000 --- a/.docker/image/php-ini-overrides.ini +++ /dev/null @@ -1,2 +0,0 @@ -upload_max_filesize = 2G -post_max_size = 2G diff --git a/.docker/image/startup b/.docker/image/startup index 567816780..d2ec45531 100644 --- a/.docker/image/startup +++ b/.docker/image/startup @@ -1,3 +1,6 @@ #!/bin/sh -#/application/bin/restarthome + +chmod 0644 /etc/crontab && crontab -u root /etc/crontab +/usr/sbin/service cron start +/usr/sbin/service supervisor start /usr/sbin/php-fpm8.1 -O diff --git a/README.md b/README.md deleted file mode 100644 index 81f2f62ba..000000000 --- a/README.md +++ /dev/null @@ -1,78 +0,0 @@ -

- -

-Build Status -Total Downloads -Latest Stable Version -License -

- -## About Laravel - -Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: - -- [Simple, fast routing engine](https://laravel.com/docs/routing). -- [Powerful dependency injection container](https://laravel.com/docs/container). -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. -- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). -- Database agnostic [schema migrations](https://laravel.com/docs/migrations). -- [Robust background job processing](https://laravel.com/docs/queues). -- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). - -Laravel is accessible, powerful, and provides tools required for large, robust applications. - -## Learning Laravel - -Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. - -If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. - -## Laravel Sponsors - -We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell). - -- **[Vehikl](https://vehikl.com/)** -- **[Tighten Co.](https://tighten.co)** -- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** -- **[64 Robots](https://64robots.com)** -- **[Cubet Techno Labs](https://cubettech.com)** -- **[Cyber-Duck](https://cyber-duck.co.uk)** -- **[British Software Development](https://www.britishsoftware.co)** -- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)** -- **[DevSquad](https://devsquad.com)** -- [UserInsights](https://userinsights.com) -- [Fragrantica](https://www.fragrantica.com) -- [SOFTonSOFA](https://softonsofa.com/) -- [User10](https://user10.com) -- [Soumettre.fr](https://soumettre.fr/) -- [CodeBrisk](https://codebrisk.com) -- [1Forge](https://1forge.com) -- [TECPRESSO](https://tecpresso.co.jp/) -- [Runtime Converter](http://runtimeconverter.com/) -- [WebL'Agence](https://weblagence.com/) -- [Invoice Ninja](https://www.invoiceninja.com) -- [iMi digital](https://www.imi-digital.de/) -- [Earthlink](https://www.earthlink.ro/) -- [Steadfast Collective](https://steadfastcollective.com/) -- [We Are The Robots Inc.](https://watr.mx/) -- [Understand.io](https://www.understand.io/) -- [Abdel Elrafa](https://abdelelrafa.com) -- [Hyper Host](https://hyper.host) -- [Appoly](https://www.appoly.co.uk) -- [OP.GG](https://op.gg) - -## Contributing - -Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). - -## Code of Conduct - -In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). - -## Security Vulnerabilities - -If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. - -## License - -The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). diff --git a/app/Jobs/FluidbookCompiler.php b/app/Jobs/FluidbookCompiler.php index bf75a7cec..0fb18c0ae 100644 --- a/app/Jobs/FluidbookCompiler.php +++ b/app/Jobs/FluidbookCompiler.php @@ -2765,7 +2765,7 @@ height="0" width="0" style="display:none;visibility:hidden"> if (file_exists($tmp) && filesize($tmp) > 0) { if ($hasNonMin) { - $uglify = new CommandLine('/usr/local/bin/uglifyjs'); + $uglify = new CommandLine('uglifyjs'); $uglify->setArg('o', $minimized); $uglify->setArg(null, $tmp); $uglify->execute(); @@ -3314,7 +3314,7 @@ height="0" width="0" style="display:none;visibility:hidden"> // Less files must be copied to temporary directory so they'll // have access to the variables generated in book-variables.less copy($source_less, $destination_less); - $less = new CommandLine('/usr/local/bin/lessc'); + $less = new CommandLine('lessc'); $less->setArg(null, $destination_less); $less->setArg(null, $destination_css); $less->execute(); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ee8ca5bcd..9839163f4 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -23,6 +23,6 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - // + \Illuminate\Support\Facades\URL::forceScheme('https'); } } diff --git a/config/cache.php b/config/cache.php index 46751e627..400016342 100644 --- a/config/cache.php +++ b/config/cache.php @@ -49,7 +49,7 @@ return [ 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework'), ], 'memcached' => [ -- 2.39.5