REL-0.11 Framework example documentation

This commit is contained in:
cytopia 2017-06-18 20:20:45 +02:00
parent 880895e73a
commit bab0c9707f
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
4 changed files with 326 additions and 22 deletions

View File

@ -35,12 +35,17 @@ Backups |
2. [PostgreSQL Database Restore](#3-1-postgresql-database-restore)
1. [psql](#3-2-1-psql)
2. [Adminer](#3-2-2-adminer)
4. [MongoDB](#4-mongodb)
1. [MongoDB Database Backup](#4-1-mongodb-database-backup)
1. [mongodump](#4-1-1-mongodump)
2. [MongoDB Database Restore](#4-1-mongodb-database-restore)
1. [mongorestore](#4-2-1-mongorestore)
---
## 1. Info
Backup and restore will be necessary when you are going to change MySQL or PostgreSQL versions. Each version has its own data directory and different versions do not pick up the databases from another version.
Backup and restore will be necessary when you are going to change MySQL, PostgreSQL or MongoDB versions. Each version has its own data directory and different versions do not pick up the databases from another version.
**Example**
@ -51,9 +56,12 @@ Backup and restore will be necessary when you are going to change MySQL or Postg
./data/pgsql/9.5
./data/pgsql/9.6
./data/mongo/3.2
./data/mongo/3.4
```
This is necessary as later MySQL and PostgreSQL versions will upgrade the databases making it unusable for older versions.
This is necessary as later MySQL, PostgreSQL and MongoDB versions will upgrade the databases making it unusable for older versions.
So before you change to a new database version you will have to make a backup and restore the backup in the new version.
@ -330,3 +338,38 @@ devilbox@php-7.1.6 in /shared/httpd $ tar xzOf /shared/backups/pgsql/my_db_name.
##### 3.2.2 Adminer
**[Adminer](https://www.adminer.org)** supports importing of plain (`*.sql`) or gzipped compressed (`*.sql.gz`) files out-of-the-box. Simply select the compressed or uncompressed file and press `Execute` in the Web interface.
## 4. MongoDB
#### 4.1 MongoDB Database Backup
##### 4.1.1 mongodump
**[mongodump](https://docs.mongodb.com/manual/reference/program/mongodump/)** is bundled with each PHP/HHVM container and ready to use. To backup all MongoDB databases follow the below listed example:
```shell
# Enter the Container
host> ./bash.sh
# Start the dump into /shared/backups/mongo
devilbox@php-7.1.6 in /shared/httpd $ mongodump --out /shared/backups/mongo
```
To find out more about the configuration and options of mongodump, visit its project page under: [https://docs.mongodb.com/manual/reference/program/mongodump/](https://docs.mongodb.com/manual/reference/program/mongodump/).
#### 4.2 MongoDB Database Restore
##### 4.2.1 mongorestore
**[mongorestore](https://docs.mongodb.com/manual/reference/program/mongorestore/)** is bundled with each PHP/HHVM container and ready to use. To restore all MongoDB databases follow the below listed example:
```shell
# Enter the Container
host> ./bash.sh
# Start the restore/import from /shared/backups/mongo
devilbox@php-7.1.6 in /shared/httpd $ mongorestore /shared/backups/mongo
```
To find out more about the configuration and options of mongorestore, visit its project page under: [https://docs.mongodb.com/manual/reference/program/mongorestore/](https://docs.mongodb.com/manual/reference/program/mongorestore/).

View File

@ -17,21 +17,273 @@ Examples |
## Examples
1. [Setup CakePHP](#1-setup-cakephp)
2. [Setup Drupal](#2-setup-drupal)
3. [Setup Symfony](#3-setup-symfony)
4. [Setup Wordpress](#4-setup-wordpress)
5. [Setup Yii](#5-setup-yii)
1. [Introduction](#1-introduction)
2. [Setup CakePHP](#2-setup-cakephp)
3. [Setup Drupal](#3-setup-drupal)
4. [Setup Symfony](#4-setup-symfony)
5. [Setup Wordpress](#5-setup-wordpress)
6. [Setup Yii](#6-setup-yii)
---
## 1. Setup CakePHP
## 1. Introduction
## 2. Setup Drupal
The devilbox provides popular tools for setting up and managing major frameworks or content management systems. The following bundled tools are available:
## 3. Setup Symfony
| Binary | Tool name | Framework/CMS |
|------------|-------------------|--------------------|
| `composer` | [composer](https://getcomposer.org) | CakePHPi, Symfony, Yii and others |
| `drush` | [drush](http://www.drush.org/) | Drupal |
| `drupal` | [drupal-consol](https://drupalconsole.com) | Drupal |
| `git` | [git](https://git-scm.com) | Everything available on github and other git servers |
| `symfony` | [symfony installer](https://github.com/symfony/symfony-installer) | Symfony |
| `wp` | [wp-cli](https://wp-cli.org/) | Wordpress |
## 4. Setup Wordpress
## 5. Setup Yii
## 2. Setup CakePHP
The following configuration will be used:
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Url |
|--------------|-----------------------|------------|------------|-----|
| my-cake | /shared/httpd/my-cake | my_cake | local | http://my-cake.local |
It will be ready in eight simple steps:
1. Enter the PHP container
2. Create a new VirtualHost directory
3. Install CakePHP via `composer`
4. Symlink webroot directory
5. Add MySQL database
6. Configure datbase connection
7. Setup DNS record
8. Visit http://my-cake.local in your browser
```shell
# 1. Enter the PHP container
host> ./bash.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-cake
# 3. Install CakePHP via composer
devilbox@php-7.0.20 in /shared/httpd $ cd my-cake
devilbox@php-7.0.20 in /shared/httpd $ composer create-project --prefer-dist cakephp/app cakephp
# 4. Symlink webroot directory
devilbox@php-7.0.20 in /shared/httpd $ ln -s cakephp/webroot/ htdocs
# 5. Add MySQL datbase
devilbox@php-7.0.20 in /shared/httpd $ mysql -u root -h 127.0.0.1 -p -e 'CREATE DATABASE my_cake;'
# 6. Configure datbase connection
devilbox@php-7.0.20 in /shared/httpd $ vi cakephp/config/app.php
```
```php
<?php
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => '127.0.0.1',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
//'port' => 'non_standard_port_number',
'username' => 'root',
'password' => 'secret',
'database' => 'my_cake',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
```
**7. DNS record**
If you do not have auto-DNS configured, you will need to add the following line to your Host computer's `/etc/hosts`:
```shell
127.0.0.1 my-cake.local
```
**8. Open your browser**
All set now, you can visit http://my-cake.local in your browser.
If you want to dig deeper into installing CakePHP, visit their documentation [https://book.cakephp.org/3.0/en/installation.html](https://book.cakephp.org/3.0/en/installation.html).
## 3. Setup Drupal
The following configuration will be used:
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Url |
|--------------|-----------------------|------------|------------|-----|
| my-drupal | /shared/httpd/my-drupal | my_drupal| local | http://my-drupal.local |
It will be ready in six simple steps:
1. Enter the PHP container
2. Create a new VirtualHost directory
3. Install Drupal via `drush`
4. Symlink Drupal directory
5. Setup DNS record
6. Visit http://my-drupal.local in your browser and follow instructions
```shell
# 1. Enter the PHP container
host> ./bash.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-drupal
# 3. Install Drupal via drush
devilbox@php-7.0.20 in /shared/httpd $ cd my-drupal
devilbox@php-7.0.20 in /shared/httpd $ drush dl drupal
# 4. Symlink Drupal directory
devilbox@php-7.0.20 in /shared/httpd $ ln -s drupal-8.3.3 htdocs
```
**5. DNS record**
If you do not have auto-DNS configured, you will need to add the following line to your Host computer's `/etc/hosts`:
```shell
127.0.0.1 my-drupal.local
```
**6. Open your browser**
Open your browser at http://my-drupal.local and follow the Drupal installation steps.
**Note:** For MySQL host choose `127.0.0.1`.
## 4. Setup Symfony
The following configuration will be used:
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Url |
|--------------|-----------------------|------------|------------|-----|
| my-symfony | /shared/httpd/my-symfony | - | local | http://my-symfony.local |
It will be ready in six simple steps:
1. Enter the PHP container
2. Create a new VirtualHost directory
3. Install Symfony via `symfony`
4. Symlink web directory
5. Setup DNS record
6. Visit http://my-symfony.local/app.php in your browser
```shell
# 1. Enter the PHP container
host> ./bash.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-symfony
# 3. Install Symfony via symfony
devilbox@php-7.0.20 in /shared/httpd $ cd my-symfony
devilbox@php-7.0.20 in /shared/httpd $ symfony new symfony
# 4. Symlink web directory
devilbox@php-7.0.20 in /shared/httpd $ ln -s symfony/web htdocs
```
**5. DNS record**
If you do not have auto-DNS configured, you will need to add the following line to your Host computer's `/etc/hosts`:
```shell
127.0.0.1 my-symfony.local
```
**6. Open your browser**
Open your browser at http://my-symfony.local/app.php
## 5. Setup Wordpress
The following configuration will be used:
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Url |
|--------------|-----------------------|------------|------------|-----|
| my-wp | /shared/httpd/my-wp | my_wp | local | http://my-wp.local |
It will be ready in six simple steps:
1. Enter the PHP container
2. Create a new VirtualHost directory
3. Download Wordpress via `git`
4. Symlink wordpress git directory
5. Setup DNS record
6. Visit http://my-wp.local in your browser
```shell
# 1. Enter the PHP container
host> ./bash.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-wp
# 3. Download Wordpress via git
devilbox@php-7.0.20 in /shared/httpd $ cd my-wp
devilbox@php-7.0.20 in /shared/httpd $ git clone https://github.com/WordPress/WordPress wordpress.git
# 4. Symlink wordpress git directory
devilbox@php-7.0.20 in /shared/httpd $ ln -s wordpress.git htdocs
```
**5. DNS record**
If you do not have auto-DNS configured, you will need to add the following line to your Host computer's `/etc/hosts`:
```shell
127.0.0.1 my-wp.local
```
**6. Open your browser**
Open your browser at http://my-wp.local
## 6. Setup Yii
The following configuration will be used:
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Url |
|--------------|-----------------------|------------|------------|-----|
| my-yii | /shared/httpd/my-yii | - | local | http://my-yii.local |
It will be ready in six simple steps:
1. Enter the PHP container
2. Create a new VirtualHost directory
3. Install Yii2 via `composer`
4. Symlink web directory
5. Setup DNS record
6. Visit http://my-yii.local in your browser
```shell
# 1. Enter the PHP container
host> ./bash.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-yii
# 3. Install Yii2 via composer
devilbox@php-7.0.20 in /shared/httpd $ cd my-yii
devilbox@php-7.0.20 in /shared/httpd $ composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic yii2-dev
# 4. Symlink web directory
devilbox@php-7.0.20 in /shared/httpd $ ln -s yii2-dev/web htdocs
```
**5. DNS record**
If you do not have auto-DNS configured, you will need to add the following line to your Host computer's `/etc/hosts`:
```shell
127.0.0.1 my-yii.local
```
**6. Open your browser**
Open your browser at http://my-yii.local

View File

@ -127,15 +127,17 @@ If you have never worked with docker/docker-compose before, you should check up
| Topic | Description |
|-------------------------|-------------|
| **Installing** | How to install docker, docker-compose and the devilbox |
| **Updating** | Update best practise |
| **Configuration** | How to configure the devilbox, switch versions (PHP, MySQL, PgSQL, ...) and how to set custom options (php.ini, my.cnf, httpd.conf, ...) |
| **[Run](Run.md)** | How to operate the devilbox, start and stop all or only required Docker container. |
| **[Usage](Usage.md)** | How to create projects, Email and DNS usage, tools (`composer`, `npm`, `node`, `drush`, ...), entering the container, Log files, Xdebug, Backups, Intranet, ...|
| **[Examples](Examples.md)** | Some project examples for popular CMS/Frameworks. How to setup Wordpress, Drupal, Yii, ... |
| **Technical** | Technical background information |
| **[Hacking](Hacking.md)**| How to extend the devilbox with your own docker container |
| **[FAQ](FAQ.md)** | Questions and Troubleshooting |
| **[Quickstart](Quickstart.md)** | Command overview to get you started quickly |
| **[Install](Install.md)** | How to install docker, docker-compose and the devilbox |
| **[Update](Update.md)** | Update best practise |
| **[Configure](Configure.md)** | How to configure the devilbox, switch versions (PHP, MySQL, PgSQL, ...) and how to set custom options (php.ini, my.cnf, httpd.conf, ...) |
| **[Run](Run.md)** | How to operate the devilbox, start and stop all or only required Docker container. |
| **[Usage](Usage.md)** | How to create projects, Email and DNS usage, tools (`composer`, `npm`, `node`, `drush`, ...), entering the container, Log files, Xdebug, Backups, Intranet, ...|
| **[Backups](Backups.md)** | How to backup and restore your databases for different versions. |
| **[Examples](Examples.md)** | Some project examples for popular CMS/Frameworks. How to setup Wordpress, Drupal, Yii, ... |
| **[Technical](Technical.md)** | Technical background information |
| **[Hacking](Hacking.md)** | How to extend the devilbox with your own docker container |
| **[FAQ](FAQ.md)** | Questions and Troubleshooting |
## 7. Video Tutorials

View File

@ -117,7 +117,14 @@ root@php-7.0.19 in /shared/httpd $
For your convenience a few selected tools have been pre-installed in their current version that you can use for your daily development tasks. Some of them are:
*composer, drush, drupal-console, git, node, npm*
*[composer](https://getcomposer.org)*,
*[drush](http://www.drush.org)*,
*[drupal-console](https://drupalconsole.com)*,
*[git](https://git-scm.com)*,
*[mysqldump-secure](https://mysqldump-secure.org)*,
*[node](https://nodejs.org)*,
*[npm](https://www.npmjs.com)*,
*[wp-cli](https://wp-cli.org)*
The complete list of tools including their version can be found at the PHP docker containers git repository Readme: