Verified Commit 5bf9d705 authored by Andri Steiner's avatar Andri Steiner
Browse files

opensource/puppet-modules#739 update content

parent ed69904f
......@@ -42,6 +42,6 @@ The website level `Custom JSON` is located on the particular websites `Advanced`
for example to
* change the default HSTS header sent (see :ref:`website_hsts`)
* set custom environment variables (see :ref:`website_envvar`)
* set custom environment variables (see :ref:`website-envvar`)
* let the website listen on a specific port or interface (see :ref:`website_listen`)
......@@ -8,4 +8,5 @@ Here, we document possible website configuration options which you won't need on
:maxdepth: 1
previewuser
whitelabel
.. index::
pair: Website; Advanced; White Label
:name: website-advanced-whitelabel
===========
White Label
===========
You can run your servers within your own name but still fully
managed through us. We can provide custom:
* DNS server names
* server domain names
* HTTP error pages
* default server pages
* IP subnets registered to your name
This settings are not available by default. Please contact us for details.
.. index::
pair: Website; Context
:name: website_context
:name: website-context
=======
Context
=======
You have to select one of those contexts for each website:
PROD
^^^^
====
- for live sites
- no access protection
- phpinfo disabled (visible database credentials from environment variables)
- E-Mails get sent to their designated recipient (PHP mail() only, see :ref:`howto-email` for details)
The `PROD` context is meant for live websites. Its default presets are:
.. hint:: You can enable phpinfo by setting ``disable_functions=`` to a empty string in ``~/cnf/php.ini`` (don’t forget ``php-reload``). Important: phpinfo exposed many infos like environment variables such as database credentials. We recommend not to use phpinfo on a publicly accessible website. Please be careful and deactivate phpinfo afterwards.
* access protection disabled
* phpinfo disabled (visible database credentials from environment variables)
* E-Mails are sent to their designated recipient (PHP ``mail()`` only, see :ref:`howto-email` for details)
* ``WEBSITE_CONTEXT`` environment variable set to ``PROD`` (see :ref:`website-envvar`)
STAGE
^^^^^
=====
The `STAGE` context is meant for test websites. Its default presets are:
- for stage / preview / testing access
- password protected (see :ref:`website-advanced-previewuser`)
- phpinfo enabled
- E-Mails get saved as file into the ~/tmp/ directory (PHP mail() only, :ref:`howto-email` for details)
* access protection enabled (see :ref:`website-advanced-previewuser`)
* phpinfo enabled
* E-Mails are saved as file into the ``~/tmp/`` directory (PHP ``mail()`` only, :ref:`howto-email` for details)
* ``WEBSITE_CONTEXT`` environment variable set to ``STAGE`` (see :ref:`website-envvar`)
DEV
^^^
===
The `DEV` context is meant for developing websites. Its default presets are:
- for development
- password protected (see :ref:`website-advanced-previewuser`)
- phpinfo enabled
- Xdebug enabled, see :ref:`howto-phpdebugging` for details)
- E-Mails get saved as file into the ~/tmp/ directory (PHP mail() only, :ref:`howto-email` for details)
* access protection enabled (see :ref:`website-advanced-previewuser`)
* phpinfo enabled
* Xdebug enabled (see :ref:`howto-phpdebugging` for details)
* E-Mails are saved as file into the ``~/tmp/`` directory (PHP ``mail()`` only, :ref:`howto-email` for details)
* ``WEBSITE_CONTEXT`` environment variable set to ``DEV`` (see :ref:`website-envvar`)
.. index::
triple: Website; Environment; Variables
:name: website-envvar
=====================
Environment Variables
=====================
For each website, the following environment variables are created by
default, and are available within the shell and also the webserver:
* ``WEBSITE_CONTEXT`` (PROD, STAGE or DEV, see :ref:`website-context`)
* ``WEBSITE_SERVER_NAME`` (Configured server names within this website)
* ``DB_HOST`` (Database hostname, only if there is a database)
* ``DB_NAME`` (Database name, only if there is a database)
* ``DB_USERNAME`` (Database username, only if there is a database)
* ``DB_PASSWORD`` (Database password, only if there is a database)
* ``PROXY_PASS`` (Proxy Pass, only for type proxy)
Custom Environment Variables
============================
You can set or override environment variables per website, use the ``envvar`` option in custom JSON:
.. code-block:: json
{
"envvar": {
"MYENVVAR": "this is the value",
"DB_HOST": "override global DB_HOST variable here",
"http_proxy": "override global http_proxy variable here"
}
}
Example Usage in PHP
====================
.. code-block:: php
$config = array(
'db_host' => $_SERVER['DB_HOST'],
'db_name' => $_SERVER['DB_NAME'],
'db_username' => $_SERVER['DB_USERNAME'],
'db_password' => $_SERVER['DB_PASSWORD'],
)
......@@ -9,11 +9,11 @@ Website
To create a new website, there are only a few settings required:
* `name` will define the name used for system wide settings like users
or databases (see :ref:`website_name`)
or databases (see :ref:`website-name`)
* `type` will define the preloaded settings for a certain application
type (see :ref:`website_type`)
type (see :ref:`website-type`)
* `context` will define the context used within your application and
is also used to set some default settings (see :ref:`website_context`)
is also used to set some default settings (see :ref:`website-context`)
* (optional) a `server name` when your website must listen to other
hostnames than the default one (see :ref:`website_servername`)
......@@ -25,113 +25,9 @@ You can find this and all other, non-mandatory settings within this chapter:
name
type
context
envvar
advanced/index
User Handling
^^^^^^^^^^^^^
The preview user gets applied to all non PROD environments and is
intended for your own use, but also to allow access to other parties
like your customer. Use the "Preview password" option to set a particular
password to the preview user. You have to use a htpasswd encrypted value
which you can generate like this on your local workstation:
::
htpasswd -n preview
Furthermore, you can add additional users trough the "website::users"
configuration like this:
.. code-block:: json
{
"website::users": {
"alice": {
"preview": "$apr1$RXDs3l18$w0VJrVN5uoU6DMY.0xgTr/"
},
"bob": {
"preview": "$apr1$RSDdas2323$23case23DCDMY.0xgTr/"
}
}
}
You can add such uers for yourself and your co-workers. If you work on
multiple websites, you do not have to look up the corresponding password
all the time but just use the global one.
To rename the default "preview" username, use the ``preview_username`` parameter on a website:
.. code-block:: json
{
"preview_username": "showme",
}
Furthermore, its possible to set the preview username globally through ``website::preview_username``.
.. note:: Please keep in mind that this password gets often transfered over unencrypted connections. As always, we recommend to use a particular password for only this purpose
Default Environment Variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For each website, the following environment variables are created by
default, and are available within the shell and also the webserver.
- SITE\_ENV (DEV, STAGE or PROD)
- DB\_HOST (Database hostname, only if there is a database)
- DB\_NAME (Database name, only if there is a database)
- DB\_USERNAME (Database username, only if there is a database)
- DB\_PASSWORD (Database password, only if there is a database)
- PROXY\_PASS (Proxy Pass, only for type proxy)
.. hint:: to use the .profile environmet within a cronjob, prepend the following code to your command: ``/bin/bash -c 'source $HOME/.profile; ~/original/command'``
Example usage in PHP
~~~~~~~~~~~~~~~~~~~~
As soon there is a database installed, the following variables are added
to the environment and can be used from within your application. TYPO3
Example:
::
$typo_db_username = $_SERVER['DB_USERNAME'];
$typo_db_password = $_SERVER['DB_PASSWORD'];
$typo_db_host = $_SERVER['DB_HOST'];
$typo_db = $_SERVER['DB_NAME'];
Additionaly, you can use the "SITE\_ENV" variable to set parameters
according the current environment:
::
switch ($_SERVER['SITE_ENV']) {
case 'DEV':
$recipient = 'dev@example.net';
break;
case 'STAGE':
$recipient = 'dev@example.net';
break;
case 'PROD':
$recipient = 'customer@example.com';
break;
}
If you configure your application like this, you can copy all data
between different servers or vhosts (DEV/STAGE/PROD) and all settings
are applied as desired.
Example usage in typoscript
~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
[globalString = _SERVER|SITE_ENV = DEV]
# doSometing
[global]
TLS Certificates
----------------
......@@ -688,36 +584,3 @@ deactivate monitoring by setting ``"monitoring": "false"`` in custom JSON:
"monitoring": false
}
.. index::
triple: Website; Environment; Variables
:name: website_envvar
Environment Variables
---------------------
To set or override environment variables per website, use the ``envvar`` option in custom JSON:
.. code-block:: json
{
"envvar": {
"MYENVVAR": "this is the value",
"DB_HOST": "override global DB_HOST variable here",
"http_proxy": "override global http_proxy variable here"
}
}
White label
-----------
Default Virtual Host
^^^^^^^^^^^^^^^^^^^^
The default vhost is stored in ``/var/www/``. You can use your own content stored in a git repository with the following configuration.
.. code-block:: json
{
"website::default::webroot::gitsource": "git@git.example.com:acme/project",
"website::default::webroot::gitkey": "-----BEGIN RSA PRIVATE KEY-----[..]-----END RSA PRIVATE KEY-----",
}
.. index::
pair: Website; Name
:name: website_name
:name: website-name
Name
====
......
.. index::
pair: Website; Type
:name: website_type
:name: website-type
Type
====
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment