Skip to content

Commit 70d1535

Browse files
committed
bump to phalcon v5.0.0RC4 + cli application
1 parent 0475254 commit 70d1535

File tree

103 files changed

+5650
-11488
lines changed

Some content is hidden

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

103 files changed

+5650
-11488
lines changed

.nginx.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
APPLICATION_ENV=development
2+
VHOST_NAME=phalcon5.test
3+
VHOST_FASTCGI_PASS=app-service
4+
VHOST_FASTCGI_PORT=9000
5+
NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx/sites-enabled

.sql.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MYSQL_DATABASE=phalcon5
2+
MYSQL_USER=phalcon5
3+
MYSQL_PASSWORD=secret
4+
MYSQL_ROOT_PASSWORD=root

README.md

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,60 @@
22
[![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://supportukrainenow.org/)
33
[![Russian Warship Go Fuck Yourself](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/RussianWarship.svg)](https://stand-with-ukraine.pp.ua)
44

5-
## Setup
5+
# Setup
66

77
```sh
88
$ git clone --branch php80 https://github.com/someson/phalcon5-docker.git .
99
$ docker-compose up -d --build
1010
```
1111

1212
- add to your ```[...]/etc/hosts```
13+
1314
```sh
1415
127.0.0.1 phalcon5.test
1516
```
1617

1718
- composer update from the host:
19+
1820
```sh
1921
$ docker-compose exec app-service composer install
2022
```
2123

22-
## Containers:
24+
# CLI
25+
26+
## Run console commands
27+
28+
```bash
29+
$ php ./scripts/cli.php [handler] [action] [param1] [param2] ... [paramN] -v -r -s
30+
```
31+
or for docker
32+
```bash
33+
$ docker-compose exec [service-name] php ./scripts/cli.php [handler] [action] [param1] [param2] ... [paramN] -v -r -s
34+
```
35+
Example:
36+
```bash
37+
$ docker-compose exec app-service php ./scripts/cli.php main main -v -r -s
38+
```
39+
- ```-s``` = single instance allowed
40+
- ```-v``` = verbose info
41+
- ```-r``` = recording the process into several resources of your choice (MySQL, Logs, ...)
2342

24-
- **nginx latest (alpine) + ssl + http2**
25-
- port 443 by default
2643

27-
- **php 8.0.x**
28-
- fpm port 9000
29-
- xdebug 3 (port 9003)
30-
- apcu
31-
- intl
44+
## CLI Debugging (xdebug 3.x) in PhpStorm under docker
45+
46+
2 aspects to realize:
47+
1. `-dxdebug.mode=debug -dxdebug.client_host=host.docker.internal -dxdebug.client_port=9003 -dxdebug.start_with_request=yes` has to be in called console command
48+
2. `docker-compose.yml` has to have ENV variable in PHP container: `PHP_IDE_CONFIG=serverName=phalcon5.test:80`, where `phalcon5.test:80` is your Settings > PHP > Servers > Name value.
49+
50+
where docker host for Windows or Linux:
51+
> host.docker.internal
52+
53+
for MacOS:
54+
> docker.for.mac.host.internal
55+
56+
Result:
57+
58+
```bash
59+
$ docker-compose exec app-service php -dxdebug.mode=debug -dxdebug.client_host=host.docker.internal -dxdebug.client_port=9003 -dxdebug.start_with_request=yes ./scripts/cli.php main main -v -s -r
60+
```
61+
with started listenings for PHP debug connections, certainly.

docker-compose.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,20 @@ services:
1111
- "80:80"
1212
- "443:443"
1313
volumes:
14-
- ./project:/var/www/html
15-
- ./project/storage/logs/nginx:/var/log/nginx
16-
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
17-
- ./docker/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
18-
- ./docker/nginx/conf.d/gzip.conf:/etc/nginx/conf.d/gzip.conf
19-
- ./docker/nginx/certs:/etc/ssl/certs
20-
- ./docker/nginx/sites-enabled:/etc/nginx/sites-enabled
21-
- ./docker/nginx/snippets:/etc/nginx/snippets
22-
- ./docker/nginx/templates:/etc/nginx/templates
23-
environment:
24-
APPLICATION_ENV: development
25-
VHOST_NAME: phalcon5.test
26-
VHOST_FASTCGI_PASS: app-service
27-
VHOST_FASTCGI_PORT: 9000
28-
NGINX_ENVSUBST_OUTPUT_DIR: /etc/nginx/sites-enabled
14+
- ./project:/var/www
15+
- ./project/storage/logs/nginx:/var/log/nginx:delegated
16+
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:cached
17+
- ./docker/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf:cached
18+
- ./docker/nginx/conf.d/gzip.conf:/etc/nginx/conf.d/gzip.conf:cached
19+
- ./docker/nginx/certs:/etc/ssl/certs:cached
20+
- ./docker/nginx/sites-enabled:/etc/nginx/sites-enabled:cached
21+
- ./docker/nginx/snippets:/etc/nginx/snippets:cached
22+
- ./docker/nginx/templates:/etc/nginx/templates:cached
23+
env_file:
24+
- .nginx.env
2925
depends_on:
3026
- app-service
27+
- mariadb-service
3128
networks:
3229
- backend
3330

@@ -45,10 +42,26 @@ services:
4542
- "9000:9000"
4643
- "8000:8000"
4744
volumes:
48-
- ./project:/var/www/html
45+
- ./project:/var/www
4946
- ~/composer:/root/.composer
5047
networks:
5148
- backend
5249

50+
# database (mariadb)
51+
mariadb-service:
52+
image: mariadb:latest
53+
container_name: p5-mariadb
54+
ports:
55+
- "3307:3306"
56+
volumes:
57+
- ./docker/mysql/cnf:/etc/mysql/conf.d
58+
- ./docker/mysql/database:/var/lib/mysql
59+
- ./docker/mysql/dump.sql:/docker-entrypoint-initdb.d/dump.sql
60+
restart: always
61+
env_file:
62+
- .sql.env
63+
networks:
64+
- backend
65+
5366
networks:
5467
backend:

docker/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/nginx/sites-enabled/*.conf
2+
/mysql/database/*

docker/mysql/cnf/.gitkeep

Whitespace-only changes.

docker/mysql/dump.sql

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
CREATE TABLE IF NOT EXISTS `session_data` (
2+
`id` VARCHAR(35) NOT NULL COLLATE 'utf8_general_ci',
3+
`data` TEXT NULL DEFAULT NULL COLLATE 'utf8_general_ci',
4+
`created_on` INT(10) UNSIGNED NOT NULL,
5+
`modified_on` INT(10) UNSIGNED NULL DEFAULT NULL,
6+
PRIMARY KEY (`id`) USING BTREE
7+
) COLLATE='utf8_general_ci' ENGINE=InnoDB;
8+
9+
10+
CREATE DATABASE IF NOT EXISTS `phalcon5_cli` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
11+
USE `phalcon5_cli`;
12+
13+
CREATE TABLE IF NOT EXISTS `task` (
14+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
15+
`script_name` varchar(1024) NOT NULL DEFAULT '',
16+
`params` varchar(1024) DEFAULT '',
17+
`task_name` varchar(50) DEFAULT NULL,
18+
`action_name` varchar(50) DEFAULT NULL,
19+
`server_name` varchar(30) DEFAULT '',
20+
`server_user` varchar(30) DEFAULT '',
21+
`start_time` datetime DEFAULT NULL,
22+
`stop_time` datetime DEFAULT NULL,
23+
`state` enum('RUNNING','SUCCESS','FAIL') DEFAULT 'RUNNING',
24+
`exit_status` int(10) unsigned DEFAULT NULL,
25+
`stdout` text DEFAULT NULL,
26+
`stderr` text DEFAULT NULL,
27+
`pid` int(10) unsigned NOT NULL DEFAULT 0,
28+
PRIMARY KEY (`id`)
29+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
30+
31+
32+
CREATE TABLE IF NOT EXISTS `task_runtime` (
33+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
34+
`title` varchar(2048) NOT NULL DEFAULT '',
35+
`file` varchar(1024) DEFAULT '',
36+
`line` smallint(5) unsigned DEFAULT NULL,
37+
`error_type` int(10) unsigned NOT NULL DEFAULT 0,
38+
`create_time` datetime DEFAULT NULL,
39+
`server_name` varchar(100) DEFAULT NULL,
40+
`execution_script` varchar(1024) NOT NULL DEFAULT '',
41+
`pid` int(10) unsigned NOT NULL DEFAULT 0,
42+
`ip_address` varchar(16) DEFAULT NULL,
43+
`user_id` int(10) unsigned DEFAULT NULL,
44+
PRIMARY KEY (`id`)
45+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

docker/nginx/conf.d/default.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ server {
44
charset utf-8;
55
server_name localhost;
66

7-
root /var/www/html/public;
7+
root /var/www/public;
88
}

docker/nginx/snippets/location-assets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ location = /robots.txt {
1010

1111
location ~* ^/assets/(css|docs|fonts|images|js|min|scss|libs)/(.+)$ {
1212
try_files $uri $uri = 404;
13-
root /var/www/html/public;
13+
root /var/www/public;
1414
add_header Pragma "public";
1515
expires 7d;
1616
log_not_found off;

docker/nginx/templates/vhost.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ server {
77
server {
88
listen 443 ssl http2;
99
server_name ${VHOST_NAME};
10-
root /var/www/html/public;
10+
root /var/www/public;
1111
index index.php index.html index.htm;
1212

1313
location / {

0 commit comments

Comments
 (0)