Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

parallax/k8s-openresty-php

Repository files navigation

A set of relatively clean but full-featured, split solution to running openresty and php-fpm together but in seperate containers, supporting PHP versions 5.6, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1 and 8.2 maintained byParallax

Docker Tags

openrestyDocker tag
1.15.8.2prlx/k8s-openresty-php-openresty:release-latest
PHPDocker Tag
5.6prlx/k8s-openresty-php-php:release-php-5.6-latest
7.1prlx/k8s-openresty-php-php:release-php-7.1-latest
7.2prlx/k8s-openresty-php-php:release-php-7.2-latest
7.3prlx/k8s-openresty-php-php:release-php-7.3-latest
7.4prlx/k8s-openresty-php-php:release-php-7.4-latest
8.0prlx/k8s-openresty-php-php:release-php-8.0-latest
8.1prlx/k8s-openresty-php-php:release-php-8.1-latest
8.2prlx/k8s-openresty-php-php:release-php-8.2-latest

Browse all tags on Docker Hub

Openresty

PHP

Environment Variables

These containers work with certain environment variables to control their operation. Environment variables marked as required may be omitted and things may seem to work OK but we do not test against omitting these so you may see some pretty interesting behaviour as a result.

Web/Worker just means whether these have any effect - nothing bad will happen if they are set on both.

For help running these locally with docker run see thedocker run reference

KeyDescriptionRequiredWebWorker
SITE_NAMEThe name of your project, i.e. 'mywebsite'. Used by NR for app name.
SITE_BRANCHThe running branch of your project, i.e. 'master'. Used by NR for app name.
ENVIRONMENTThe environment you're running in, i.e. 'qa' or 'production'. Used by NR for app name.
ATATUS_APM_LICENSE_KEYYour Atatus license key. Atatus won't be used if this is not set.
ATATUS_FRAMEWORKManually set the Atatus framework (see Atatus docs, typically "Laravel" or "Symfony")
ATATUS_APM_RAW_SQLSet to any value (1, true, etc) to use raw sql logging into Atatus
PHP_MEMORY_MAXMaximum PHP request memory, in megabytes (i.e. '256'). Defaults to 128.
MAX_EXECUTION_TIMEMaximum PHP and Nginx execution/fastcgi read timeout
PHP_FPM_WORKERSMaximum PHP-FPM workers. Defaults to 4 if not set.
PHP_FPM_USERUser which PHP-FPM workers are started as. Defaults to nobody.
PHP_FPM_GROUPGroup which PHP-FPM workers are started as. Defaults to nobody.
DISABLE_OPCACHESet to any value (1, true, etc) to disable PHP Opcache
PHP_OPCACHE_MEMORYMaximum PHP request memory, in megabytes (i.e. '64'). Defaults to 16.
PHP_OPCACHE_INTERNED_STRING_BUFFERMaximum PHP interned string buffer memory, in megabytes (i.e. '16'). Defaults to 2.
PHP_SESSION_STOREIf not set, PHP uses /tmp for sessions. If set to 'redis', uses redis for sessions
PHP_SESSION_STORE_REDIS_HOSTIf not set, defaults to 'redis'. Only used if PHP_SESSION_STORE is set to redis
PHP_SESSION_STORE_REDIS_PORTIf not set, defaults to 6379. Only used if PHP_SESSION_STORE is set to redis
PHP_DISABLE_CACHE_HEADERSSet to any value (1, true, etc) to disable PHP's default pragma: no-cache headers
PHP_ENABLE_SHORT_TAGSSet to any value (1, true, etc) to enable PHP short tagging

The web mode/command

The web mode is what you use to run a web server - unless you're using workers this is the only one you'll be using. It runs all the things you need to be able to run a PHP-FPM container in Kubernetes.

It is also the default behaviour for the docker containers meaning you don't need to specify a command or working directory to run.

Ports and Services

ServiceDescriptionPort/Socket
OpenrestyWeb server0.0.0.0:80
PHP-FPMPHP running as a pool of workers127.0.0.1:9000

K8s Example

deployment.yaml

apiVersion:apps/v1kind:Deploymentmetadata:annotations:cluster-autoscaler.kubernetes.io/safe-to-evict:"true"labels:app:'k8s-openresty-php-74-test'name:'k8s-openresty-php-74-test'namespace:k8s-openresty-phpspec:progressDeadlineSeconds:600replicas:1revisionHistoryLimit:1selector:matchLabels:app:'k8s-openresty-php-74-test'strategy:rollingUpdate:maxSurge:1maxUnavailable:0type:RollingUpdatetemplate:metadata:annotations:cluster-autoscaler.kubernetes.io/safe-to-evict:"true"labels:app:'k8s-openresty-php-74-test'spec:volumes:        -name:shared-filesemptyDir:{}        -name:uploadsemptyDir:{}containers:      -name:phpimage:'{{ PHP7.4IMAGEHERE }}'imagePullPolicy:IfNotPresentlivenessProbe:failureThreshold:1exec:command:            -/healthcheck.sh            ---listen-queue=10# fails if there are more than 10 processes waiting in the fpm queueinitialDelaySeconds:10periodSeconds:10successThreshold:1timeoutSeconds:5readinessProbe:failureThreshold:1exec:command:            -/healthcheck.shinitialDelaySeconds:10periodSeconds:10successThreshold:1timeoutSeconds:5resources:limits:cpu:"1"memory:512Mirequests:cpu:50mmemory:64MivolumeMounts:          -name:shared-filesmountPath:/src-shared          -name:uploadsmountPath:/var/nginx-uploads      -name:openrestyimage:'{{ OPENRESTYIMAGEHERE }}'imagePullPolicy:IfNotPresentlivenessProbe:failureThreshold:3httpGet:path:/healthzport:openrestyscheme:HTTPinitialDelaySeconds:10periodSeconds:10successThreshold:1timeoutSeconds:1readinessProbe:failureThreshold:3httpGet:path:/healthzport:openrestyscheme:HTTPinitialDelaySeconds:10periodSeconds:5successThreshold:2timeoutSeconds:2ports:        -containerPort:80name:openrestyprotocol:TCPresources:limits:cpu:"1"memory:512Mirequests:cpu:50mmemory:64MivolumeMounts:          -name:shared-filesmountPath:/src-shared          -name:uploadsmountPath:/var/nginx-uploadsdnsPolicy:ClusterFirstrestartPolicy:AlwaysterminationGracePeriodSeconds:20

service.yaml

apiVersion:v1kind:Servicemetadata:name:'openresty-74-test'namespace:k8s-openresty-phpspec:ports:  -name:openrestyport:80protocol:TCPtargetPort:80selector:app:'k8s-openresty-php-74-test'sessionAffinity:Nonetype:ClusterIP

Custom Startup Scripts

You can add behaviour to the built-in startup scripts for web, worker or both modes by adding a file to:

File PathRuns on
/start.shWeb
/start-worker.shWorker
/start-cron.shCron

The worker mode/command

The worker will run php artisan queue:work --timeout=$WORKER_TIMEOUT --tries=$WORKER_TRIES.

To run in this mode, change the Docker CMD to be /start-worker.sh instead of the default /start-web.sh.

PHP Modules

Module5.67.17.27.37.48.08.1
apc
apcu
atatus
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
imagick
intl
json
ldap
libxml
mbstring
mcrypt
memcached
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
phpdbg_webhelper
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors5


[8]ページ先頭

©2009-2025 Movatter.jp