Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 0f5073e

Browse files
Initial commit for Process UI demo
0 parents  commit 0f5073e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+8813
-0
lines changed

.docker/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

.docker/docker-compose.override.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version: "3.4"
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version: "3.4"

.docker/docker-compose.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
version: "3.4"
2+
3+
x-base-php: &base-php
4+
build:
5+
context: ./php
6+
args:
7+
UID: ${UID:-1000}
8+
GID: ${GID:-1000}
9+
PHP_VERSION: ${PHP_VERSION:-8.2}
10+
XDEBUG_VERSION: ${XDEBUG_VERSION:-3.2.0}
11+
env_file: .env
12+
working_dir: ${VOLUME_ROOT:-/var/www/html}
13+
volumes:
14+
- ../:${VOLUME_ROOT:-/var/www/html}
15+
- ./php/ini/symfony.ini:/usr/local/etc/php/conf.d/99-symfony.ini
16+
extra_hosts:
17+
- "host.docker.internal:host-gateway"
18+
environment:
19+
COMPOSER_HOME: ${VOLUME_ROOT:-/var/www/html}/.composer
20+
COMPOSER_MEMORY_LIMIT: -1
21+
HOME: ${VOLUME_ROOT:-/var/www/html}
22+
XDEBUG_MODE: ${XDEBUG_MODE:-off}
23+
PHP_IDE_CONFIG: serverName=sandbox_symfony
24+
XDEBUG_CONFIG: ${XDEBUG_CONFIG:-}
25+
26+
services:
27+
php:
28+
<<: *base-php
29+
ports:
30+
- "8000:8000"
31+
32+
# database:
33+
# image: postgres:${POSTGRES_VERSION:-15}-alpine
34+
# environment:
35+
# POSTGRES_DB: ${POSTGRES_DB:-app}
36+
# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
37+
# POSTGRES_USER: ${POSTGRES_USER:-app}
38+
# volumes:
39+
# - database_data:/var/lib/postgresql/data:rw
40+
# ports:
41+
# - '5432:5432'
42+
database:
43+
image: mariadb:latest
44+
environment:
45+
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
46+
MYSQL_DATABASE: ${MYSQL_DATABASE:-app}
47+
MYSQL_USER: ${MYSQL_USER:-app}
48+
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-!ChangeMe!}
49+
volumes:
50+
- database_data:/var/lib/mysql:rw
51+
ports:
52+
- '3306:3306'
53+
54+
volumes:
55+
database_data:

.docker/php/Dockerfile

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
ARG PHP_VERSION=8.0
2+
FROM php:${PHP_VERSION}-fpm AS php
3+
ARG XDEBUG_VERSION=3.1.4
4+
5+
# Set user and group
6+
ARG UID=1000
7+
ARG GID=1000
8+
RUN usermod --uid ${UID} www-data && \
9+
groupmod --gid ${GID} www-data
10+
11+
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
12+
RUN chmod +x /usr/local/bin/install-php-extensions
13+
RUN curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | bash -E
14+
15+
# Install packages
16+
RUN apt-get update && apt-get install -y \
17+
wget \
18+
git \
19+
unzip \
20+
libicu-dev \
21+
libzip-dev \
22+
gosu \
23+
symfony-cli \
24+
&& docker-php-ext-configure intl \
25+
&& install-php-extensions \
26+
intl \
27+
pcntl \
28+
opcache \
29+
zip \
30+
gd \
31+
imagick \
32+
pdo \
33+
pdo_pgsql \
34+
pgsql \
35+
pdo_mysql \
36+
mysqli \
37+
sysvsem
38+
RUN pecl install xdebug-${XDEBUG_VERSION}
39+
## Install composer
40+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
41+
42+
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
43+
RUN chmod +x /usr/local/bin/entrypoint.sh
44+
ENTRYPOINT ["entrypoint.sh"]
45+
CMD ["php-fpm"]

.docker/php/entrypoint.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -eux
3+
4+
if [[ "${XDEBUG_MODE}" != "off" ]]; then
5+
docker-php-ext-enable xdebug
6+
fi
7+
8+
[ "$1" == 'bin/console' ] || [ "$1" == 'bash' ] || [ "$1" == 'php' ] && \
9+
exec gosu www-data docker-php-entrypoint "$@"
10+
11+
exec docker-php-entrypoint "$@"

.docker/php/ini/symfony.ini

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apc.enable_cli = 1
2+
date.timezone = Europe/Paris
3+
opcache.enable_cli = 1
4+
session.auto_start = Off
5+
short_open_tag = Off
6+
7+
# http://symfony.com/doc/current/performance.html
8+
opcache.interned_strings_buffer = 16
9+
opcache.max_accelerated_files = 20000
10+
opcache.memory_consumption = 256
11+
realpath_cache_size = 4096K
12+
realpath_cache_ttl = 600
13+
14+
memory_limit=512M
15+
post_max_size = 6M
16+
upload_max_filesize = 5M

.env

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
13+
#
14+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
15+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
16+
17+
###> symfony/framework-bundle ###
18+
APP_ENV=dev
19+
APP_SECRET=5d06ec43bb4fba3510e81575422626eb
20+
###< symfony/framework-bundle ###
21+
22+
###> symfony/messenger ###
23+
# Choose one of the transports below
24+
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
25+
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
26+
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
27+
###< symfony/messenger ###
28+
29+
###> doctrine/doctrine-bundle ###
30+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
31+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
32+
#
33+
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
34+
# DATABASE_URL="mysql://app:!ChangeMe!@database:3306/app?serverVersion=8.0.32&charset=utf8mb4"
35+
# DATABASE_URL="mysql://app:!ChangeMe!@database:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
36+
#DATABASE_URL="postgresql://app:!ChangeMe!@database:5432/app?serverVersion=15&charset=utf8"
37+
###< doctrine/doctrine-bundle ###

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.idea
2+
.symfony5
3+
.composer
4+
.bash_history
5+
6+
###> symfony/framework-bundle ###
7+
/.env.local
8+
/.env.local.php
9+
/.env.*.local
10+
/config/secrets/prod/prod.decrypt.private.php
11+
/public/bundles/
12+
/var/cache
13+
var/log
14+
var/storage
15+
/vendor/
16+
###< symfony/framework-bundle ###
17+
18+
###> friendsofphp/php-cs-fixer ###
19+
/.php-cs-fixer.php
20+
/.php-cs-fixer.cache
21+
###< friendsofphp/php-cs-fixer ###
22+
23+
###> phpstan/phpstan ###
24+
phpstan.neon
25+
###< phpstan/phpstan ###
26+
27+
!var/data.db

.php-cs-fixer.dist.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
->exclude('var')
6+
;
7+
8+
return (new PhpCsFixer\Config())
9+
->setRules([
10+
'@Symfony' => true,
11+
])
12+
->setFinder($finder)
13+
;

Makefile

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.ONESHELL:
2+
SHELL := /bin/bash
3+
4+
DOCKER_RUN_PHP = docker compose -f .docker/docker-compose.yml -f .docker/docker-compose.override.yml run --rm php "bash" "-c"
5+
DOCKER_COMPOSE = docker compose -f .docker/docker-compose.yml -f .docker/docker-compose.override.yml
6+
7+
8+
start: up src/vendor doctrine/migrations assets/install server/start messenger/consume #[Global] Start application
9+
10+
src/vendor: #[Composer] install dependencies
11+
$(DOCKER_RUN_PHP) "composer install --no-interaction"
12+
13+
up: #[Docker] Start containers
14+
$(DOCKER_COMPOSE) up --remove-orphans --detach
15+
16+
stop: #[Docker] Down containers
17+
$(DOCKER_COMPOSE) stop
18+
19+
down: #[Docker] Down containers
20+
$(DOCKER_COMPOSE) down
21+
22+
build: #[Docker] Build containers
23+
$(DOCKER_COMPOSE) build
24+
25+
ps: # [Docker] Show running containers
26+
$(DOCKER_COMPOSE) ps
27+
28+
bash: #[Docker] Connect to php container with current host user
29+
$(DOCKER_COMPOSE) exec -u $$(id -u $${USER}):$$(id -g $${USER}) php bash
30+
31+
logs: #[Docker] Show logs
32+
$(DOCKER_COMPOSE) logs -f
33+
34+
messenger/consume: #[Symfony] Consume messages
35+
$(DOCKER_RUN_PHP) "bin/console mess:cons"
36+
37+
doctrine/migrations: #[Symfony] Run database migration
38+
$(DOCKER_RUN_PHP) "bin/console do:mi:mi --no-interaction"
39+
40+
assets/install: #[Symfony] Install assets
41+
$(DOCKER_RUN_PHP) "bin/console assets:install"
42+
43+
cache/clean: #[Symfony] Clean cache
44+
$(DOCKER_RUN_PHP) "bin/console c:c"
45+
46+
server/start: #[Symfony CLI] Start Symfony http server
47+
$(DOCKER_COMPOSE) exec -u $$(id -u $${USER}):$$(id -g $${USER}) php "bash" "-c" "symfony serve -d --no-tls"
48+
49+
server/stop: #[Symfony CLI] Stop Symfony http server
50+
$(DOCKER_COMPOSE) exec -u $$(id -u $${USER}):$$(id -g $${USER}) php "bash" "-c" "symfony server:stop"
51+
52+
server/restart: server/stop server/start #[Symfony CLI] Restart Symfony http server

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**Process UI Bundle demo**
2+
*A sample application for process-bundle & process-bundle-UI*
3+
4+
**Usage**
5+
6+
make start
7+
8+
Then acces to UI via http://localhost:8000/process (username: [email protected] / password: [email protected])

bin/console

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use App\Kernel;
5+
use Symfony\Bundle\FrameworkBundle\Console\Application;
6+
7+
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
8+
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
9+
}
10+
11+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
12+
13+
return function (array $context) {
14+
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
15+
16+
return new Application($kernel);
17+
};

composer.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "cleverage/process-bundle-ui-demo",
3+
"type": "project",
4+
"description": "A minimal project using cleverage/process-bundle & cleverage/process-bundle-ui",
5+
"autoload": {
6+
"psr-4": {
7+
"App\\": "src/"
8+
}
9+
},
10+
"require": {
11+
"symfony/flex": "^v2.3",
12+
"cleverage/process-bundle": "dev-v4-dev",
13+
"cleverage/process-ui-bundle": "dev-v2-dev"
14+
},
15+
"require-dev": {
16+
"symfony/maker-bundle": "^1.51",
17+
"symfony/stopwatch": "^6.3",
18+
"symfony/web-profiler-bundle": "^6.3",
19+
"friendsofphp/php-cs-fixer": "^3.34",
20+
"phpstan/phpstan": "^1.10",
21+
"symfony/debug-bundle": "^6.3"
22+
},
23+
"scripts": {
24+
"auto-scripts": {
25+
"cache:clear": "symfony-cmd",
26+
"assets:install %PUBLIC_DIR%": "symfony-cmd"
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)