基于 Docker 包装的 Yii2 Web 应用程序
formerly known as Phundament 4
phd is a dockerized 12factor PHP application template for Yii Framework 2.0.
For alternative installation methods, such as composer, see the docs.
Download or clone the repository and go to the application directory
git clone https://github.com/phundament/app
cd appHeads up! Phundament features
Makefiletargets for development and continuous integration, typemake helpto see all available targets ormake allto run installation and setup.
Create environment configuration files
cp .env-dist .env
cp docker-compose.override-dist.yml docker-compose.override.ymlStart the application stack
docker-compose up -dRun setup commands
docker-compose run php composer install
docker-compose run php setup.shAfter startup is complete, open http://:40080 to access the application and login with admin/admin.
docker-compose.override.ymldocker-compose.ymlYou can override any ENV variable in .env within a docker-compose.yml file.
VIRTUAL_HOST ~^myapp\. Virtual-host configuration for reverse proxy, adjust the virtual host parameter
for web application, we'll use it later to easily access the web-server through a wildcard DNS..envDuring development, it is recommended to change application configuration in the .env file, since it does not require restarting the containers.
Application
APP_NAME unique application and container identifier [a-z0-9]APP_TITLE display name of the applicationAPP_LANGUAGES available languages for URL manager (eg. en,de)APP_ADMIN_EMAIL e-mail address of application admin user (default in ./yii app/create-admin-user)APP_ADMIN_PASSWORD password of application admin user (default in ./yii app/create-admin-user)APP_MIGRATION_LOOKUP comma separated list of Yii aliases to look for database migrations, eg. @app/migrations/dataAPP_CONFIG_FILE custom configuration file to loadAPP_COOKIE_VALIDATION_KEY unique and random string to prevent XSSAPP_PRETTY_URLS enable or disable nice URLs, allowed values 1 (yes) or 0 (no)APP_ASSET_FORCE_PUBLISH force asset publishing after any changes to asset files. Note! This may degrade performance, use only during development.Framework
YII_DEBUG wheter to enable more verbose application output, eg. on PHP exceptions.YII_ENV Yii application mode, allowed values dev, prod or testYII_TRACE_LEVEL amount of caller levels to display for logging.Database
DB_ENV_MYSQL_ROOT_USER user to create databasesDB_ENV_MYSQL_ROOT_PASSWORD root password, eg. set from "${DB_ENV_MARIADB_PASS}"DB_ENV_MYSQL_DATABASE database nameDB_ENV_MYSQL_PASSWORD database passwordDB_ENV_MYSQL_USER database userDB_PORT_3306_TCP_ADDR database hostnameDB_PORT_3306_TCP_PORT database portDATABASE_TABLE_PREFIX table prefix for default database connectionconfig/main.phpFor details of available application configuration, please refer to the Yii 2.0 Framework Definitive Guide.
Web UI for application wide key-value store.
pages SitemapavailableRoutesschmunk42.markdocs Markdown markdownUrl URL or local path for markdown eg. https://raw.githubusercontent.com/phundament/docs/masterdefaultIndexFile eg. 1-introduction/about.mdcms.assets Assets/LESS useDbAsset booleanadminEditorPublic:bulb: To enable public access you need to assign permissions, like app_site, docs_default, to the Public role.
First, build your application image
docker-compose build Set environment variables for test stack
export COMPOSE_PROJECT_NAME=testapp
export BUILD_PREFIX=appStart 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.shRun test suites (container bash)
$ codecept run functional prod
$ codecept run acceptance prod:information_source:
YII_ENVmust be set totestwhen running codeception.
Required variables for building & pushing docker images.
REGISTRY_USERREGISTRY_PASSREGISTRY_HOSTIMAGE_NAMEBuilt by *dmstr, Stuttgart :de:
暂无开放 Issues,或尚未同步最近议题。