Common Chart Bed Program Lsky Pro Recently updated two edition. This version uses a new bottom layer to support multiple databases, brings a new and more beautiful waterfall style and image management page, and adds watermark configuration, original image protection, and so on. But what is most gratifying is the new role groups and policy groups in various logical forms.

stay two Before version, only one storage method can exist. To take a simple chestnut: with Tencent Cloud COS, there can only be one bucket for one account. Now you can not only set multiple accounts, but also allocate these storage policies to multiple users. This is an excellent upgrade reason for non individual users. However, since I switched to Docker, the migration process of updates was somewhat bumpy. Fortunately, it was solved one by one.

Use Docker Compose to install

Now, someone has written a docker image for lskypro, so we can directly use docker compose A shuttle:

 version: '3.4' services: lskypro: image: halcyonazure/lsky-pro-docker:latest container_name: lskypro ports: - 9080:80 volumes: - ./ lskypro:/var/www/html restart: unless-stopped

Then, use nginx reverse proxy to give a simple example:

 server { listen 80 ; listen 443 ssl http2 ; server_name himiku.com; index index.html index.php; include addssl/himiku.com.conf; location / { proxy_pass  http://lskypro:80 ; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; } access_log /var/log/nginx/himiku.com.log; }

Environmental treatment

comparison 1.x This time, the installation requirements have been increased. The following conditions need to be met:

  • PHP >= 8.0.2
  • install BCMath Ctype DOM Fileinfo JSON Mbstring OpenSSL PDO Tokenizer PHP XML PHP Imagick expand
  • lift a ban exec shell_exec readlink symlink putenv getenv function

The function is good to say, in php.ini Just delete it. However, extensions are a headache. If these extensions are not compiled into PHP at the beginning, it will be troublesome to plug them one by one later. Fortunately, I use Docker, which can provide a shuttle.

PHP

Expansion required for installation

Used in my PHP 7 Dockerfile As follows:

 FROM php:7.4.27-fpm-alpine RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \ && apk update \ && apk add --virtual .build-tools --no-cache autoconf gcc g++ make \ && apk --no-cache add ffmpeg graphicsmagick zip zlib-dev libjpeg-turbo-dev libpng-dev freetype-dev imagemagick-dev imagemagick libzip-dev icu-dev \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install gd \ && docker-php-ext-install exif mysqli pdo_mysql zip bcmath intl pcntl \ && pecl install redis imagick \ && docker-php-ext-enable redis imagick \ && apk del .build-tools \ && curl -sS  https://getcomposer.org/installer  | php \ && mv composer.phar /usr/local/bin/composer \ && apk add --no-cache git

Here is a small episode. During the initial test, the upload image program always reported errors:

 Unable to read image from path

I have always suspected that it is the reason for the program permissions. I repeatedly checked for several times and could not solve the problem. When I was frustrated, I noticed that the console reported errors and imagick About, finally in GitHub Issue A workaround was found on. Because imagemagick The extension does not install the corresponding image format support.

It used to be like this. Don't worry imagemagick

 apk --no-cache add ffmpeg graphicsmagick zip zlib-dev libjpeg-turbo-dev libpng-dev freetype-dev imagemagick-dev libzip-dev icu-dev

Therefore, you can confirm whether the installation is successful imagick Extension:

 docker exec php php --ri imagick

If the following content is output, it means that the system supports parsing all image formats imagick

 imagick imagick module => enabled imagick module version => 3.7.0 imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel Imagick compiled with ImageMagick version => ImageMagick 7.1.0-16 Q16-HDRI x86_64 2021-11-21  https://imagemagick.org Imagick using ImageMagick library version => ImageMagick 7.1.0-16 Q16-HDRI x86_64 2021-11-21  https://imagemagick.org ImageMagick copyright => (C) 1999-2021 ImageMagick Studio LLC ImageMagick release date => 2021-11-21 ImageMagick number of supported formats:  => 246 ImageMagick supported formats => 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, ASHLAR, AVI, AVIF, AVS, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUBE, CUR, CUT, DATA, DCM, DCR, DCRAW, DCX, DDS, DFONT, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3,  ERF, FARBFELD, FAX, FF, FILE, FITS, FL32, FLV, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HEIC, HEIF, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, K25, KDC, KERNEL, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF,  MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORA, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB,  PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, RMF, RSVG, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TM2, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X,  X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YAML, YCbCr, YCbCrA, YUV Directive => Local Value => Master Value imagick.locale_fix => 0 => 0 imagick.skip_version_check => 0 => 0 imagick.progress_monitor => 0 => 0 imagick.set_single_thread => 1 => 1 imagick.shutdown_sleep_count => 10 => 10 imagick.allow_zero_dimension_images => 0 => 0

Multi version PHP

Because Tyeocho's support for PHP8 is still in the testing phase, while VOID does not support PHP8. So I mainly use PHP 7. But in order to use Lsky Pro 2.0, you need to add a PHP 8.

Create a new folder and rename it to php8 , lose one Dockerfile Go in. In fact, the content is different from that of PHP 7 in the previous section only in the version number:

 FROM php:8.1.3-fpm-alpine RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \ && apk update \ && apk add --virtual .build-tools --no-cache autoconf gcc g++ make \ && apk --no-cache add ffmpeg graphicsmagick zip zlib-dev libjpeg-turbo-dev libpng-dev freetype-dev imagemagick-dev imagemagick libzip-dev icu-dev \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install gd \ && docker-php-ext-install exif mysqli pdo_mysql zip bcmath intl pcntl \ && pecl install redis imagick \ && docker-php-ext-enable redis imagick \ && apk del .build-tools \ && curl -sS  https://getcomposer.org/installer  | php \ && mv composer.phar /usr/local/bin/composer \ && apk add --no-cache git

Then, in docker-compose.yml Riga term php8 , and then deploy it.

 php: build: ./ php volumes: - ./ www:/home/wwwroot - ./ php/php.ini:/usr/local/etc/php/php.ini environment: - TZ=Asia/Shanghai user: 101:101 restart: unless-stopped container_name: php php8: build: ./ php8 volumes: - ./ www:/home/wwwroot - ./ php8/php.ini:/usr/local/etc/php/php.ini environment: - TZ=Asia/Shanghai user: 101:101 restart: unless-stopped container_name: php8

Nginx section

For the Nginx configuration of the program, in addition to using pseudo static according to the official documents, you also need to comment out Nginx's own cache of images to enable original image protection.

However, my Nginx environment uses the configuration in the LNMP script, which is different from the configuration pulled directly from the official Nginx. But the ideas are consistent, such as:

 server { listen 80 ; listen 443 ssl http2 ; server_name xxx.com;  Here is the certificate; index index.html index.php ; root /home/wwwroot/lsky/public; …… #Pseudo static location / { try_files $uri $uri/ /index.php?$ query_string; } #What needs to be commented out # location ~ .*\. (gif|webp|jpg|jpeg|png|bmp|swf)$ { #     expires 30d; # } …… #Using php8 location ~ [^/]\.php(/|$) { try_files $uri =404; fastcgi_pass  php8:9000; fastcgi_index index.php; include fastcgi.conf; } …… }

It is recommended that the test be completed before the production environment is launched.

Installing Lsky Pro 2.0

The installation of the program is very simple. Download the compressed package directly from the official GitHub Releases page, decompress it to the server, and set the permissions. At the beginning, a self check will be performed to prompt missing modules or disabled functions. If the conditions cannot be met, the next step cannot be carried out.

If it is a new user, it is recommended to select SQlite Old users certainly have no choice. In order to use data transfer scripts, you need to select MySQL

As long as the database configuration is correct, it can be solved quickly.

Old users need to stop at this step to migrate the database.

Download according to the official documents Migration script Some commands under Docker are different.

For example, I unzip the script to the mapped www Folder, according to docker-compose.yml Write the specific location of this script for the mapping path set in.

 docker exec php8 php /home/wwwroot/migrate/start.php migrate

In fact, in the official document, "use ssh tool to log in to the server, cd to the script root directory (the same level as the start.php file), and then execute the migration command php start.php migrate ", but I forgot that I used Docker and copied and pasted it several times.

If config.yaml If the configuration file is filled correctly, the following transfer progress will appear.

After the database conversion is successful, you can continue to set the graph bed.

This is the main interface.

The picture library is like this.

The storage strategy is beyond the scope of this article. If I write it, I will digress.

Here we go first.

reference resources