improve installation with docker and move static to _static

This commit is contained in:
Julien Fastré 2017-07-11 22:40:56 +02:00
parent 08f03a75b0
commit 4eb5f5a0c1
14 changed files with 212 additions and 159 deletions

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -0,0 +1,35 @@
version: '2'
services:
fpm:
image: dev-activity-person-report
links:
- db
- redis
- logstash:gelf
environment:
- ADMIN_PASSWORD=admin
# add a link to custom.yml if needed
# volumes:
# - /tmp/custom.yml:/var/www/chill/app/config/custom.yml
redis:
image: redis
db:
image: chill/database
logstash:
image: logstash
command: logstash -e 'input { gelf { } } output { stdout{ } }'
expose:
- "12201/udp"
volumes:
- /var/log/logstash
nginx:
image: nginx
links:
- fpm
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
volumes_from:
- fpm:ro
ports:
- 8080:80

View File

@ -0,0 +1,71 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip off;
#include /etc/nginx/conf.d/*.conf;
upstream phpfcgi {
server fpm:9000;
# server unix:/var/run/php5-fpm.sock; #for PHP-FPM running on UNIX socket
}
server {
listen 80;
#server_name symfony2;
root /var/www/chill/web;
error_log /var/log/nginx/symfony2.error.log;
access_log /var/log/nginx/symfony2.access.log;
# strip app.php/ prefix if it is present
rewrite ^/app\.php/?(.*)$ /$1 permanent;
location / {
index app.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# pass the PHP scripts to FastCGI server from upstream phpfcgi
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass phpfcgi;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
}

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -19,7 +19,7 @@ Allow to group people in a group. This group may be a family, an activity group,
Entities
********
.. figure:: /static/bundles/group/group_classes_uml.png
.. figure:: /_static/bundles/group/group_classes_uml.png
.. _group-bundle-macros:

View File

@ -55,7 +55,7 @@ Example: if some activities must be seen and updated between nurses and psycholo
The concepts translated into code
-----------------------------------
.. figure:: /static/access_control_model.png
.. figure:: /_static/access_control_model.png
Schema of the access control model

View File

@ -24,7 +24,7 @@ In the controller, get the :class:`Chill\Main\Pagination\PaginatorFactory` from
Then, render the pagination using the dedicated twig function.
.. code-block:: html+jinja2
.. code-block:: html+twig
{% extends "ChillPersonBundle::layout.html.twig" %}
@ -55,7 +55,7 @@ Where does the :code:`$paginator` get the page number ?
Internally, the :code:`$paginator` object has a link to the :code:`Request` object, and it reads the :code:`page` parameter which contains the current page number. If this parameter is not present, the :code:`$paginator` assumes that we are on page 1.
.. figure:: /static/puml/pagination-sequence.png
.. figure:: /_static/puml/pagination-sequence.png
The :code:`$paginator` get the current page from the request.

View File

@ -12,23 +12,16 @@
Free Documentation License".
Installation
###############################
#############
Canonical installation
======================
.. toctree::
:maxdepth: 1
Common installation <installation.rst>
Very quick install with docker
=================================
Install with docker
===================
.. toctree::
:maxdepth: 2
Very quick install with docker <very_quick_start_with_docker.rst>
Install with docker <install_with_docker.rst>
Usage in production
====================
@ -38,6 +31,14 @@ Usage in production
Installation in production <install_production_webserver.rst>
Installation without docker
===========================
.. toctree::
:maxdepth: 1
Common installation <installation_without_docker.rst>
Update Chill and maintenance
==============================

View File

@ -0,0 +1,80 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Install with docker
####################
The installation with docker is the canonical way to install Chill in production.
Availables images and flavors
=============================
We provide docker images which here : https://hub.docker.com/r/chill/standard/
There are differents "flavors" of docker, depending on which bundles are installed. Those flavors are available as tags, which are named according to bundles'names, with a prefix for the stable or dev versions. Those flavors are listed here : https://hub.docker.com/r/chill/standard/tags/.
How to install
==============
Prerequisites
-------------
Make sure you have installed ``docker`` and ``docker-compose`` installed.
Create your ``docker-compose`` project
--------------------------------------
1. Create an empty working directory (``mkdir chill && cd chill``)
2. Download or copy-paste the above :download:`docker-compose.yml file </_static/code/installation/docker-compose.yml>`
.. literalinclude:: /_static/code/installation/docker-compose.yml
:language: yaml
3. Adapt eventually the image with your own requested flavor.
4. Download or copy-paster the above :download:`nginx.conf file </_static/code/installation/nginx.conf>`. This file must be located in the same directory of your ``docker-compose.yml`` file.
.. literalinclude:: /_static/code/installation/nginx.conf
:language: nginx
5. Launch the stack with ``docker-compose up``. Docker and docker-compose will download the container images, create an internal network and create the database schema.
6. Browse http://localhost:8080, you are ready to start !
To stop the container, you can type ``CTRL+C`` in the terminal to stop container **OR** run ``docker-compose stop`` in a separate terminal.
On startup, you will only have access to the admin user: login ``admin``, password ``admin`` (as defined in ``docker-compose.yml`` file, under an environment variabled called ``ADMIN_PASSWORD``.
Create fixtures (more user and fake data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can create fixtures using the command ``docker-compose exec fpm php -d memory_limit=-1 doctrine:fixtures:load``.
This will create those users, which password is always ``password``:
* center a_social
* center a_administrative
* center a_direction
* center b_social
* center b_administrative
* center b_direction
* multi_center
Create your own images
======================
You can create your own images, compile yourself and adapt the flavors to your needs. The source of the docker images are available here : https://framagit.org/Chill-project/docker-standard
.. _the composer documentation: https://getcomposer.org/doc/
.. _the composer introduction: https://getcomposer.org/doc/00-intro.md
.. _the standard architecture: https://github.com/Champs-Libres/chill-standard
.. _composer: https://getcomposer.org
.. _Firefox: https://www.mozilla.org
.. _symfony framework: http://symfony.com
.. _*unaccent* extension: http://www.postgresql.org/docs/current/static/unaccent.html

View File

@ -6,14 +6,11 @@
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _install:
Install chill
#############
Install chill without docker
############################
.. _basic-installation:
Basic installation
``````````````````
@ -45,34 +42,17 @@ Install composer
.. note::
If you do not know composer, it is a good idea to have a glance at `the composer documentation`_
Install composer on your system :
Install composer on your system, according to the instructions here : https://getcomposer.org/download
.. code-block:: bash
curl -sS https://getcomposer.org/installer | php
Install composer.phar globally
""""""""""""""""""""""""""""""
.. note::
This part is not mandatory, if you do not want to install composer globally, you will have to replace in the commands of this tutorial `composer` by `php composer.phar`.
Install composer globally on you system will made the installation process easier. To do this, simply run
.. code-block:: bash
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
You can test the installation by running `which composer` or `composer`: those command should not raise any error.
.. note::
See `the composer introduction`_ to learn how to install composer on Mac OS X and Windows
The docker database
"""""""""""""""""""
Install a database
""""""""""""""""""
Let's continue now by installing and configuring the docker database.
.. note::
If you do not want install a database with docker, you should create a postgresql database manually on your system, and add the extension ``UNACCENT``: ``CREATE EXTENSION "unaccent"``.
You will find all details concerning the installation of docker on their official site looking for your OS into the menu `Install/Docker Engine <http://docs.docker.com/>`_.
Once docker is installed, run :

View File

@ -1,114 +0,0 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
Very quick start with docker
#############################
.. _quick-start-with-docker:
We have created a `docker container <https://hub.docker.com/r/chill/demo-flavor/>`_ to let you test `Chill` easily.
.. note::
We assume docker is already installed on your machine. If Docker is not installed, have a look at `the install page in the docker documentation <https://docs.docker.com/>`_.
Starting the containers
========================
Mac OS X & docker
-----------------
To use docker on Mac OS X you need to use `boot2docker` or `docker-machine`
Configuration of `boot2docker`
``````````````````````````````
.. code-block:: bash
$ boot2docker start
$ boot2docker shellinit
Configuration of `docker-machine`
`````````````````````````````````
.. code-block:: bash
$ docker-machine start default
$ eval "$(docker-machine env default)"
Getting the last version of the docker images
----------------------------------------------
.. code-block:: bash
docker pull chill/database
docker pull chill/demo-flavor
Prepare a database
------------------
.. code-block:: bash
docker run --rm --name=chill_database chill/database
The first time you will run this command, the image will be downloaded from docker registry. Please be patient.
Run the container containing the code and attach it to the database
-------------------------------------------------------------------
.. code-block:: bash
docker run --rm --link chill_database:db -p 8989:8000 --name=chill_php chill/demo-flavor
The image will also be downloaded from docker registry on first run.
You can then browse on `http://localhost:8989 <http://localhost:8989>`_ and login with the created users, like `center a_social` (the complete list is below). Password is always 'password'. For Mac OS X, replace `localhost` by the IP of the docker VM (`boot2docker ip` or `docker-machine ip default`).
Stopping the containers
=======================
.. code-block:: bash
docker stop chill_php
docker stop chill_database
Limitations
============
* Those container should not be used in production
* The database should not be persisted or store persistant information: at each container startup, the container's data will be erased and replaced by new (partially) random fixtures
Users created
==============
The passwords are always `password` :
The user's login created are :
* center a_social
* center a_administrative
* center a_direction
* center b_social
* center b_administrative
* center b_direction
* multi_center
* admin
.. _the composer documentation: https://getcomposer.org/doc/
.. _the composer introduction: https://getcomposer.org/doc/00-intro.md
.. _the standard architecture: https://github.com/Champs-Libres/chill-standard
.. _composer: https://getcomposer.org
.. _Firefox: https://www.mozilla.org
.. _symfony framework: http://symfony.com
.. _*unaccent* extension: http://www.postgresql.org/docs/current/static/unaccent.html