Skip to content

Commit

Permalink
Magento 2.4.4, PHP 8.1, Ubuntu 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
gaiterjones committed Jul 4, 2022
1 parent e30bfcf commit b6f0b5a
Show file tree
Hide file tree
Showing 39 changed files with 1,336 additions and 285 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@

# Docker Magento 2.4.X Open Source (CE) 01-2022
# Docker Magento 2.4.X Open Source (CE) 07-2022

Docker containers for Magento 2.4.x development including :

- PHP 7.4
- Ubuntu 22.04
- PHP 8.1
- Apache 2.4
- MYSQL 8
- Varnish 6 FPC
- RabbitMQ
- Varnish 7 FPC
- RabbitMQ 3.x
- PhpMyAdmin
- memcached
- ELASTIC search 7.x
Expand Down
2 changes: 1 addition & 1 deletion magento2/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM elasticsearch:7.9.3
FROM elasticsearch:7.16.1
LABEL maintainer="GAITERJONES"
# Magento 2 required plugins
# https://github.com/elastic/elasticsearch-analysis-icu
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php


namespace PAJ\Library\Docker\Scale\Varnish\Admin;

class ServerAddress
{
const DEFAULT_HOST = '127.0.0.1';
const DEFAULT_PORT = 6082;
/**
* Host on which varnishadm is listening.
*
* @var string
*/
private $host;
/**
* Port on which varnishadm is listening, usually 6082.
*
* @var int port
*/
private $port;

/**
* ServerAddress constructor.
* @param string $host
* @param int $port
*/
public function __construct($host, $port)
{
$this->host = $host;
if (empty($this->host)) {
$this->host = self::DEFAULT_HOST;
}
$this->port = $port;
if (empty($this->port)) {
$this->port = self::DEFAULT_PORT;
}
}

/**
* @return string
*/
public function getHost()
{
return $this->host;
}

/**
* @return int
*/
public function getPort()
{
return $this->port;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php


namespace PAJ\Library\Docker\Scale\Varnish\Admin;

use \Exception;

class Socket
{
private $fp;

private $host;
private $port;

public function openSocket($host, $port, $timeout)
{

$this->host = $host;
$this->port = $port;
$errno = null;
$errstr = null;

$this->fp = fsockopen($this->host, $this->port, $errno, $errstr, $timeout);
if (!is_resource($this->fp)) {
// error would have been raised already by fsockopen
throw new Exception(sprintf(
'Failed to connect to varnishadm on %s:%s; "%s"',
$this->host,
$this->port,
$errstr
));
}
// set socket options
stream_set_blocking($this->fp, 1);
stream_set_timeout($this->fp, $timeout);
}

public function read(&$code)
{
$code = null;
$len = null;
// get bytes until we have either a response code and message length or an end of file
// code should be on first line, so we should get it in one chunk
while (!feof($this->fp)) {
$response = fgets($this->fp, 1024);
if (!$response) {
$meta = stream_get_meta_data($this->fp);
if ($meta['timed_out']) {
throw new Exception(sprintf('Timed out reading from socket %s:%s', $this->host, $this->port));
}
}
if (preg_match('/^(\d{3}) (\d+)/', $response, $r)) {
$code = (int)$r[1];
$len = (int)$r[2];
break;
}
}
if (is_null($code)) {
throw new Exception('Failed to get numeric code in response');
}
$response = '';
while (!feof($this->fp) && strlen($response) < $len) {
$response .= fgets($this->fp, 1024);
}

return $response;
}


public function write($data)
{
$bytes = fputs($this->fp, $data);
if ($bytes !== strlen($data)) {
throw new Exception(sprintf('Failed to write to varnishadm on %s:%s', $this->host, $this->port));
}

return true;
}

public function close()
{
is_resource($this->fp) && fclose($this->fp);
$this->fp = null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

/**
* Varnish admin socket for executing varnishadm CLI commands.
*
* @see https://www.varnish-cache.org/docs/4.0/reference/varnish-cli.html
*
* @author Jesus Lopez http://jesuslc.com
**/

namespace PAJ\Library\Docker\Scale\Varnish\Admin;

interface VarnishAdmin
{
/**
* Brutal close, doesn't send quit command to varnishadm.
*/
public function close();

/**
* Connect to admin socket.
*
* @param int $timeout in seconds, defaults to 5; used for connect and reads
*
* @return string the banner, in case you're interested
*/
public function connect($timeout = 5);

/**
* Shortcut to purge function.
*
* @see https://www.varnish-cache.org/docs/4.0/users-guide/purging.html
*
* @param string $expr is a purge expression in form "<field> <operator> <arg> [&& <field> <oper> <arg>]..."
*
* @return string
*/
public function purge($expr);

/**
* Shortcut to purge.url function.
*
* @see https://www.varnish-cache.org/docs/4.0/users-guide/purging.html
*
* @param string $url is a url to purge
*
* @return string
*/
public function purgeUrl($url);

/**
* Graceful close, sends quit command.
*/
public function quit();

/**
* @return bool
*/
public function start();

/**
* Test varnish child status.
*
* @return bool whether child is alive
*/
public function status();

/**
* Set authentication secret.
* Warning: may require a trailing newline if passed to varnishadm from a text file.
*
* @param string
*/
public function setSecret($secret);

/**
* @return bool
*/
public function stop();
}
Loading

0 comments on commit b6f0b5a

Please sign in to comment.