mirror of
https://github.com/cytopia/devilbox.git
synced 2025-06-24 18:25:17 +00:00
Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
8c931cdf56 | |||
487b69331c | |||
6984d43ff9 | |||
a097b5b4d8 | |||
0b118486b5 | |||
c73d5a711f | |||
78244371ca | |||
a1fa4806e1 | |||
02e3f8cf6e | |||
f7741d88f9 | |||
bc16d8906e | |||
fa6a91350c | |||
d4e3b885da | |||
68f34be368 | |||
5679774a30 | |||
056bbfb057 | |||
fb77920460 | |||
a377209a72 | |||
c1fbb9c2c4 | |||
ca6f7f56ac | |||
163642aac7 | |||
37c82a334c | |||
844ca283bf | |||
63de90415c | |||
c67c66c8ef | |||
80b6582d91 | |||
d68adcbb01 | |||
112e24207b | |||
17232a5eb4 | |||
7d6c7a4aff | |||
a98c6146a4 | |||
175e4d8d02 | |||
c56243bb9d | |||
e294e6f6cd | |||
4691117100 | |||
d104e4e9a5 | |||
8aabde1b5a | |||
44bbf048ce | |||
84183c9688 | |||
c05a74fd5f | |||
0c5750b8bf | |||
886689ca64 |
@ -13,8 +13,8 @@ error_reporting(-1);
|
||||
putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');
|
||||
|
||||
|
||||
$DEVILBOX_VERSION = 'v1.6.2';
|
||||
$DEVILBOX_DATE = '2020-02-06';
|
||||
$DEVILBOX_VERSION = 'v1.7.0';
|
||||
$DEVILBOX_DATE = '2020-03-24';
|
||||
$DEVILBOX_API_PAGE = 'devilbox-api/status.json';
|
||||
|
||||
//
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -202,3 +202,6 @@ $RECYCLE.BIN/
|
||||
###### BBEdit ######
|
||||
*.bbprojectd
|
||||
*.bbproject
|
||||
|
||||
###### VS Code ######
|
||||
/.vscode
|
@ -57,6 +57,13 @@ start: ../.env
|
||||
@$(PWD)/scripts/compose-start.sh
|
||||
|
||||
|
||||
###
|
||||
### Stop Devilbox
|
||||
###
|
||||
stop:
|
||||
@$(PWD)/scripts/compose-stop.sh
|
||||
|
||||
|
||||
###
|
||||
### Show Docker logs
|
||||
###
|
||||
|
22
CHANGELOG.md
22
CHANGELOG.md
@ -7,14 +7,32 @@ major versions.
|
||||
## Unreleased
|
||||
|
||||
|
||||
## Bugfix Release v1.6.2 (2019-02-06)
|
||||
## Release v1.7.0 (2020-03-24)
|
||||
|
||||
#### Added
|
||||
- Python Flask
|
||||
|
||||
|
||||
## Bugfix Release v1.6.3 (2020-03-23)
|
||||
|
||||
#### Fixed
|
||||
- Fixed PHP FPM images
|
||||
- Fixed cert-gen for HAProxy
|
||||
- Various spelling errors in documentation
|
||||
- PostgreSQL startup without a password
|
||||
#### Added
|
||||
- [#686](https://github.com/cytopia/devilbox/pull/686) Added documentation for ExpressEngine
|
||||
- New .env var: `PGSQL_HOST_AUTH_METHOD`
|
||||
|
||||
|
||||
## Bugfix Release v1.6.2 (2020-02-06)
|
||||
|
||||
#### Added
|
||||
- [#670](https://github.com/cytopia/devilbox/issues/670) Add `phalcon` binary to PHP 7.3 and 7.4
|
||||
- [#664](https://github.com/cytopia/devilbox/issues/664) Add PHP `yaml` extension
|
||||
|
||||
|
||||
## Bugfix Release v1.6.1 (2019-01-05)
|
||||
## Bugfix Release v1.6.1 (2020-01-05)
|
||||
|
||||
#### Fixed
|
||||
- [#662](https://github.com/cytopia/devilbox/issues/662) Update to latest Symfony CLI
|
||||
|
@ -4,7 +4,7 @@
|
||||
**Abstract**
|
||||
|
||||
The Devilbox is currently being developed in my spare time and mostly reflects the features that I
|
||||
am using for all the web projcets I have to handle. In order to better present it to the majority
|
||||
am using for all the web projects I have to handle. In order to better present it to the majority
|
||||
of other software developers I do require support to cope with all the feature requests.
|
||||
|
||||
|
||||
|
34
README.md
34
README.md
@ -91,12 +91,12 @@ Only the webserver and PHP container are mandatory, all others are optional and
|
||||
|
||||
Each of them is also available in multiple different versions in order to reflect your exact desired environment.
|
||||
|
||||
| Accel | Frontend | SQL | NoSQL | Queue | Search | ELK | Utils |
|
||||
|---------|------------|------------|-----------|----------|--------|---------------|-----------|
|
||||
| HAProxy | Apache | MariaDB | Memcached | RabbitMQ | Solr | ElasticSearch | Bind |
|
||||
| Varnish | Nginx | MySQL | MongoDB | | | Logstash | Blackfire |
|
||||
| | PHP | PerconaDB | Redis | | | Kibana | MailHog |
|
||||
| | | PostgreSQL | | | | | Ngrok |
|
||||
| Accel | Web | App | SQL | NoSQL | Queue / Search | ELK | Utils |
|
||||
|---------|------------|----------------|------------|-----------|----------------|---------------|-----------|
|
||||
| HAProxy | Apache | PHP | MariaDB | Memcached | RabbitMQ | ElasticSearch | Bind |
|
||||
| Varnish | Nginx | Python (Flask) | MySQL | MongoDB | Solr | Logstash | Blackfire |
|
||||
| | | | PerconaDB | Redis | | Kibana | MailHog |
|
||||
| | | | PostgreSQL | | | | Ngrok |
|
||||
|
||||
> **Documentation:**
|
||||
> [Available Container](https://devilbox.readthedocs.io/en/latest/readings/available-container.html)
|
||||
@ -374,6 +374,7 @@ Additionally to the default stack, there are a variety of other services that ca
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Python (Flask)</th>
|
||||
<th>Blackfire</th>
|
||||
<th>ELK</th>
|
||||
<th>MailHog</th>
|
||||
@ -386,6 +387,7 @@ Additionally to the default stack, there are a variety of other services that ca
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a target="_blank" title="Python 2.7 " href="https://github.com/devilbox/docker-python-flask">2.7</a></td>
|
||||
<td><a target="_blank" title="Blackfire 1.8" href="https://github.com/blackfireio/docker">1.8</a></td>
|
||||
<td><a target="_blank" title="ELK stack" href="https://www.docker.elastic.co">5.x.y</a></td>
|
||||
<td><a target="_blank" title="MailHog v1.0.0" href="https://github.com/mailhog/MailHog">v1.0.0</a></td>
|
||||
@ -396,6 +398,7 @@ Additionally to the default stack, there are a variety of other services that ca
|
||||
<td><a target="_blank" title="Varnish 4" href="https://github.com/devilbox/docker-varnish">4</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>...</td>
|
||||
<td>...</td>
|
||||
<td><a target="_blank" title="ELK stack" href="https://www.docker.elastic.co">6.x.y</a></td>
|
||||
<td><a target="_blank" title="MailHog latest" href="https://github.com/mailhog/MailHog">latest</a></td>
|
||||
@ -406,6 +409,7 @@ Additionally to the default stack, there are a variety of other services that ca
|
||||
<td><a target="_blank" title="Varnish 5" href="https://github.com/devilbox/docker-varnish">5</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a target="_blank" title="Python 3.7 " href="https://github.com/devilbox/docker-python-flask">3.7</a></td>
|
||||
<td><a target="_blank" title="Blackfire 1.18.0" href="https://github.com/blackfireio/docker">1.18.0</a></td>
|
||||
<td><a target="_blank" title="ELK stack" href="https://www.docker.elastic.co">7.x.y</a></td>
|
||||
<td></td>
|
||||
@ -416,6 +420,7 @@ Additionally to the default stack, there are a variety of other services that ca
|
||||
<td><a target="_blank" title="Varnish 6" href="https://github.com/devilbox/docker-varnish">6</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a target="_blank" title="Python 3.8 " href="https://github.com/devilbox/docker-python-flask">3.8</a></td>
|
||||
<td><a target="_blank" title="Blackfire latest" href="https://github.com/blackfireio/docker">latest</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
@ -650,8 +655,8 @@ The following tools will assist you on creating new projects easily as well as h
|
||||
<td><code>pm2</code> is Node.js Production Process Manager with a built-in Load Balancer.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>:wrench: <a href="https://github.com/brigade/scss-lint/">scss-lint</a></td>
|
||||
<td><code>scss-lint</code> is a css/scss linter.</td>
|
||||
<td>:wrench: <a href="https://github.com/stylelint/stylelint">stylelint</a></td>
|
||||
<td><code>stylelint</code> is a css/scss linter.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>:wrench: <a href="https://github.com/symfony/symfony-installer">symfony installer</a></td>
|
||||
@ -794,7 +799,7 @@ The Devilbox is a development stack, so it is made sure that a lot of PHP module
|
||||
| sysvshm | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 |
|
||||
| tidy | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 |
|
||||
| tokenizer | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
| uploadprogress | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 |
|
||||
| uploadprogress | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | |
|
||||
| wddx | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | | |
|
||||
| xdebug | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | 🗸 | |
|
||||
| xml | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
|
||||
@ -821,7 +826,7 @@ PHP modules can be enabled or disabled on demand to reflect the state of your ta
|
||||
|
||||
You can also copy any custom modules into `mod/(php-fpm)-<VERSION>` and add a custom `*.ini` file to load them.
|
||||
|
||||
#### Supported Frameworks
|
||||
#### Supported PHP Frameworks
|
||||
|
||||
As far as tested there are no limitations and you can use any Framework or CMS just as you would on your live environment. Below are a few examples of extensively tested Frameworks and CMS:
|
||||
|
||||
@ -867,12 +872,13 @@ As far as tested there are no limitations and you can use any Framework or CMS j
|
||||
#### Supported reverse proxied applications
|
||||
|
||||
As far as tested there are no limitations and you can use any application that creates an open port.
|
||||
These ports will be reverse proxied by the web server and even allow you to use valid HTTPS for them.
|
||||
By the built-in autostart feature of the Devilbox you can ensure that your application automatically
|
||||
These ports will be reverse proxied by the web server and even allow you to use **valid HTTPS** for them.
|
||||
By the built-in **autostart feature** of the Devilbox you can ensure that your application automatically
|
||||
starts up as soon as you run `docker-compose up`.
|
||||
|
||||
<a target="_blank" title="NodeJS" href="https://nodejs.org"><img width="64" style="width:64px;" src="docs/img/logo_tools/nodejs.png" alt="Devilbox"/></a>
|
||||
<a target="_blank" title="Sphinx" href="https://www.sphinx-doc.org/en/stable/"><img width="64" style="width:64px;" src="docs/img/logo_tools/sphinx.png" alt="Devilbox"/></a>
|
||||
<a target="_blank" title="NodeJS" href="https://nodejs.org"><img width="64" style="width:64px;" src="docs/img/logo_tools/nodejs.png" alt="NodeJS"/></a>
|
||||
<a target="_blank" title="Python Flask" href="https://github.com/pallets/flask"><img width="64" style="width:64px;" src="docs/img/logo_tools/flask.png" alt="Python Flask"/></a>
|
||||
<a target="_blank" title="Sphinx" href="https://www.sphinx-doc.org/en/stable/"><img width="64" style="width:64px;" src="docs/img/logo_tools/sphinx.png" alt="Sphinx"/></a>
|
||||
|
||||
> **Documentation:**<br/>
|
||||
> [Setup reverse proxy NodeJs](https://devilbox.readthedocs.io/en/latest/examples/setup-reverse-proxy-nodejs.html) |
|
||||
|
10
UPDATING.md
10
UPDATING.md
@ -3,6 +3,16 @@
|
||||
This document will hold all information on how to update between major versions.
|
||||
|
||||
|
||||
## Update from `v1.6.2` to `v1.6.3`
|
||||
|
||||
**PR:** https://github.com/cytopia/devilbox/pull/689
|
||||
|
||||
The following affects you if you have a PostgreSQL root password set:
|
||||
|
||||
Ensure to diff `env-example` against `.env` as a new environment variable (`PGSQL_HOST_AUTH_METHOD`)
|
||||
has been introduced. A default value has been set in `docker-compose.yml` to make migration seamless.
|
||||
|
||||
|
||||
## Update from `v1.1.0` to `v1.2.0`
|
||||
|
||||
**PR:** https://github.com/cytopia/devilbox/pull/647
|
||||
|
@ -132,7 +132,7 @@ services:
|
||||
- httpd
|
||||
|
||||
haproxy:
|
||||
image: devilbox/haproxy:0.2
|
||||
image: devilbox/haproxy:0.3
|
||||
hostname: haproxy
|
||||
ports:
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_HAPROXY:-8080}:80"
|
||||
@ -208,6 +208,34 @@ services:
|
||||
depends_on:
|
||||
- elastic
|
||||
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
# Python Flask
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
|
||||
# You can add more than one service here if you have multiple flask projects.
|
||||
# Just duplicate the block and adjust service name, hostname and ip address.
|
||||
flask1:
|
||||
image: devilbox/python-flask:${PYTHON_VERSION:-3.8}-dev
|
||||
hostname: flask1
|
||||
ports:
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_FLASK:-3000}:${FLASK_PORT:-3000}"
|
||||
networks:
|
||||
app_net:
|
||||
ipv4_address: 172.16.238.250
|
||||
volumes:
|
||||
# Mount custom mass virtual hosting
|
||||
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd:rw${MOUNT_OPTIONS}
|
||||
environment:
|
||||
- FLASK_PROJECT=${FLASK_PROJECT}
|
||||
- FLASK_PORT=${FLASK_PORT:-3000}
|
||||
- FLASK_APP_DIR=${FLASK_APP_DIR:-htdocs}
|
||||
- FLASK_APP_FILE=${FLASK_APP_FILE:-main.py}
|
||||
- NEW_UID
|
||||
- NEW_GID
|
||||
depends_on:
|
||||
- bind
|
||||
- httpd
|
||||
|
||||
|
||||
###
|
||||
### Volumes
|
||||
|
33
compose/docker-compose.override.yml-python-flask.yml
Normal file
33
compose/docker-compose.override.yml-python-flask.yml
Normal file
@ -0,0 +1,33 @@
|
||||
# vim: set ft=yaml:
|
||||
---
|
||||
version: '2.3'
|
||||
|
||||
services:
|
||||
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
# Python Flask
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
|
||||
# You can add more than one service here if you have multiple flask projects.
|
||||
# Just duplicate the block and adjust service name, hostname and ip address.
|
||||
flask1:
|
||||
image: devilbox/python-flask:${PYTHON_VERSION:-3.8}-dev
|
||||
hostname: flask1
|
||||
ports:
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_FLASK:-3000}:${FLASK_PORT:-3000}"
|
||||
networks:
|
||||
app_net:
|
||||
ipv4_address: 172.16.238.250
|
||||
volumes:
|
||||
# Mount custom mass virtual hosting
|
||||
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd:rw${MOUNT_OPTIONS}
|
||||
environment:
|
||||
- FLASK_PROJECT=${FLASK_PROJECT}
|
||||
- FLASK_PORT=${FLASK_PORT:-3000}
|
||||
- FLASK_APP_DIR=${FLASK_APP_DIR:-htdocs}
|
||||
- FLASK_APP_FILE=${FLASK_APP_FILE:-main.py}
|
||||
- NEW_UID
|
||||
- NEW_GID
|
||||
depends_on:
|
||||
- bind
|
||||
- httpd
|
@ -29,7 +29,7 @@ services:
|
||||
- httpd
|
||||
|
||||
haproxy:
|
||||
image: devilbox/haproxy:0.2
|
||||
image: devilbox/haproxy:0.3
|
||||
hostname: haproxy
|
||||
ports:
|
||||
- "${LOCAL_LISTEN_ADDR}${HOST_PORT_HAPROXY:-8080}:80"
|
||||
|
@ -95,7 +95,7 @@ services:
|
||||
# PHP
|
||||
# ------------------------------------------------------------
|
||||
php:
|
||||
image: devilbox/php-fpm:${PHP_SERVER}-work-0.105
|
||||
image: devilbox/php-fpm:${PHP_SERVER}-work-0.106
|
||||
hostname: php
|
||||
|
||||
##
|
||||
@ -355,6 +355,7 @@ services:
|
||||
|
||||
- POSTGRES_USER=${PGSQL_ROOT_USER}
|
||||
- POSTGRES_PASSWORD=${PGSQL_ROOT_PASSWORD}
|
||||
- POSTGRES_HOST_AUTH_METHOD=${PGSQL_HOST_AUTH_METHOD:-trust}
|
||||
- PGDATA=/var/lib/postgresql/data/pgdata
|
||||
|
||||
ports:
|
||||
|
@ -24,13 +24,11 @@ help:
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
|
||||
linkcheck2:
|
||||
ifeq ($(wildcard file1),)
|
||||
bash -c 'curl -Ss -o linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck 2>/dev/null'
|
||||
else
|
||||
bash -c 'curl -Ss -o linkcheck -z linkcheck https://raw.githubusercontent.com/cytopia/linkcheck/master/linkcheck 2>/dev/null'
|
||||
endif
|
||||
chmod +x linkcheck
|
||||
./linkcheck -l -k -r 60 -t 30 -e rst _includes/
|
||||
docker run \
|
||||
--rm \
|
||||
$$(tty -s && echo "-it" || echo) \
|
||||
-v $(PWD):/data \
|
||||
cytopia/linkcheck -l -k -r 60 -t 30 -e rst -c '200,204' _includes/
|
||||
|
||||
linkcheck:
|
||||
docker run \
|
||||
|
@ -28,6 +28,24 @@
|
||||
Official Drupal Documentation <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
.. |ext_lnk_example_expressionengine_documentation| raw:: html
|
||||
|
||||
<a target="_blank" href="https://docs.expressionengine.com/latest/index.html">
|
||||
Official ExpressionEngine Documentation <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
.. |ext_lnk_example_expressionengine_primer| raw:: html
|
||||
|
||||
<a target="_blank" href="https://docs.expressionengine.com/latest/getting-started/ten-minute-primer.html">
|
||||
10 Minute Primer <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
.. |ext_lnk_example_expressionengine_instal_documentation| raw:: html
|
||||
|
||||
<a target="_blank" href="https://docs.expressionengine.com/latest/installation/installation.html">
|
||||
Official ExpressionEngine Installation Documentation <img src="https://raw.githubusercontent.com/cytopia/icons/master/11x11/ext-link.png" />
|
||||
</a>
|
||||
|
||||
.. |ext_lnk_example_joomla_documentation| raw:: html
|
||||
|
||||
<a target="_blank" href="https://docs.joomla.org/J3.x:Installing_Joomla">
|
||||
|
@ -21,3 +21,5 @@
|
||||
+-------------------------------------+-----------+-----------+----------------+
|
||||
| ELK: Kibana | kibana | kibana | 172.16.238.242 |
|
||||
+-------------------------------------+-----------+-----------+----------------+
|
||||
| Python Flask | flask1 | flask1 | 172.16.238.250 |
|
||||
+-------------------------------------+-----------+-----------+----------------+
|
||||
|
@ -13,11 +13,12 @@ However, each example also exists in its standalone file as shown below:
|
||||
├── docker-compose.override.yml-elk
|
||||
├── docker-compose.override.yml-mailhog
|
||||
├── docker-compose.override.yml-ngrok
|
||||
├── docker-compose.override.yml-python-flask
|
||||
├── docker-compose.override.yml-rabbitmq
|
||||
├── docker-compose.override.yml-solr
|
||||
├── docker-compose.override.yml-varnish
|
||||
└── README.md
|
||||
|
||||
0 directories, 8 files
|
||||
0 directories, 10 files
|
||||
|
||||
.. seealso:: :ref:`custom_container_enable_all_additional_container`
|
||||
|
@ -1582,6 +1582,19 @@ connect to PostgreSQL and will not be able to display information inside the bun
|
||||
Keep this variable in sync with the actual PostgreSQL password.
|
||||
|
||||
|
||||
PGSQL_HOST_AUTH_METHOD
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This variable has been set to ``trust`` by default to allow empty PostgreSQL root user passwords.
|
||||
If you want to set a password for the root user, ensure this variable is empty.
|
||||
|
||||
+----------------------------+---------------------+---------------------+
|
||||
| Name | Allowed values | Default value |
|
||||
+============================+=====================+=====================+
|
||||
| ``PGSQL_HOST_AUTH_METHOD`` | ``trust`` or empty | ``trust`` |
|
||||
+----------------------------+---------------------+---------------------+
|
||||
|
||||
|
||||
.. _env_redis:
|
||||
|
||||
Redis
|
||||
|
@ -60,6 +60,7 @@ In order to fully customize each container, refer to their own documentation sec
|
||||
* :ref:`custom_container_enable_elk_stack`
|
||||
* :ref:`custom_container_enable_mailhog`
|
||||
* :ref:`custom_container_enable_ngrok`
|
||||
* :ref:`custom_container_enable_python_flask`
|
||||
* :ref:`custom_container_enable_rabbitmq`
|
||||
* :ref:`custom_container_enable_solr`
|
||||
* :ref:`custom_container_enable_varnish`
|
||||
|
149
docs/custom-container/enable-python-flask.rst
Normal file
149
docs/custom-container/enable-python-flask.rst
Normal file
@ -0,0 +1,149 @@
|
||||
.. include:: /_includes/all.rst
|
||||
.. include:: /_includes/snippets/__ANNOUNCEMENTS__.rst
|
||||
|
||||
.. _custom_container_enable_python_flask:
|
||||
|
||||
*********************************
|
||||
Enable and configure Python Flask
|
||||
*********************************
|
||||
|
||||
This section will guide you through getting Python Flask integrated into the Devilbox.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`example_setup_reverse_proxy_python_flask`
|
||||
* :ref:`custom_container_enable_all_additional_container`
|
||||
* :ref:`docker_compose_override_yml_how_does_it_work`
|
||||
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
Available overwrites
|
||||
--------------------
|
||||
|
||||
.. include:: /_includes/snippets/docker-compose-override-tree-view.rst
|
||||
|
||||
|
||||
Python Flask settings
|
||||
---------------------
|
||||
|
||||
In case of Python Flask, the file is ``compose/docker-compose.override.yml-python-flask``. This file
|
||||
must be copied into the root of the Devilbox git directory.
|
||||
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| What | How and where |
|
||||
+=======================+==========================================================================================================+
|
||||
| Example compose file | ``compose/docker-compose.override.yml-all`` or |br| ``compose/docker-compose.override.yml-python-flask`` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Container IP address | ``172.16.238.250`` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Container host name | ``flask1`` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Container name | ``flask1`` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Mount points | ``data/www``` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Exposed port | none |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Available at | Devilbox intranet via Reverse Proxy configuration |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Further configuration | :ref:`example_setup_reverse_proxy_python_flask` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Python Flask env variables
|
||||
--------------------------
|
||||
|
||||
Additionally the following ``.env`` variables can be created for easy configuration:
|
||||
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| Variable | Default value | Description |
|
||||
+==============================+===================+============================================================================+
|
||||
| ``FLASK_PROJECT`` | none | Specifies your Python Flask project dir in data/www. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| ``PYTHON_VERSION`` | ``3.8`` | Specifies the Python version to use for Flask. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
|
||||
|
||||
Instructions
|
||||
============
|
||||
|
||||
1. Copy docker-compose.override.yml
|
||||
-----------------------------------
|
||||
|
||||
Copy the Python Flask Docker Compose overwrite file into the root of the Devilbox git directory.
|
||||
(It must be at the same level as the default ``docker-compose.yml`` file).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cp compose/docker-compose.override.yml-python-flask docker-compose.override.yml
|
||||
|
||||
.. seealso::
|
||||
* :ref:`docker_compose_override_yml`
|
||||
* :ref:`add_your_own_docker_image`
|
||||
* :ref:`overwrite_existing_docker_image`
|
||||
|
||||
|
||||
2. Adjust ``.env`` settings (optional)
|
||||
--------------------------------------
|
||||
|
||||
Python Flask is using sane defaults, which can be changed by adding variables to the ``.env`` file
|
||||
and assigning custom values.
|
||||
|
||||
Add the following variables to ``.env`` and adjust them to your needs:
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: .env
|
||||
|
||||
# Project directory in data/www
|
||||
FLASK_PROJECT=my-flask
|
||||
|
||||
# Python version to choose
|
||||
#PYTHON_VERSION=2.7
|
||||
#PYTHON_VERSION=3.5
|
||||
#PYTHON_VERSION=3.6
|
||||
#PYTHON_VERSION=3.7
|
||||
PYTHON_VERSION=3.8
|
||||
|
||||
.. seealso:: :ref:`env_file`
|
||||
|
||||
|
||||
3. Configure Reverse Proxy
|
||||
--------------------------
|
||||
|
||||
Before starting up the devilbox you will need to configure your python flask project and the
|
||||
reverse proxy settings.
|
||||
|
||||
.. seealso:: :ref:`example_setup_reverse_proxy_python_flask`
|
||||
|
||||
|
||||
TL;DR
|
||||
=====
|
||||
|
||||
For the lazy readers, here are all commands required to get you started.
|
||||
Simply copy and paste the following block into your terminal from the root of your Devilbox git
|
||||
directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Copy compose-override.yml into place
|
||||
cp compose/docker-compose.override.yml-flask1 docker-compose.override.yml
|
||||
|
||||
# Create .env variable
|
||||
echo "# Project directory in data/www" > .env
|
||||
echo "FLASK_PROJECT=my-flask" >> .env
|
||||
echo "# Python version to choose" >> .env
|
||||
echo "#PYTHON_VERSION=2.7" >> .env
|
||||
echo "#PYTHON_VERSION=3.5" >> .env
|
||||
echo "#PYTHON_VERSION=3.6" >> .env
|
||||
echo "#PYTHON_VERSION=3.7" >> .env
|
||||
echo "PYTHON_VERSION=3.8" >> .env
|
||||
|
||||
before starting up the devilbox you will need to configure your python flask project and the
|
||||
reverse proxy settings.
|
||||
|
||||
.. seealso:: :ref:`example_setup_reverse_proxy_python_flask`
|
@ -127,7 +127,7 @@ Add the following variables to ``.env`` and adjust them to your needs:
|
||||
.. seealso:: :ref:`env_file`
|
||||
|
||||
|
||||
4. Start the Devilbox
|
||||
3. Start the Devilbox
|
||||
---------------------
|
||||
|
||||
The final step is to start the Devilbox with RabbitMQ.
|
||||
|
@ -114,7 +114,7 @@ Add the following variables to ``.env`` and adjust them to your needs:
|
||||
.. seealso:: :ref:`env_file`
|
||||
|
||||
|
||||
4. Start the Devilbox
|
||||
3. Start the Devilbox
|
||||
---------------------
|
||||
|
||||
The final step is to start the Devilbox with Solr.
|
||||
|
205
docs/examples/setup-expressionengine.rst
Normal file
205
docs/examples/setup-expressionengine.rst
Normal file
@ -0,0 +1,205 @@
|
||||
.. include:: /_includes/all.rst
|
||||
.. include:: /_includes/snippets/__ANNOUNCEMENTS__.rst
|
||||
|
||||
.. _example_setup_expressionengine:
|
||||
|
||||
**********************
|
||||
Setup ExpressionEngine
|
||||
**********************
|
||||
|
||||
This example will use ``curl`` to install ExpressionEngine from within the Devilbox PHP container.
|
||||
|
||||
After completing the below listed steps, you will have a working ExpressionEngine setup ready to be
|
||||
served via http and https.
|
||||
|
||||
.. seealso:: |ext_lnk_example_expressionengine_documentation|
|
||||
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
The following configuration will be used:
|
||||
|
||||
+--------------+--------------------------+-------------+------------+-------------------------------------------------+
|
||||
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Project URL |
|
||||
+==============+==========================+=============+============+=================================================+
|
||||
| my-ee | /shared/httpd/my-ee | my_ee | loc | http://my-ee.loc |br| https://my-ee.loc |
|
||||
+--------------+--------------------------+-------------+------------+-------------------------------------------------+
|
||||
|
||||
.. note::
|
||||
* Inside the Devilbox PHP container, projects are always in ``/shared/httpd/``.
|
||||
* On your host operating system, projects are by default in ``./data/www/`` inside the
|
||||
Devilbox git directory. This path can be changed via :ref:`env_httpd_datadir`.
|
||||
|
||||
|
||||
Walk through
|
||||
============
|
||||
|
||||
It will be ready in eight simple steps:
|
||||
|
||||
1. Enter the PHP container
|
||||
2. Create a new VirtualHost directory
|
||||
3. Download and extract ExpressionEngine
|
||||
4. Symlink webroot directory
|
||||
5. Add MySQL Database
|
||||
6. Setup DNS record
|
||||
7. Install ExpressionEngine
|
||||
8. View your site
|
||||
|
||||
|
||||
1. Enter the PHP container
|
||||
--------------------------
|
||||
|
||||
All work will be done inside the PHP container as it provides you with all required command line
|
||||
tools.
|
||||
|
||||
Navigate to the Devilbox git directory and execute ``shell.sh`` (or ``shell.bat`` on Windows) to
|
||||
enter the running PHP container.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> ./shell.sh
|
||||
|
||||
.. seealso::
|
||||
* :ref:`enter_the_php_container`
|
||||
* :ref:`work_inside_the_php_container`
|
||||
* :ref:`available_tools`
|
||||
|
||||
|
||||
2. Create new vhost directory
|
||||
-----------------------------
|
||||
|
||||
The vhost directory defines the name under which your project will be available. |br|
|
||||
( ``<vhost dir>.TLD_SUFFIX`` will be the final URL ).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-ee
|
||||
|
||||
.. seealso:: :ref:`env_tld_suffix`
|
||||
|
||||
|
||||
3. Download and extract ExpressionEngine
|
||||
----------------------------------------
|
||||
|
||||
Navigate into your newly created vhost directory and install ExpressionEngine.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-ee
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-ee $ curl 'https://expressionengine.com/?ACT=243' -H 'Referer: https://expressionengine.com/' --compressed -o ee.zip
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-ee $ mkdir ee
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-ee $ unzip ee.zip -d ee
|
||||
|
||||
How does the directory structure look after installation:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-ee $ tree -L 1
|
||||
.
|
||||
├── ee
|
||||
└── ee.zip
|
||||
|
||||
1 directory, 1 file
|
||||
|
||||
|
||||
4. Symlink webroot
|
||||
------------------
|
||||
|
||||
Symlinking the actual webroot directory to ``htdocs`` is important. The web server expects every
|
||||
project's document root to be in ``<vhost dir>/htdocs/``. This is the path where it will serve
|
||||
the files. This is also the path where your frameworks entrypoint (usually ``index.php``) should
|
||||
be found.
|
||||
|
||||
Some frameworks however provide its actual content in nested directories of unknown levels.
|
||||
This would be impossible to figure out by the web server, so you manually have to symlink it back
|
||||
to its expected path.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-ee $ ln -s ee/ htdocs
|
||||
|
||||
How does the directory structure look after symlinking it:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-ee $ tree -L 1
|
||||
.
|
||||
├── ee
|
||||
├── ee.zip
|
||||
└── htdocs -> ee
|
||||
|
||||
2 directories, 1 file
|
||||
|
||||
As you can see from the above directory structure, ``htdocs`` is available in its expected
|
||||
path and points to the frameworks entrypoint.
|
||||
|
||||
.. important::
|
||||
When using **Docker Toolbox**, you need to **explicitly allow** the usage of **symlinks**.
|
||||
See below for instructions:
|
||||
|
||||
* Docker Toolbox and :ref:`howto_docker_toolbox_and_the_devilbox_windows_symlinks`
|
||||
|
||||
|
||||
5. Add MySQL Database
|
||||
---------------------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-ee $ mysql -u root -h 127.0.0.1 -p -e 'CREATE DATABASE my_ee CHARACTER SET utf8 COLLATE utf8_unicode_ci;'
|
||||
|
||||
.. note::
|
||||
* Remember the database name you create here. It will be needed again during the installation process.
|
||||
|
||||
6. DNS record
|
||||
-------------
|
||||
If you **have** Auto DNS configured already, you can skip this section, because DNS entries will
|
||||
be available automatically by the bundled DNS server.
|
||||
|
||||
If you **don't have** Auto DNS configured, you will need to add the following line to your
|
||||
host operating systems ``/etc/hosts`` file (or ``C:\Windows\System32\drivers\etc`` on Windows):
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: /etc/hosts
|
||||
|
||||
127.0.0.1 my-ee.loc
|
||||
|
||||
.. seealso::
|
||||
|
||||
* :ref:`howto_add_project_hosts_entry_on_mac`
|
||||
* :ref:`howto_add_project_hosts_entry_on_win`
|
||||
* :ref:`setup_auto_dns`
|
||||
|
||||
|
||||
7. Install ExpressionEngine
|
||||
---------------------------
|
||||
|
||||
Point your browser to http://my-ee.loc/admin.php or https://my-ee.loc/admin.php and follow the on-screen instructions to install ExpressionEngine.
|
||||
|
||||
.. important::
|
||||
Once the Installation Wizard is finished, you should rename or remove the system/ee/installer/ directory from your install directory if it was not done by the install wizard.
|
||||
|
||||
.. seealso:: |ext_lnk_example_expressionengine_instal_documentation|
|
||||
|
||||
|
||||
8. View Your Site
|
||||
-----------------
|
||||
|
||||
All set now, you can visit your site's homepage by opening http://my-ee.loc or https://my-ee.loc in your browser.
|
||||
|
||||
Your control panel will also be available by opening http://my-ee.loc/admin.php or https://my-ee.loc/admin.php in your browser.
|
||||
|
||||
.. note::
|
||||
* If you chose not to install the default theme, your site’s homepage will appear blank because no templates or content has been created yet.
|
||||
* If you’re new to ExpressionEngine, get started with the |ext_lnk_example_expressionengine_primer|
|
||||
|
||||
|
||||
Next steps
|
||||
==========
|
||||
|
||||
.. include:: /_includes/snippets/examples/next-steps.rst
|
449
docs/examples/setup-reverse-proxy-python-flask.rst
Normal file
449
docs/examples/setup-reverse-proxy-python-flask.rst
Normal file
@ -0,0 +1,449 @@
|
||||
.. include:: /_includes/all.rst
|
||||
.. include:: /_includes/snippets/__ANNOUNCEMENTS__.rst
|
||||
|
||||
.. _example_setup_reverse_proxy_python_flask:
|
||||
|
||||
********************************
|
||||
Setup reverse proxy Python Flask
|
||||
********************************
|
||||
|
||||
This example will walk you through adding a version specific Python Flask docker container,
|
||||
creating a simple Flask hello world application and have its requirements specified in
|
||||
``requirements.txt`` automatically installed. Once setup, your application will be ready via
|
||||
``docker-compose up``, proxied to the web server and can be reached via valid HTTPS.
|
||||
|
||||
|
||||
.. note::
|
||||
This example is using an additional Docker image, so you are able to specify any Python version
|
||||
you like and even be able to add multiple Docker images with different versions.
|
||||
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
The following configuration will be used:
|
||||
|
||||
+--------------+--------------------------+-------------+------------+-----------------------------------------------+
|
||||
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Project URL |
|
||||
+==============+==========================+=============+============+===============================================+
|
||||
| my-flask | /shared/httpd/my-flask | - | loc | http://my-flask.loc |br| https://my-flask.loc |
|
||||
+--------------+--------------------------+-------------+------------+-----------------------------------------------+
|
||||
|
||||
.. note::
|
||||
* Inside the Devilbox PHP container, projects are always in ``/shared/httpd/``.
|
||||
* On your host operating system, projects are by default in ``./data/www/`` inside the
|
||||
Devilbox git directory. This path can be changed via :ref:`env_httpd_datadir`.
|
||||
|
||||
The following Devilbox configuration is required:
|
||||
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
| Service | Implications |
|
||||
+==============+================================================================================================+
|
||||
| Webserver | Reverse proxy vhost-gen template need to be applied |
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
| Python Flask | Docker Compose override file must be applied. |
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
| ``.env`` | ``FLASK_PROJECT`` variable must be declared and set. |
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
| ``.env`` | ``PYTHON_VERSION`` variable can be declared and set. |
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
|
||||
Additionally we will set the listening port of the Flask appliation to ``3000``.
|
||||
|
||||
.. seealso::
|
||||
For a detailed overview about the Compose file see: :ref:`custom_container_enable_python_flask`
|
||||
|
||||
|
||||
Walk through
|
||||
============
|
||||
|
||||
It will be ready in ten simple steps:
|
||||
|
||||
1. Configure Python Flask project name and versoin
|
||||
2. Enter the PHP container
|
||||
3. Create a new VirtualHost directory
|
||||
4. Create Flask hello world application
|
||||
5. Symlink *virtual* docroot directory
|
||||
6. Add reverse proxy vhost-gen config files
|
||||
7. Copy Python Flask compose file
|
||||
8. Setup DNS record
|
||||
9. Restart the Devilbox
|
||||
10. Visit http://my-flask.loc in your browser
|
||||
|
||||
|
||||
1. Configure Python Flask project name and version
|
||||
--------------------------------------------------
|
||||
|
||||
The Python Flask container will only serve a single project. In order for it to know where
|
||||
to find your project, you will have to add an environment variable (``FLASK_PROJECT``),
|
||||
telling it what the directory name of your project is.
|
||||
|
||||
Additionally you can define the Python version (``PYTHON_VERSION``) under which you want to run
|
||||
your Flask project.
|
||||
|
||||
.. seealso:: Available Python versions can be seen here: https://github.com/devilbox/docker-python-flask
|
||||
|
||||
Add the following variable to the very end of your ``.env`` file:
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: .env
|
||||
|
||||
FLASK_PROJECT=my-flask
|
||||
|
||||
#PYTHON_VERSION=2.7
|
||||
#PYTHON_VERSION=3.5
|
||||
#PYTHON_VERSION=3.6
|
||||
#PYTHON_VERSION=3.7
|
||||
PYTHON_VERSION=3.8
|
||||
|
||||
|
||||
2. Enter the PHP container
|
||||
--------------------------
|
||||
|
||||
All work will be done inside the PHP container as it provides you with all required command line
|
||||
tools.
|
||||
|
||||
Navigate to the Devilbox git directory and execute ``shell.sh`` (or ``shell.bat`` on Windows) to
|
||||
enter the running PHP container.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> ./shell.sh
|
||||
|
||||
.. seealso::
|
||||
* :ref:`enter_the_php_container`
|
||||
* :ref:`work_inside_the_php_container`
|
||||
* :ref:`available_tools`
|
||||
|
||||
|
||||
3. Create new VirtualHost directory
|
||||
-----------------------------------
|
||||
|
||||
The vhost directory defines the name under which your project will be available. |br|
|
||||
( ``<vhost dir>.TLD_SUFFIX`` will be the final URL ).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-flask
|
||||
|
||||
.. seealso:: :ref:`env_tld_suffix`
|
||||
|
||||
|
||||
4. Create Flask hello world application
|
||||
---------------------------------------
|
||||
|
||||
4.1 Add your code
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to your project directory
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-flask
|
||||
|
||||
# Create a directory which will hold the source code
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask $ mkdir app
|
||||
|
||||
# Create the main.py file with your favourite editor
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask/app $ vi main.py
|
||||
|
||||
.. code-block:: python
|
||||
:caption: main.py
|
||||
|
||||
"""Flask example application."""
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
"""Serve the default index page."""
|
||||
return "Hello World!"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
"""Ensure Flask listens on all interfaces."""
|
||||
app.run(host='0.0.0.0')
|
||||
|
||||
4.2 Add dependencies
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
You can optionally add a ``requirements.txt`` file which will be read during startup. The Python
|
||||
Flask container will then automatically install all Python libraries specified in that file.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to your project directory
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-flask
|
||||
|
||||
# Create and open the file with your favourite editor
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask $ vi requirements.txt
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: data/www/my-flask/requirements.txt
|
||||
|
||||
requests
|
||||
|
||||
|
||||
5. Symlink *virtual* docroot directory
|
||||
--------------------------------------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to your project directory
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-flask
|
||||
|
||||
# Create the docroot directory
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask $ ln -s app htdocs
|
||||
|
||||
.. seealso:: :ref:`env_httpd_docroot_dir`
|
||||
|
||||
|
||||
6. Add reverse proxy vhost-gen config files
|
||||
-------------------------------------------
|
||||
|
||||
6.1 Create vhost-gen template directory
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Before we can copy the vhost-gen templates, we must create the ``.devilbox`` template directory
|
||||
inside the project directory.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to your project directory
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-flask
|
||||
|
||||
# Create the .devilbox template directory
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask $ mkdir .devilbox
|
||||
|
||||
|
||||
.. seealso:: :ref:`env_httpd_template_dir`
|
||||
|
||||
6.2 Copy vhost-gen templates
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Now we can copy and adjust the vhost-gen reverse proxy files for Apache 2.2, Apache 2.4 and Nginx.
|
||||
|
||||
|
||||
The reverse vhost-gen templates are available in ``cfg/vhost-gen``:
|
||||
|
||||
.. code-block:: bash
|
||||
:emphasize-lines: 4,6,8
|
||||
|
||||
host> tree -L 1 cfg/vhost-gen/
|
||||
|
||||
cfg/vhost-gen/
|
||||
├── apache22.yml-example-rproxy
|
||||
├── apache22.yml-example-vhost
|
||||
├── apache24.yml-example-rproxy
|
||||
├── apache24.yml-example-vhost
|
||||
├── nginx.yml-example-rproxy
|
||||
├── nginx.yml-example-vhost
|
||||
└── README.md
|
||||
|
||||
0 directories, 7 files
|
||||
|
||||
For this example we will copy all ``*-example-rproxy`` files into ``data/www/my-flask/.devilbox/``
|
||||
(Inside container: ``/shared/httpd/my-flask/.devilbox``) to ensure this will work with all web servers.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> cp cfg/vhost-gen/apache22.yml-example-rproxy data/www/my-flask/.devilbox/apache22.yml
|
||||
host> cp cfg/vhost-gen/apache24.yml-example-rproxy data/www/my-flask/.devilbox/apache24.yml
|
||||
host> cp cfg/vhost-gen/nginx.yml-example-rproxy data/www/my-flask/.devilbox/nginx.yml
|
||||
|
||||
|
||||
6.3 Adjust ports and backend
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
By default, all vhost-gen templates will forward requests to port ``8000`` into the PHP container.
|
||||
Our current example however uses port ``3000`` and backend IP ``172.16.238.250`` (as defined
|
||||
in the Flask docker compose override file), so we must change that accordingly for all three
|
||||
templates.
|
||||
|
||||
6.3.1 Adjust Apache 2.2 template
|
||||
""""""""""""""""""""""""""""""""
|
||||
|
||||
Open the ``apache22.yml`` vhost-gen template in your project:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> vi data/www/my-flask/.devilbox/apache22.yml
|
||||
|
||||
|
||||
Find the two lines with ``ProxyPass`` and ``ProxyPassReverse`` and change the port from ``8000``
|
||||
to ``3000`` as well as the backend server from ``php`` to ``172.16.238.250``.
|
||||
|
||||
.. code-block:: yaml
|
||||
:caption: data/www/my-flask/.devilbox/apache22.yml
|
||||
:emphasize-lines: 16,17
|
||||
|
||||
# ... more lines above ... #
|
||||
|
||||
###
|
||||
### Basic vHost skeleton
|
||||
###
|
||||
vhost: |
|
||||
<VirtualHost __DEFAULT_VHOST__:__PORT__>
|
||||
ServerName __VHOST_NAME__
|
||||
|
||||
CustomLog "__ACCESS_LOG__" combined
|
||||
ErrorLog "__ERROR_LOG__"
|
||||
|
||||
# Reverse Proxy definition (Ensure to adjust the port, currently '8000')
|
||||
ProxyRequests On
|
||||
ProxyPreserveHost On
|
||||
ProxyPass / http://172.16.238.250:3000/
|
||||
ProxyPassReverse / http://172.16.238.250:3000/
|
||||
|
||||
# ... more lines below ... #
|
||||
|
||||
6.3.2 Adjust Apache 2.4 template
|
||||
""""""""""""""""""""""""""""""""
|
||||
|
||||
Open the ``apache24.yml`` vhost-gen template in your project:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> vi data/www/my-flask/.devilbox/apache24.yml
|
||||
|
||||
|
||||
Find the two lines with ``ProxyPass`` and ``ProxyPassReverse`` and change the port from ``8000``
|
||||
to ``3000``
|
||||
|
||||
.. code-block:: yaml
|
||||
:caption: data/www/my-flask/.devilbox/apache24.yml
|
||||
:emphasize-lines: 16,17
|
||||
|
||||
# ... more lines above ... #
|
||||
|
||||
###
|
||||
### Basic vHost skeleton
|
||||
###
|
||||
vhost: |
|
||||
<VirtualHost __DEFAULT_VHOST__:__PORT__>
|
||||
ServerName __VHOST_NAME__
|
||||
|
||||
CustomLog "__ACCESS_LOG__" combined
|
||||
ErrorLog "__ERROR_LOG__"
|
||||
|
||||
# Reverse Proxy definition (Ensure to adjust the port, currently '8000')
|
||||
ProxyRequests On
|
||||
ProxyPreserveHost On
|
||||
ProxyPass / http://172.16.238.250:3000/
|
||||
ProxyPassReverse / http://172.16.238.250:3000/
|
||||
|
||||
# ... more lines below ... #
|
||||
|
||||
6.3.3 Adjust Nginx template
|
||||
"""""""""""""""""""""""""""
|
||||
|
||||
Open the ``nginx.yml`` vhost-gen template in your project:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> vi data/www/my-flask/.devilbox/nginx.yml
|
||||
|
||||
|
||||
Find the lines with ``proxy_pass`` and change the port from ``8000`` to ``3000``
|
||||
|
||||
.. code-block:: yaml
|
||||
:caption: data/www/my-flask/.devilbox/nginx.yml
|
||||
:emphasize-lines: 18
|
||||
|
||||
# ... more lines above ... #
|
||||
|
||||
###
|
||||
### Basic vHost skeleton
|
||||
###
|
||||
vhost: |
|
||||
server {
|
||||
listen __PORT____DEFAULT_VHOST__;
|
||||
server_name __VHOST_NAME__;
|
||||
|
||||
access_log "__ACCESS_LOG__" combined;
|
||||
error_log "__ERROR_LOG__" warn;
|
||||
|
||||
# Reverse Proxy definition (Ensure to adjust the port, currently '8000')
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://172.16.238.250:3000;
|
||||
}
|
||||
|
||||
# ... more lines below ... #
|
||||
|
||||
|
||||
7. Copy Python Flask compose file
|
||||
---------------------------------
|
||||
|
||||
Python Flask comes with its own Docker container and can be added to the Devilbox stack via
|
||||
the ``docker-compose.override.yml`` file. A fully functional template already exists in the
|
||||
``compose/`` directory. All you will have to do is copy it over.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> cp compose/docker-compose.override.yml-python-flask.yml docker-compose.override.yml
|
||||
|
||||
.. seealso:: :ref:`docker_compose_override_yml`
|
||||
|
||||
|
||||
8. DNS record
|
||||
-------------
|
||||
|
||||
If you **have** Auto DNS configured already, you can skip this section, because DNS entries will
|
||||
be available automatically by the bundled DNS server.
|
||||
|
||||
If you **don't have** Auto DNS configured, you will need to add the following line to your
|
||||
host operating systems ``/etc/hosts`` file (or ``C:\Windows\System32\drivers\etc`` on Windows):
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: /etc/hosts
|
||||
|
||||
127.0.0.1 my-flask.loc
|
||||
|
||||
.. seealso::
|
||||
|
||||
* :ref:`howto_add_project_hosts_entry_on_mac`
|
||||
* :ref:`howto_add_project_hosts_entry_on_win`
|
||||
* :ref:`setup_auto_dns`
|
||||
|
||||
|
||||
9. Restart the Devilbox
|
||||
-----------------------
|
||||
|
||||
Now for those changes to take affect, you will have to restart the Devilbox.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
|
||||
# Stop the Devilbox
|
||||
host> docker-compose down
|
||||
host> docker-compose rm -f
|
||||
|
||||
# Start the Devilbox
|
||||
host> docker-compose up -d php httpd bind flask1
|
||||
|
||||
|
||||
10. Open your browser
|
||||
---------------------
|
||||
|
||||
All set now, you can visit http://my-flask.loc or https://my-flask.loc in your browser.
|
||||
The Python Flask application has been started up automatically and the reverse proxy will direct all
|
||||
requests to it.
|
||||
|
||||
|
||||
|
||||
Next steps
|
||||
==========
|
||||
|
||||
.. include:: /_includes/snippets/examples/next-steps.rst
|
@ -390,7 +390,7 @@ host operating systems ``/etc/hosts`` file (or ``C:\Windows\System32\drivers\etc
|
||||
.. code-block:: bash
|
||||
:caption: /etc/hosts
|
||||
|
||||
127.0.0.1 my-node.loc
|
||||
127.0.0.1 my-sphinx.loc
|
||||
|
||||
.. seealso::
|
||||
|
||||
|
@ -40,15 +40,14 @@ The following configuration will be used:
|
||||
Walk through
|
||||
============
|
||||
|
||||
It will be ready in seven simple steps:
|
||||
It will be ready in six simple steps:
|
||||
|
||||
1. Enter the PHP container
|
||||
2. Create a new VirtualHost directory
|
||||
3. Install Symfony
|
||||
4. Symlink webroot directory
|
||||
5. Enable Symfony prod (``app.php``)
|
||||
6. Setup DNS record
|
||||
7. Visit http://my-symfony.loc in your browser
|
||||
5. Setup DNS record
|
||||
6. Visit http://my-symfony.loc in your browser
|
||||
|
||||
|
||||
1. Enter the PHP container
|
||||
@ -78,7 +77,7 @@ The vhost directory defines the name under which your project will be available.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-symfony
|
||||
devilbox@php-7.2.29 in /shared/httpd $ mkdir my-symfony
|
||||
|
||||
.. seealso:: :ref:`env_tld_suffix`
|
||||
|
||||
@ -90,14 +89,14 @@ Navigate into your newly created vhost directory and install Symfony with ``symf
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-symfony
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-symfony $ symfony new symfony
|
||||
devilbox@php-7.2.29 in /shared/httpd $ cd my-symfony
|
||||
devilbox@php-7.2.29 in /shared/httpd/my-symfony $ symfony new symfony
|
||||
|
||||
How does the directory structure look after installation:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-symfony $ tree -L 1
|
||||
devilbox@php-7.2.29 in /shared/httpd/my-symfony $ tree -L 1
|
||||
.
|
||||
└── symfony
|
||||
|
||||
@ -118,16 +117,16 @@ to its expected path.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-symfony $ ln -s symfony/web/ htdocs
|
||||
devilbox@php-7.2.29 in /shared/httpd/my-symfony $ ln -s symfony/public/ htdocs
|
||||
|
||||
How does the directory structure look after symlinking:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-sw $ tree -L 1
|
||||
devilbox@php-7.2.29 in /shared/httpd/my-sw $ tree -L 1
|
||||
.
|
||||
├── symfony
|
||||
└── htdocs -> symfony/web
|
||||
└── htdocs -> symfony/public
|
||||
|
||||
2 directories, 0 files
|
||||
|
||||
@ -141,16 +140,7 @@ path and points to the frameworks entrypoint.
|
||||
* Docker Toolbox and :ref:`howto_docker_toolbox_and_the_devilbox_windows_symlinks`
|
||||
|
||||
|
||||
5. Enable Symfony prod (``app.php``)
|
||||
------------------------------------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-symfony $ cd symfony/web
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-symfony/symfony/web $ ln -s app.php index.php
|
||||
|
||||
|
||||
6. DNS record
|
||||
5. DNS record
|
||||
-------------
|
||||
|
||||
If you **have** Auto DNS configured already, you can skip this section, because DNS entries will
|
||||
@ -171,7 +161,7 @@ host operating systems ``/etc/hosts`` file (or ``C:\Windows\System32\drivers\etc
|
||||
* :ref:`setup_auto_dns`
|
||||
|
||||
|
||||
7. Open your browser
|
||||
6. Open your browser
|
||||
--------------------
|
||||
|
||||
Open your browser at http://my-symfony.loc or https://my-symfony.loc
|
||||
|
@ -200,6 +200,7 @@ their articles:
|
||||
* :ref:`example_setup_codeigniter`
|
||||
* :ref:`example_setup_craftcms`
|
||||
* :ref:`example_setup_drupal`
|
||||
* :ref:`example_setup_expressionengine`
|
||||
* :ref:`example_setup_joomla`
|
||||
* :ref:`example_setup_laravel`
|
||||
* :ref:`example_setup_magento`
|
||||
|
BIN
docs/img/logo_tools/flask.png
Normal file
BIN
docs/img/logo_tools/flask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -122,6 +122,7 @@ host is ready to be served with your custom domain.
|
||||
custom-container/enable-elk-stack
|
||||
custom-container/enable-mailhog
|
||||
custom-container/enable-ngrok
|
||||
custom-container/enable-python-flask
|
||||
custom-container/enable-rabbitmq
|
||||
custom-container/enable-solr
|
||||
custom-container/enable-varnish
|
||||
@ -178,6 +179,7 @@ host is ready to be served with your custom domain.
|
||||
examples/setup-contao
|
||||
examples/setup-craftcms
|
||||
examples/setup-drupal
|
||||
examples/setup-expressionengine
|
||||
examples/setup-joomla
|
||||
examples/setup-laravel
|
||||
examples/setup-magento2
|
||||
@ -199,6 +201,7 @@ host is ready to be served with your custom domain.
|
||||
|
||||
examples/setup-reverse-proxy-nodejs
|
||||
examples/setup-reverse-proxy-sphinx-docs
|
||||
examples/setup-reverse-proxy-python-flask
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
@ -38,7 +38,7 @@ Let's imagine you have added a custom Python Docker image to the Devilbox which
|
||||
application listening on port ``3000``.
|
||||
|
||||
* :ref:`env_TLD_SUFFIX`: ``loc``
|
||||
* Desired DNS name: ``my-pthon.loc``
|
||||
* Desired DNS name: ``my-python.loc``
|
||||
* :ref:`env_httpd_datadir` on the host: ``./data/www``
|
||||
* :ref:`env_httpd_template_dir`: ``.devilbox``
|
||||
* Listening port: ``3000``
|
||||
|
@ -180,6 +180,12 @@ Does it work with Drupal?
|
||||
Yes, see :ref:`example_setup_drupal`
|
||||
|
||||
|
||||
Does it work with ExpressionEngine?
|
||||
-----------------------------------
|
||||
|
||||
Yes, see :ref:`example_setup_expressionengine`
|
||||
|
||||
|
||||
Does it work with Joomla?
|
||||
-------------------------
|
||||
|
||||
|
17
env-example
17
env-example
@ -299,7 +299,7 @@ MYSQL_SERVER=mariadb-10.3
|
||||
###
|
||||
### 1.4 Choose PostgreSQL Server Image
|
||||
###
|
||||
### IMPORTANT: Apline based images might cause issues on Docker Toolbox or OSX
|
||||
### IMPORTANT: Alpine based images might cause issues on Docker Toolbox or OSX
|
||||
### https://github.com/docker/toolbox/issues/510
|
||||
###
|
||||
#PGSQL_SERVER=9.0
|
||||
@ -361,7 +361,7 @@ PGSQL_SERVER=12.1
|
||||
###
|
||||
### 1.5 Choose Redis Server Image
|
||||
###
|
||||
### IMPORTANT: Apline based images might cause issues on Docker Toolbox or OSX
|
||||
### IMPORTANT: Alpine based images might cause issues on Docker Toolbox or OSX
|
||||
### https://github.com/docker/toolbox/issues/510
|
||||
###
|
||||
#REDIS_SERVER=2.8
|
||||
@ -380,7 +380,7 @@ REDIS_SERVER=5.0
|
||||
###
|
||||
### 1.6 Choose Memcached Server Image
|
||||
###
|
||||
### IMPORTANT: Apline based images might cause issues on Docker Toolbox or OSX
|
||||
### IMPORTANT: Alpine based images might cause issues on Docker Toolbox or OSX
|
||||
### https://github.com/docker/toolbox/issues/510
|
||||
###
|
||||
#MEMCD_SERVER=1.4
|
||||
@ -419,7 +419,7 @@ MONGO_SERVER=4.2
|
||||
### existing mount options.
|
||||
###
|
||||
### Note: If no mount options are specified, leave this variable empty
|
||||
### and do not add a leading ',' (comman).
|
||||
### and do not add a leading ',' (comma).
|
||||
###
|
||||
### MOUNT_OPTIONS=,cached
|
||||
### MOUNT_OPTIONS=
|
||||
@ -626,9 +626,18 @@ PGSQL_ROOT_USER=postgres
|
||||
###
|
||||
### PostgreSQL 'root' user password
|
||||
###
|
||||
### If you want to set a password, ensure to remove 'trust' from
|
||||
### PGSQL_HOST_AUTH_METHOD below
|
||||
###
|
||||
PGSQL_ROOT_PASSWORD=
|
||||
|
||||
|
||||
###
|
||||
### In order to not use a password for PostgreSQL, keep this value at 'trust'
|
||||
###
|
||||
PGSQL_HOST_AUTH_METHOD=trust
|
||||
|
||||
|
||||
###
|
||||
### Expose PostgreSQL Port to Host
|
||||
###
|
||||
|
Reference in New Issue
Block a user