Skip to content

Docker compose to run LAMP stack for Phalcon3, Phalcon4 and Phalcon5

License

Notifications You must be signed in to change notification settings

Nazariy/phalcon-nest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phalcon Nest

This package helps to launch and debug Phalcon LAMP project under different versions

Preconfigured Services:

  • MySQL 8
  • Apache2 + Phalcon3 + php7.3 + DevTools
  • Apache2 + Phalcon4 + php7.4 + DevTools
  • Apache2 + Phalcon5 + php8.0

Each service configured with support of following libraries:

Setting up your project

Option 1

Create a new git project

git clone https://github.com/nazariy/phalcon-nest.git

Option 2

Add to existing project under /docker/ directory

 git submodule add https://github.com/nazariy/phalcon-nest.git docker

Configuration

Update your .env file where docker-compose.yml is located

# Docker defaults
COMPOSE_PROJECT_NAME=nest
COMPOSE_PROJECT_WORKING_DIR=/home
# MySQL
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=nest
MYSQL_USER=phalcon
MYSQL_PASSWORD=phalcon
MYSQL_HOSTNAME=172.50.50.8
MYSQL_PORT=3306
# Apache defaults
APACHE_DOCUMENT_ROOT=/home
APACHE_PUBLIC_DOCUMENT_ROOT=/home/public

Note: mysql host is not accessible via localhost for that reason we are using IP address from our subnet

NewRelic

This step is optional, but it's always good to have some insights on your application performance and issues

Our PHP agent auto-instruments your code so you can start monitoring applications. You can use our guided installation for an automated install, or follow the instructions in this document to complete a basic PHP agent installation. Either way, you need a New Relic account. (It's free, forever.)

Update your php.ini and set your license key which can be obtained for free

[newrelic]
newrelic.license = "YOUR_SHINY_LICENSE"
newrelic.logfile = "/var/log/newrelic/php_agent.log"
newrelic.appname = "Phalcon Application"
newrelic.daemon.logfile = "/var/log/newrelic/newrelic-daemon.log"
newrelic.daemon.app_connect_timeout = 15s
newrelic.daemon.start_timeout = 5s

xDebug

Here is a minimum configuration for PHPStorm, add this lines to your php.ini file, accessed via port 9003

[xdebug]
xdebug.mode                 = debug,develop
xdebug.idekey               = "PHPSTORM"
xdebug.start_with_request   = yes
xdebug.client_host          = host.docker.internal
xdebug.cli_color            = 1

Starting container

By default, when accessing https://localhost you would see a test page with phpinfo() output

Phalcon3 (v3.4.5)

docker compose -f docker-compose.yml up -d phalcon3

Phalcon4 (v4.1.3)

docker compose -f docker-compose.yml up -d phalcon4

Phalcon5 (v5.0.0beta2)

docker compose -f docker-compose.yml up -d phalcon5

Please note that DevTools are not compatible with the latest version of Phalcon5

Troubleshooting

Time to time things can go wrong depending on your current operating system and other factors.

Here are few issues I came across while playing with containers

failed to solve rpc error code

example error code:

failed to solve rpc error code = unknown desc = failed to solve with frontend dockerfile.v0

solution: Disable buildkit

stackoverflow