diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7b3318b..2c38473 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
# 0.17.1
* fix: LIMIT & OFFSET are not supported with replacing select count(*)
+* feat: improve demo
# 0.17.0
diff --git a/Dockerfile b/Dockerfile
index 2c4c735..0a10c2a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,8 @@
# Use an official PHP runtime as a parent image
FROM php:8.3-apache
-ENV APACHE_DOCUMENT_ROOT /var/www/html/tests/public
-ENV TERM xterm-256color
+ENV APACHE_DOCUMENT_ROOT=/var/www/html/tests/public
+ENV TERM=xterm-256color
+ENV TTYD_VERSION=1.7.7
# Set the working directory in the container
WORKDIR /var/www/html
@@ -10,18 +11,25 @@ WORKDIR /var/www/html
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
-# Enable Apache mod_rewrite
-RUN a2enmod rewrite
-
# Install PHP extensions and other dependencies
RUN apt-get update && \
- apt-get install -y libicu-dev && \
+ apt-get install -y supervisor libicu-dev && \
docker-php-ext-install intl && \
docker-php-ext-install pcntl
+# Enable Apache mod_rewrite
+RUN a2enmod rewrite proxy proxy_wstunnel proxy_http
+
+# install ttyd
+RUN curl -fsSL https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64 -o /usr/local/bin/ttyd && \
+ chmod +x /usr/local/bin/ttyd
+
# Expose the port Apache listens on
EXPOSE 80
+COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
+COPY docker/000-default.conf /etc/apache2/sites-available/000-default.conf
+
# Copy your PHP application code into the container
COPY . .
@@ -29,4 +37,4 @@ RUN mkdir -p /var/www/html/tests/var && chmod -R 777 /var/www/html/tests/var
RUN tests/bin/console importmap:install
# Start Apache when the container runs
-CMD ["apache2-foreground"]
\ No newline at end of file
+CMD ["/usr/bin/supervisord"]
\ No newline at end of file
diff --git a/docker/000-default.conf b/docker/000-default.conf
new file mode 100644
index 0000000..feda24d
--- /dev/null
+++ b/docker/000-default.conf
@@ -0,0 +1,37 @@
+
+ # The ServerName directive sets the request scheme, hostname and port that
+ # the server uses to identify itself. This is used when creating
+ # redirection URLs. In the context of virtual hosts, the ServerName
+ # specifies what hostname must appear in the request's Host: header to
+ # match this virtual host. For the default virtual host (this file) this
+ # value is not decisive as it is used as a last resort host regardless.
+ # However, you must set it for any further virtual host explicitly.
+ #ServerName www.example.com
+
+ ServerAdmin webmaster@localhost
+ DocumentRoot ${APACHE_DOCUMENT_ROOT}
+
+ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
+ # error, crit, alert, emerg.
+ # It is also possible to configure the loglevel for particular
+ # modules, e.g.
+ #LogLevel info ssl:warn
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+ # For most configuration files from conf-available/, which are
+ # enabled or disabled at a global level, it is possible to
+ # include a line for only one particular virtual host. For example the
+ # following line enables the CGI configuration for this host only
+ # after it has been globally disabled with "a2disconf".
+ #Include conf-available/serve-cgi-bin.conf
+
+ RewriteEngine On
+ RewriteCond %{HTTP:Upgrade} websocket [NC]
+ RewriteCond %{HTTP:Connection} upgrade [NC]
+ RewriteRule /shell/?(.*) "ws://127.0.0.1:7681/$1" [P,L]
+
+ ProxyPass /shell/ http://127.0.0.1:7681/
+ ProxyPassReverse /shell/ http://127.0.0.1:7681/
+
\ No newline at end of file
diff --git a/docker/supervisord.conf b/docker/supervisord.conf
new file mode 100644
index 0000000..72b44a4
--- /dev/null
+++ b/docker/supervisord.conf
@@ -0,0 +1,16 @@
+[supervisord]
+nodaemon=true
+logfile=/dev/null
+logfile_maxbytes=0
+
+[program:apache]
+command=apache2-foreground
+stdout_logfile=/dev/fd/1
+stdout_logfile_maxbytes=0
+redirect_stderr=true
+
+[program:ttyd]
+command=ttyd -W -p 7681 bash
+stdout_logfile=/dev/fd/1
+stdout_logfile_maxbytes=0
+redirect_stderr=true
diff --git a/tests/public/.htaccess b/tests/public/.htaccess
index f405dd9..1cd962f 100644
--- a/tests/public/.htaccess
+++ b/tests/public/.htaccess
@@ -3,27 +3,20 @@ DirectoryIndex index.php
Options -MultiViews
-
- RewriteEngine On
- RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
- RewriteRule .* - [E=BASE:%1]
+RewriteEngine On
- # Sets the HTTP_AUTHORIZATION header removed by Apache
- RewriteCond %{HTTP:Authorization} .+
- RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
+RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
+RewriteRule .* - [E=BASE:%1]
- # Removes the /index.php/ part from a URL, if present
- RewriteCond %{ENV:REDIRECT_STATUS} =""
- RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
+# Sets the HTTP_AUTHORIZATION header removed by Apache
+RewriteCond %{HTTP:Authorization} .+
+RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
- # If the requested filename exists, simply serve it.
- # Otherwise rewrite all other queries to the front controller.
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteRule ^ %{ENV:BASE}/index.php [L]
-
+# Removes the /index.php/ part from a URL, if present
+RewriteCond %{ENV:REDIRECT_STATUS} =""
+RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
-
-
- RedirectMatch 307 ^/$ /index.php/
-
-
+# If the requested filename exists, simply serve it.
+# Otherwise rewrite all other queries to the front controller.
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^ %{ENV:BASE}/index.php [L]
diff --git a/tests/src/App/Controller/DemoController.php b/tests/src/App/Controller/DemoController.php
index 53bd1c7..f7ae382 100644
--- a/tests/src/App/Controller/DemoController.php
+++ b/tests/src/App/Controller/DemoController.php
@@ -171,7 +171,6 @@ public function batch(
$item->getTitle() ?? 'null',
$item->getCategory()->value,
);
-
}
}
@@ -197,6 +196,14 @@ public function batch(
]);
}
+ #[Route('/console', name: 'console')]
+ public function console(): Response
+ {
+ return $this->render('app/console.html.twig', [
+ 'pageable_generators' => $this->pageableGenerators,
+ ]);
+ }
+
/**
* @param class-string $class
*/
diff --git a/tests/templates/app/base.html.twig b/tests/templates/app/base.html.twig
index 030f7e1..77eb7f8 100644
--- a/tests/templates/app/base.html.twig
+++ b/tests/templates/app/base.html.twig
@@ -144,6 +144,9 @@
{% endfor %}
+
+ Batch CLI
+
API
diff --git a/tests/templates/app/console.html.twig b/tests/templates/app/console.html.twig
new file mode 100644
index 0000000..ee1c1e6
--- /dev/null
+++ b/tests/templates/app/console.html.twig
@@ -0,0 +1,15 @@
+{% extends "app/base.html.twig" %}
+
+{% block title %}
+ Console
+{% endblock title %}
+
+{% block content %}
+
+ To run batch command line interface demo, use the following command: php tests/bin/console app:simplebatch
. Add --help
to see the available options.
+
+
+
+
+
+{% endblock content %}