Stashing changes

This commit is contained in:
cytopia 2018-03-18 17:14:55 +01:00
parent ea7b2c9499
commit 2c69626a1d
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
10 changed files with 605 additions and 71 deletions

View File

@ -103,6 +103,8 @@ colon (``:``).
ports available on the external interface of the virtual machine.
.. _env_tld_suffix:
TLD_SUFFIX
----------
@ -884,7 +886,7 @@ to something else if ``53`` is already in use on your host operating system.
on port ``53`` which would result in a failure when this BIND server is starting.
You only need to set BIND to port ``53`` when you want to use the ``Auto-DNS`` feautre of the
Devilbox. When doing so, read this article with care: :ref:`enable_auto_dns`.
Devilbox. When doing so, read this article with care: :ref:`tutorial_enable_auto_dns`.
Container settings
@ -1015,6 +1017,8 @@ this time however, ``htdocs`` itself is a symlink pointing to a much deeper and
inside an actual framework directory.
.. _env_httpd_template_dir:
HTTPD_TEMPLATE_DIR
^^^^^^^^^^^^^^^^^^
@ -1033,6 +1037,47 @@ have to populate it with one of three yaml-based template files.
| ``HTTPD_TEMPLATE_DIR`` | valid dir name | ``.devilbox`` |
+------------------------+-------------------+------------------+
Let's have a look at an imaginary project directory called ``my-first-project``:
.. code-block:: bash
# Project directory
host> ls -l data/www/my-first-project/
total 4
drwxr-xr-x 2 cytopia cytopia 4096 Mar 12 23:05 htdocs/
Inside this your project directory you will need to create another directory which is called
``.devilbox`` by default. If you change the ``HTTPD_TEMPLATE_DIR`` variable to something else,
you will have to create a directory by whatever name you chose for that variable.
.. code-block:: bash
:emphasize-lines: 3,6
# Project directory
host> cd data/www/my-first-project/
host> mkdir .devilbox
host> ls -l
total 4
drwxr-xr-x 2 cytopia cytopia 4096 Mar 12 23:05 .devilbox/
drwxr-xr-x 2 cytopia cytopia 4096 Mar 12 23:05 htdocs/
Now you need to copy the ``vhost-gen`` templates into the ``.devilbox`` directory. The templates
are available in the Devilbox git directory under ``templates/vhost-gen/``.
By copying those files into your project template directory, nothing will change, these are the
default templates that will create the virtual host exactly the same way as if they were not
present.
.. code-block:: bash
:emphasize-lines: 5
# Navigate into the devilbox directory
host> cd path/to/devilbox
# Copy templates to your project directory
host> cp templates/vhost-gen/* data/www/my-first-project/.devilbox/
Let's have a look how the directory is actually built up:
.. code-block:: bash
@ -1063,6 +1108,10 @@ changing the server name or adding locations to other assets.
**Customize your virtual host**
When you want to find out more how to actually customize each virtual host to its own need,
read up more on :ref:`custom_vhost`.
**Tutorials**
Also have a look at this tutorial which is a walk-through showing you how to modify
a virtual host and make it serve all files for multiple sub domains (server names):
:ref:`tutorial_adding_sub_domains`
MySQL

View File

@ -0,0 +1,3 @@
********
Auto-DNS
********

View File

@ -1,5 +1,32 @@
.. _custom_vhost:
************************
Custom vhost (vhost-gen)
************************
***********************************
Customized virtual host (vhost-gen)
***********************************
**Table of Contents**
.. contents:: :local:
Configure vhost-gen directory
=============================
Copy vhost-gen templates
========================
Template explained
==================
Configure vhost-gen
===================
.. _custom_vhost_apply_vhost_gen_changes:
Apply vhost-gen changes
=======================
based on watcherp

View File

@ -87,6 +87,8 @@ The intranet already gives you the exact string that you can simply copy into yo
This will only work on **native Docker** for Linux or MacOS. Read up on the next section to also find out how to do that on **Docker Toolbox** and Windows.
.. _getting_started_create_your_first_project_dns_entry:
Step 4: create a DNS entry
==========================

View File

@ -106,14 +106,9 @@ Updating the git branch shouldn't be needed to often, most changes are actually
``Docker images``, so you should frequently update those.
This is usually achieved by issueing a ``docker pull`` command with the correct image name and image
version. For your convenience there is a shell script in the Devilbox git directory: ``update-docker.sh``
which will update all available Docker images at once.
.. code-block:: bash
# Update docker images
host> cd path/to/devilbox
host> ./update-docker.sh
version or ``docker-compose pull`` for all currently selected images in ``.env`` file.
For your convenience there is a shell script in the Devilbox git directory: ``update-docker.sh``
which will update all available Docker images at once for every version.
.. note::
@ -121,10 +116,83 @@ which will update all available Docker images at once.
latest security patches and tool versions are applied.
Update one Docker image
-----------------------
Updating or pulling a single Docker image is accomplished by ``docker pull <image>:<tag>``.
This is not very handy as it is quite troublesome to do it separately per Docker image.
You first need to find out the image name and then also the currently used image tag.
.. code-block:: bash
host> grep 'image:' docker-compose.yml
image: cytopia/bind:0.11
image: devilbox/php-fpm:${PHP_SERVER:-7.0}-work
image: devilbox/${HTTPD_SERVER:-nginx-stable}:0.13
image: cytopia/${MYSQL_SERVER:-mariadb-10.1}:latest
image: postgres:${PGSQL_SERVER:-9.6}
image: redis:${REDIS_SERVER:-3.2}
image: memcached:${MEMCD_SERVER:-latest}
image: mongo:${MONGO_SERVER:-latest}
After having found the possible candidates, you will still have to find the corresponding value
inside the ``..env`` file. Let's do it for the PHP image:
.. code-block:: bash
host> grep '^PHP_SERVER' .env
PHP_SERVER=5.6
So now you can substitute the ``${PHP_SERVER}`` variable from the first command with ``5.6`` and
finally pull a newer version:
.. code-block:: bash
host> docker pull devilbox/php-fpm:5.6-work
Not very efficient.
Update all currently set Docker images
--------------------------------------
This approach is using ``docker-compose pull`` to update all images, but only for the versions
that are actually set in ``.env``.
.. code-block:: bash
host> docker-compose pull
Pulling bind (cytopia/bind:0.11)...
Pulling php (devilbox/php-fpm:5.6-work)...
Pulling httpd (devilbox/apache-2.2:0.13)...
Pulling mysql (cytopia/mysql-5.7:latest)...
Pulling pgsql (postgres:9.6)...
Pulling redis (redis:4.0)...
Pulling memcd (memcached:1.5.2)...
Pulling mongo (mongo:3.0)...
This is most likely the variant you want.
Update all available Docker images for all versions
---------------------------------------------------
In case you also want to pull/update every single of every available Devilbox image, you can
use the provided shell script, which has all versions hardcoded and pulls them for you:
.. code-block:: bash
host> ./update-docker.sh
Checklist git repository
========================
1. Ensure containers are stopped and removed/recreated
1. Ensure containers are stopped and removed/recreated (``docker-compose stop && docker-compose rm``)
2. Ensure desired branch, tag or commit is checked out or latest changes are pulled
3. Ensure ``.env`` file is in sync with ``env-example`` file
@ -132,4 +200,4 @@ Checklist git repository
Checklist Docker images
=======================
1. Ensure ``./update-docker.sh`` is executed
1. Ensure ``docker-compose pull`` or ``./update-docker.sh`` is executed

View File

@ -32,6 +32,7 @@ devilbox documentation
:maxdepth: 2
:caption: Tutorials
tutorials/adding-subdomains
tutorials/configure-database-in-your-project
tutorials/change-document-root
tutorials/change-container-versions

View File

@ -7,65 +7,84 @@ Available tools
Each PHP container version brings the same tools, so you can safely switch versions without having
to worry to have less or more tools available.
+----------------------+---------------------------------------------------------------------+
| Binary | Tool |
+======================+=====================================================================+
| various binaries | `awesome-ci <https://github.com/cytopia/awesome-ci>`_ |
+----------------------+---------------------------------------------------------------------+
| ``brew`` | `Linux brew <http://linuxbrew.sh>`_ |
+----------------------+---------------------------------------------------------------------+
| ``composer`` | `Composer <https://getcomposer.org>`_ |
+----------------------+---------------------------------------------------------------------+
| ``drush`` | `Drush <http://www.drush.org>`_ |
+----------------------+---------------------------------------------------------------------+
| ``drupal`` | `Drupal Console <https://drupalconsole.com>`_ |
+----------------------+---------------------------------------------------------------------+
| ``eslint`` | `ESLint <https://eslint.org>`_ |
+----------------------+---------------------------------------------------------------------+
| ``git`` | `Git <https://git-scm.com>`_ |
+----------------------+---------------------------------------------------------------------+
| ``git-flow`` | `Git flow <https://github.com/nvie/gitflow>`_ |
+----------------------+---------------------------------------------------------------------+
| ``gulp`` | `Gulp <https://gulpjs.com/>`_ |
+----------------------+---------------------------------------------------------------------+
| ``grunt`` | `Grunt <https://gruntjs.com>`_ |
+----------------------+---------------------------------------------------------------------+
| ``jsonlint`` | `JSON lint <https://github.com/zaach/jsonlint>`_ |
+----------------------+---------------------------------------------------------------------+
| ``laravel`` | `Laravel installer <https://github.com/laravel/installer>`_ |
+----------------------+---------------------------------------------------------------------+
| ``mdl`` | `Markdown lint <https://github.com/markdownlint/markdownlint>`_ |
+----------------------+---------------------------------------------------------------------+
| ``mdlint`` | `MD Linter <https://github.com/ChrisWren/mdlint>`_ |
+----------------------+---------------------------------------------------------------------+
| ``mongo*`` | Various MongoDB client tools |
+----------------------+---------------------------------------------------------------------+
| ``mysql*`` | Various MySQL client tools |
+----------------------+---------------------------------------------------------------------+
| ``mysqldump-secure`` | `mysqldump-secure <https://mysqldump-secure.org>`_ |
+----------------------+---------------------------------------------------------------------+
| ``node`` | `Node <https://nodejs.org>`_ |
+----------------------+---------------------------------------------------------------------+
| ``npm`` | `NPM <https://www.npmjs.com>`_ |
+----------------------+---------------------------------------------------------------------+
| ``pg*`` | Various PostgreSQL client tools |
+----------------------+---------------------------------------------------------------------+
| ``phalcon`` | `Phalcon DevTools <https://github.com/phalcon/phalcon-devtools>`_ |
+----------------------+---------------------------------------------------------------------+
| ``scss-lint`` | `SCSS Lint <https://github.com/brigade/scss-lint>`_ |
+----------------------+---------------------------------------------------------------------+
| ``symfony`` | `Symfony installer <https://github.com/symfony/symfony-installer>`_ |
+----------------------+---------------------------------------------------------------------+
| ``tig`` | `Text-mode Interface for Git <https://github.com/jonas/tig>`_ |
+----------------------+---------------------------------------------------------------------+
| ``webpack`` | `Webpack <https://webpack.js.org>`_ |
+----------------------+---------------------------------------------------------------------+
| ``wp`` | `Wordpress CLI <https://wp-cli.org>`_ |
+----------------------+---------------------------------------------------------------------+
| ``yarn`` | `Yarn <https://yarnpkg.com/en>`_ |
+----------------------+---------------------------------------------------------------------+
.. seealso:: :ref:`tutorial_work_inside_the_php_container`
The PHP container is your workhorse and these are your tools:
+----------------------+-----------------------------------------------------------------------------------+
| Binary | Tool |
+======================+===================================================================================+
| various binaries | `awesome-ci <https://github.com/cytopia/awesome-ci>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``brew`` | `Linux brew <http://linuxbrew.sh>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``composer`` | `Composer <https://getcomposer.org>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``drush`` | `Drush <http://www.drush.org>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``drupal`` | `Drupal Console <https://drupalconsole.com>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``eslint`` | `ESLint <https://eslint.org>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``git`` | `Git <https://git-scm.com>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``git-flow`` | `Git flow <https://github.com/nvie/gitflow>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``gulp`` | `Gulp <https://gulpjs.com/>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``grunt`` | `Grunt <https://gruntjs.com>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``jsonlint`` | `JSON lint <https://github.com/zaach/jsonlint>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``laravel`` | `Laravel installer <https://github.com/laravel/installer>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``mdl`` | `Markdown lint <https://github.com/markdownlint/markdownlint>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``mdlint`` | `MD Linter <https://github.com/ChrisWren/mdlint>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``mongo*`` | Various MongoDB client tools |
+----------------------+-----------------------------------------------------------------------------------+
| ``mysql*`` | Various MySQL client tools |
+----------------------+-----------------------------------------------------------------------------------+
| ``mysqldump-secure`` | `mysqldump-secure <https://mysqldump-secure.org>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``node`` | `Node <https://nodejs.org>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``npm`` | `NPM <https://www.npmjs.com>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``pg*`` | Various PostgreSQL client tools |
+----------------------+-----------------------------------------------------------------------------------+
| ``phalcon`` | `Phalcon DevTools <https://github.com/phalcon/phalcon-devtools>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``phpcs`` | `PHP CodeSniffer <https://github.com/squizlabs/PHP_CodeSniffer>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``phpcbf`` | `PHP Code Beautifier and Fixer <https://github.com/squizlabs/PHP_CodeSniffer>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``redis*`` | Various Redis client tools |
+----------------------+-----------------------------------------------------------------------------------+
| ``sass`` | `Sass <http://sass-lang.com>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``scss-lint`` | `SCSS Lint <https://github.com/brigade/scss-lint>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``symfony`` | `Symfony installer <https://github.com/symfony/symfony-installer>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``tig`` | `Text-mode Interface for Git <https://github.com/jonas/tig>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``webpack`` | `Webpack <https://webpack.js.org>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``wp`` | `Wordpress CLI <https://wp-cli.org>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``yamllint`` | `Yamllint <https://github.com/adrienverge/yamllint>`_ |
+----------------------+-----------------------------------------------------------------------------------+
| ``yarn`` | `Yarn <https://yarnpkg.com/en>`_ |
+----------------------+-----------------------------------------------------------------------------------+
.. note::
If you are in need of other tools, open up an issue at
`Github <https://github.com/cytopia/devilbox/issues>`_ and ask for it,
this can usually be implemented very quickly.
.. seealso::
If you ever feel those tools are out-dated, simply update your Docker images.
Docker images are built every night to ensure latest tools and security patches:
:ref:`getting_started_update_the_docker_images`

View File

@ -0,0 +1,350 @@
.. _tutorial_adding_sub_domains:
******************
Adding Sub domains
******************
This tutorial gives you a brief overview how to serve your project under one subdomain via
the project directory name as well as how to serve one projcet with multiple subdomains with
a customized virtual host config via ``vhost-gen``.
**Table of Contents**
.. contents:: :local:
Single sub domain for one project
=================================
When you just want to serve your project under a sub domain, you simply name your project directory
by the name of it. See the following examples how you build up your project URL.
+----------------+----------------+-------------------------------+
| Project dir | ``TLD_SUFFIX`` | Project URL |
+================+================+===============================+
| my-test | ``loc`` | ``http://my-test.loc`` |
+----------------+----------------+-------------------------------+
| www.my-test | ``loc`` | ``http://www.my-test.loc`` |
+----------------+----------------+-------------------------------+
| t1.www.my-test | ``loc`` | ``http://t1.www.my-test.loc`` |
+----------------+----------------+-------------------------------+
| my-test | ``com`` | ``http://my-test.com`` |
+----------------+----------------+-------------------------------+
| www.my-test | ``com`` | ``http://www.my-test.com`` |
+----------------+----------------+-------------------------------+
| t2.www.my-test | ``com`` | ``http://t2.www.my-test.com`` |
+----------------+----------------+-------------------------------+
Whatever name you want to have in front of the ``TLD_SUFFIX`` is actually just the directory you
create. Generically, it looks like this:
+----------------+----------------+-------------------------------+
| Project dir | ``TLD_SUFFIX`` | Project URL |
+================+================+===============================+
| <dir-name> | ``<tld>`` | ``http://<dir-name>.<tld>`` |
+----------------+----------------+-------------------------------+
Multiple sub domains for one project
====================================
When you want to have multiple domains and/or sub domains for one project (such as in the
case of Wordpress multi-sites), you will need to customize your virtual host config for this
project and make the web server allow to serve your files by different server names.
Each web server virtual host is auto-generated by a tool called
`vhost-gen <https://github.com/devilbox/vhost-gen>`_. ``vhost-gen`` allows you to overwrite its
default generation process via templates. Those templates can be added to each project, giving
you the option to customize the virtual host of this specific project.
.. note::
:ref:`custom_vhost`
Ensure you have read and understand how to customize your virtual host with ``vhost-gen``.
:ref:`env_httpd_template_dir`
Ensure you know what this variable does inside your ``.env`` file.
.. important::
When adjusting vhost-gen templates for a project you have to do **one** of the following:
* Restart the devilbox
* Or rename your project directory to some other name and then rename it back to its original
name.
More information here: :ref:`custom_vhost_apply_vhost_gen_changes`
.. warning::
Pay close attention that you do not use TAB (``\t``) characters for indenting the vhost-gen
yaml files. Some editors might automatically indent using TABs, so ensure they are replaced
with spaces. If TAB characters are present, those files become invalid and won't work.
https://github.com/cytopia/devilbox/issues/142
You can use the bundled ``yamllint`` binary inside the container to validate your config.
**See also:**
* :ref:`tutorial_work_inside_the_php_container`
* :ref:`available_tools`
Prerequisite
------------
Let's assume the following settings.
+-------------------------------+--------------------------------------+
| Variable | Value |
+===============================+======================================+
| Devilbox path | ``/home/user/devilbox`` |
+-------------------------------+--------------------------------------+
| :ref:`env_httpd_template_dir` | ``.devilbox`` |
+-------------------------------+--------------------------------------+
| :ref:`env_httpd_datadir` | ``./data/www`` |
+-------------------------------+--------------------------------------+
| :ref:`env_tld_suffix` | ``loc`` |
+-------------------------------+--------------------------------------+
| Project name/directory | ``project-1`` (Ensure it exist) |
+-------------------------------+--------------------------------------+
Ensure that the default ``vhost-gen`` templates have been copied to your projects template directory:
.. code-block:: bash
# Navigate to the Devilbox directory
host> /home/user/devilbox
# Create template directory in your project
host> mkdir ./data/www/project-1/.devilbox
# Copy vhost-gen templates
host> cp templates/vhost-gen/* ./data/www/project-1/.devilbox
By having done all prerequisite, your project should be available under http://my-project-1.loc
Now you are all set and we can dive into the actual configuration.
Apache 2.2
----------
Adding ``www`` sub domain
^^^^^^^^^^^^^^^^^^^^^^^^^
Let's also make this project available under http://www.my-project-1.loc
Step 1: Add DNS entry
"""""""""""""""""""""
The first step would be to add an additional DNS entry for ``www.my-project-1.loc``.
See here how to do that for Linux, MacOS or Windows:
:ref:`getting_started_create_your_first_project_dns_entry`
DNS is in place, however when you visit http://www.my-project-1.loc, you will end up seeing the
Devilbox intranet, because this is the default host when no match has been found.
Step 2: Adjust apache22.yml
"""""""""""""""""""""""""""
Next you will have to adjust the Apache 2.2 vhost configuration template. The current default
template looks similar to the one shown below (**Note:** Only the ``vhost:`` sub section is shown
here).
.. code-block:: yml
:caption: /home/user/devilbox/data/www/project-1/.devilbox/apache22.yml
:name: apache22.yml
:emphasize-lines: 3
vhost: |
<VirtualHost __DEFAULT_VHOST__:__PORT__>
ServerName __VHOST_NAME__
CustomLog "__ACCESS_LOG__" combined
ErrorLog "__ERROR_LOG__"
__VHOST_DOCROOT__
__VHOST_RPROXY__
__PHP_FPM__
__ALIASES__
__DENIES__
__SERVER_STATUS__
# Custom directives
__CUSTOM__
</VirtualHost>
All you will have to do, is to add another ``ServerName`` directive:
.. code-block:: yml
:caption: /home/user/devilbox/data/www/project-1/.devilbox/apache22.yml
:name: apache22.yml
:emphasize-lines: 3,4
vhost: |
<VirtualHost __DEFAULT_VHOST__:__PORT__>
ServerName __VHOST_NAME__
ServerName www.__VHOST_NAME__
CustomLog "__ACCESS_LOG__" combined
ErrorLog "__ERROR_LOG__"
__VHOST_DOCROOT__
__VHOST_RPROXY__
__PHP_FPM__
__ALIASES__
__DENIES__
__SERVER_STATUS__
# Custom directives
__CUSTOM__
</VirtualHost>
Step 3: Apply new changes
"""""""""""""""""""""""""
The **last step** is to actually to apply those changes. This is equal for all web servers.
Go to :ref:`tutorial_adding_sub_domains_apply_changes` and follow the steps.
Afterwards you can go and visit http://www.my-project-1.loc and you should see the same page as if you
visit http://my-project-1.loc
Adding catch-all sub domain
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Let's also make this project available under any sub domain.
Step 1: Add DNS entry
"""""""""""""""""""""
The first step would be to add DNS entries for all sub domains you require.
See here how to do that for Linux, MacOS or Windows:
:ref:`getting_started_create_your_first_project_dns_entry`
This however is not really convenient. If you have basically infinite sub domains (via catch-all),
you should consider using Auto-DNS instead: :ref:`tutorial_enable_auto_dns`.
Step 2: Adjust apache22.yml
"""""""""""""""""""""""""""
Next you will have to adjust the Apache 2.2 vhost configuration template. The current default
template looks similar to the one shown below (**Note:** Only the ``vhost:`` sub section is shown
here).
.. code-block:: yml
:caption: /home/user/devilbox/data/www/project-1/.devilbox/apache22.yml
:name: apache22.yml
:emphasize-lines: 3
vhost: |
<VirtualHost __DEFAULT_VHOST__:__PORT__>
ServerName __VHOST_NAME__
CustomLog "__ACCESS_LOG__" combined
ErrorLog "__ERROR_LOG__"
__VHOST_DOCROOT__
__VHOST_RPROXY__
__PHP_FPM__
__ALIASES__
__DENIES__
__SERVER_STATUS__
# Custom directives
__CUSTOM__
</VirtualHost>
All you will have to do, is to add another ``ServerName`` directive which does catch-all:
.. code-block:: yml
:caption: /home/user/devilbox/data/www/project-1/.devilbox/apache22.yml
:name: apache22.yml
:emphasize-lines: 3,4
vhost: |
<VirtualHost __DEFAULT_VHOST__:__PORT__>
ServerName __VHOST_NAME__
ServerName *.__VHOST_NAME__
CustomLog "__ACCESS_LOG__" combined
ErrorLog "__ERROR_LOG__"
__VHOST_DOCROOT__
__VHOST_RPROXY__
__PHP_FPM__
__ALIASES__
__DENIES__
__SERVER_STATUS__
# Custom directives
__CUSTOM__
</VirtualHost>
Step 3: Apply new changes
"""""""""""""""""""""""""
The **last step** is to actually to apply those changes. This is equal for all web servers.
Go to :ref:`tutorial_adding_sub_domains_apply_changes` and follow the steps.
Apache 2.4
----------
Nginx
-----
.. _tutorial_adding_sub_domains_apply_changes:
Apply changes
-------------
After having edited your vhost-gen template files, you still need to apply these changes.
This can be achieved in two ways:
1. Restart the Devilbox
2. Rename your project directory back and forth
Let's cover the second step
.. code-block:: bash
# Navigate to the data directory
host> /home/user/devilbox/data/www
# Rename your project to something else
host> mv project-1 project-1.tmp
# Rename your project to its original name
host> mv project-1.tmp project-1
If you want to understand what is going on right now, check the docker logs for the web server.
.. code-block:: bash
# Navigate to the devilbox directory
host> /home/user/devilbox
# Check docker logs
host> docker-compose logs httpd
httpd_1 | vhostgen: [2018-03-18 11:46:52] Adding: project-1.tmp.loc
httpd_1 | watcherd: [2018-03-18 11:46:52] [OK] ADD: succeeded: /shared/httpd/project-1.tmp
httpd_1 | watcherd: [2018-03-18 11:46:52] [OK] DEL: succeeded: /shared/httpd/project-1
httpd_1 | watcherd: [2018-03-18 11:46:52] [OK] TRIGGER succeeded: /usr/local/apache2/bin/httpd -k restart
httpd_1 | vhostgen: [2018-03-18 11:46:52] Adding: project-1loc
httpd_1 | watcherd: [2018-03-18 11:46:52] [OK] ADD: succeeded: /shared/httpd/project-1
httpd_1 | watcherd: [2018-03-18 11:46:52] [OK] DEL: succeeded: /shared/httpd/project-1.tmp
httpd_1 | watcherd: [2018-03-18 11:46:52] [OK] TRIGGER succeeded: /usr/local/apache2/bin/httpd -k restart
**What happened?**
The directory changes have been noticed and a new virtual host has been created. This time however
your new vhost-gen template has been read and the changes have applied.
Checklist
---------
1. Template files are copied from ``templates/vhost-gen/*`` to your project template dir (as
specified in ``.env`` via ``HTTPD_TEMPLATE_DIR``)
2. Ensure the vhost-gen yaml files are valid (No tab characters)
3. When templates are edited, the Devilbox is either restarted or the project directory is renamed
to something else and then renamed back to its original name

View File

@ -0,0 +1,7 @@
.. _tutorial_enable_auto_dns:
***************
Enable Auto-DNS
***************
asdasd

View File

@ -0,0 +1,8 @@
.. _tutorial_work_inside_the_php_container:
*************************
Work inside the container
*************************
asdasda