phundament / app

Dockerized Yii2 web application base
http://phundament.com
Other
310 stars 129 forks source link

:rotating_light: THIS PROJECT IS DEPRECATED - Next version phd5 is available


phd4

formerly known as Phundament 4

phd is a dockerized 12factor PHP application template for Yii Framework 2.0.

Requirements

For alternative installation methods, such as composer, see the docs.

Installation

Download or clone the repository and go to the application directory

git clone https://github.com/phundament/app
cd app

Heads up! Phundament features Makefile targets for development and continuous integration, type make help to see all available targets or make all to run installation and setup.

Create environment configuration files

cp .env-dist .env
cp docker-compose.override-dist.yml docker-compose.override.yml

Start the application stack

docker-compose up -d

Run setup commands

docker-compose run php composer install
docker-compose run php setup.sh

After startup is complete, open http://<DOCKER_HOST>:40080 to access the application and login with admin/admin.

Configuration

Environment overrides - docker-compose.override.yml

Environment defaults - docker-compose.yml

You can override any ENV variable in .env within a docker-compose.yml file.

Application defaults - .env

During development, it is recommended to change application configuration in the .env file, since it does not require restarting the containers.

Application

Framework

Database

Application configuration - config/main.php

For details of available application configuration, please refer to the Yii 2.0 Framework Definitive Guide.

Settings

Web UI for application wide key-value store.

Users & permissions

Default users

Default roles

:bulb: To enable public access you need to assign permissions, like app_site, docs_default, to the Public role.

Testing

First, build your application image

docker-compose build 

Set environment variables for test stack

export COMPOSE_PROJECT_NAME=testapp
export BUILD_PREFIX=app

Start test stack and enter tester CLI container

docker-compose -f docker-compose.yml -f build/compose/test.override.yml up -d    
docker-compose -f docker-compose.yml -f build/compose/test.override.yml run tester bash    

Setup application (container bash)

$ setup.sh

Run test suites (container bash)

$ codecept run functional prod
$ codecept run acceptance prod

:information_source: YII_ENV must be set to test when running codeception.

Deployment

Required variables for building & pushing docker images.

Links


Built by *dmstr, Stuttgart :de: