mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
update installation process
This commit is contained in:
parent
c29a3e3d80
commit
58f2a9d5e1
@ -3,7 +3,7 @@
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||
.. Copyright (C) 2014-2019 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;
|
||||
@ -15,54 +15,246 @@ Installation
|
||||
#############
|
||||
|
||||
|
||||
Install with docker
|
||||
===================
|
||||
Requirements
|
||||
************
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
- This project use `docker <https://docker.com>`_ to be run. As a developer, use `docker-compose <https://docs.docker.com/compose/overview/>`_ to bootstrap a dev environment in a glance. You do not need any other dependencies ;
|
||||
- Make is used to automate scripts.
|
||||
|
||||
Install with docker <install_with_docker.rst>
|
||||
Installation in development mode
|
||||
*******************************
|
||||
|
||||
Usage in production
|
||||
====================
|
||||
Get the code
|
||||
============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
Clone or download the chill-standard project and `cd` into the main directory.
|
||||
|
||||
Installation in production <install_production_webserver.rst>
|
||||
|
||||
Installation without docker
|
||||
===========================
|
||||
.. code-block:: bash
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
git clone https://framasoft.org/Chill-project/Chill-Standard.git
|
||||
cd Chill-Standard
|
||||
|
||||
Common installation <installation_without_docker.rst>
|
||||
|
||||
Update Chill and maintenance
|
||||
==============================
|
||||
|
||||
.. toctree::
|
||||
:titlesonly:
|
||||
As a developer, the code will stay on your computer and will be executed in docker container. To avoid permission problem, the code should be run with the same uid/gid from your current user. This is why we get your current user id with the command ``id -u`` in each following scripts.
|
||||
|
||||
Update Chill <update_chill.rst>
|
||||
Add bundles to your installation <install_additional_bundles.rst>
|
||||
Uninstall Chill <uninstall_chill.rst>
|
||||
Prepare your variables
|
||||
======================
|
||||
|
||||
Database preparation
|
||||
Have a look at the variable in ``env.dist`` and in ``app/config/parameters.yml.dist`` and check if you need to adapt them. If they do not adapt with your need, or if some are missing:
|
||||
|
||||
1. copy the file as ``.env``: ``cp env.dist .env``
|
||||
2. replace the variable inside ``.env``
|
||||
3. copy the file ``parameters.yml.dist``: ``cp app/config/parameters.yml.dist app/config/parameters``
|
||||
4. replace eventually the variable inside this file
|
||||
|
||||
**Note**: If you intend to use the bundle ``Chill-Doc-Store``, you will need to configure and install an openstack object storage container with temporary url middleware. You will have to configure `secret keys <https://docs.openstack.org/swift/latest/api/temporary_url_middleware.html#secret-keys>`_.
|
||||
|
||||
Run the bootstrap script
|
||||
========================
|
||||
|
||||
This script can be run using `make`
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make init
|
||||
|
||||
This script will :
|
||||
|
||||
1. force docker-compose to, eventually, pull the base images and build the image used by this project ;
|
||||
2. run an install script to download `composer <https://getcomposer.org>`_ ;
|
||||
3. install the php dependencies
|
||||
|
||||
Build assets
|
||||
============
|
||||
|
||||
run those commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make build-assets
|
||||
|
||||
Start the project
|
||||
=================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose up
|
||||
|
||||
**On the first run** (and after each upgrade), you must execute *post update commands* and run database migrations. With a container up and running, execute the following commands:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose exec --user $(id -u) php app/console doctrine:migrations:migrate
|
||||
|
||||
Chill will be available at ``http://localhost:8001.`` Currently, there isn't any user or data. To add fixtures, run
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker-compose exec --user $(id -u) php app/console doctrine:fixtures:load
|
||||
|
||||
There are several users available:
|
||||
|
||||
- ``center a_social``
|
||||
- ``center b_social``
|
||||
|
||||
The password is always ``password``.
|
||||
|
||||
Now, read the how-tos.
|
||||
|
||||
Operations
|
||||
**********
|
||||
|
||||
How to execute the console ?
|
||||
============================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php app/console
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php app/console
|
||||
|
||||
How to create the database schema (= run migrations) ?
|
||||
======================================================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php app/console doctrine:migrations:migrate
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php app/console doctrine:migrations:migrate
|
||||
|
||||
|
||||
How to read the email sent by the program ?
|
||||
===========================================
|
||||
|
||||
Go at ``http://localhost:8005`` and you should have access to mailcatcher.
|
||||
|
||||
In case of you should click on a link in the email, be aware that you should remove the "s" from https.
|
||||
|
||||
How to load fixtures ? (development mode only)
|
||||
==============================================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php app/console doctrine:fixtures:load
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php app/console doctrine:fixtures:load
|
||||
|
||||
How to open a terminal in the project
|
||||
=====================================
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php /bin/bash
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php /bin/bash
|
||||
|
||||
How to run composer ?
|
||||
=====================
|
||||
|
||||
.. toctree::
|
||||
:titlesonly:
|
||||
.. code-block:: bash
|
||||
|
||||
Install a PosgresSql server <install_postgres_server.rst>
|
||||
Install production webserver <install_production_webserver.rst>
|
||||
# if a container is running
|
||||
docker-compose exec --user $(id -u) php ./composer.phar
|
||||
# if not
|
||||
docker-compose run --user $(id -u) php ./composer.phar
|
||||
|
||||
How to access to PGADMIN ?
|
||||
==========================
|
||||
|
||||
Pgadmin is installed with docker-compose.
|
||||
|
||||
You can access it at ``http://localhost:8002``.
|
||||
|
||||
Credentials:
|
||||
|
||||
- login: admin@chill.social
|
||||
- password: password
|
||||
|
||||
How to run tests ?
|
||||
==================
|
||||
|
||||
Tests reside inside the installed bundles. You must `cd` into that directory, download the required packages, and execute them from this place.
|
||||
|
||||
**Note**: some bundle require the fixture to be executed. See the dedicated _how-tos_.
|
||||
|
||||
Exemple, for running test inside `main` bundle:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# mount into the php image
|
||||
docker-compose run --user $(id -u) php /bin/bash
|
||||
# cd into main directory
|
||||
cd vendor/chill-project/main
|
||||
# download deps
|
||||
php ../../../composer.phar install
|
||||
# run tests
|
||||
/vendor/bin/phpunit
|
||||
|
||||
How to run webpack interactively
|
||||
================================
|
||||
|
||||
Executing :code:`bash docker-node.sh` will open a terminal in a node container, with volumes mounted.
|
||||
|
||||
Build the documentation API
|
||||
===========================
|
||||
|
||||
A basic configuration of `sami <https://github.com/FriendsOfPhp/Sami>`_ is embedded within the project.
|
||||
|
||||
A configuration file for `phpDocumentor <https://www.phpdoc.org>`_ is present.
|
||||
|
||||
Error `An exception has been thrown during the rendering of a template ("Asset manifest file "/var/www/app/web/build/manifest.json" does not exist.").` on first run
|
||||
====================================================================================================================================================================
|
||||
|
||||
Run :code:`make build-assets`
|
||||
|
||||
Running in production
|
||||
*********************
|
||||
|
||||
Currently, to run this software in production, the *state of the art* is the following :
|
||||
|
||||
1. Run the software locally and tweak the configuration to your needs ;
|
||||
2. Build the image and store them into a private container registry. This can be done using :code:`make build-and-push-image`.
|
||||
|
||||
To be sure to target the correct container registry, you have to adapt the values ``IMAGE_NGINX`` and ``IMAGE_PHP`` date in the ``.env`` file.
|
||||
3. Run the image on your production server, using docker-compose or eventually docker stack. You have to customize the variable set in docker-compose.
|
||||
|
||||
See also the :ref:`running-production-tips-and-tricks` below.
|
||||
|
||||
.. warning::
|
||||
|
||||
In production, you **must** set those variables:
|
||||
|
||||
* ``APP_ENV`` to ``prod``
|
||||
* ``APP_DEBUG`` to ``false``
|
||||
|
||||
There are security issues if you keep the same variable than for production.
|
||||
|
||||
|
||||
.. todo::
|
||||
.. _running-production-tips-and-tricks:
|
||||
|
||||
We should write a section on "how to update your installation".
|
||||
Tips and tricks
|
||||
===============
|
||||
|
||||
.. todo::
|
||||
Operation on database (backups, running custom sql, replication) are easier to set when run outside of a container. If you run into a container, take care of the volume where data are stored.
|
||||
|
||||
The PHP sessions are stored inside redis. This is useful if you distribute the traffic amongst different php server: they will share same sessions if a request goes into a different instance of the container.
|
||||
|
||||
When the PHP servers are shared across multiple instances, take care that some data is stored into redis: the same redis server should be reachable by all instances.
|
||||
|
||||
It is worth having an eye on the configuration of logstash container.
|
||||
|
||||
|
||||
Design principles
|
||||
*****************
|
||||
|
||||
Why the DB URL is set in environment, and not in parameters.yml ?
|
||||
=================================================================
|
||||
|
||||
Because, at startup, a script does check the db is up and, if not, wait for a couple of seconds before running ``entrypoint.sh``. For avoiding double configuration, the configuration of the PHP app takes his configuration from environment also (and it will be standard in future releases, with symfony 4.0).
|
||||
|
||||
We should write a section on "what are the concepts of chill" and explain what is a bundle, why we should install it, how to find them, ...
|
||||
|
@ -1,50 +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".
|
||||
|
||||
.. _install-additional-bundles:
|
||||
|
||||
Install additional bundles
|
||||
##########################
|
||||
|
||||
A basic installation of Chill include four bundles:
|
||||
|
||||
- :ref:`main-bundle`
|
||||
- :ref:`person-bundle`
|
||||
- :ref:`report-bundle`
|
||||
- :ref:`custom-fields-bundle`
|
||||
|
||||
but you can add as many as needed by your project, and if the bundle does not exists yet, you can create a new one, see :ref:`create-new-bundle` .
|
||||
|
||||
In Chill you are free to do what is most suitable for your activity, so let's go into details on how to add an existing bundle.
|
||||
|
||||
We will add the bundle 'icpc2' that set `icpc code <https://en.wikipedia.org/wiki/International_Classification_of_Primary_Care>`_ available as custom field.
|
||||
|
||||
.. todo::
|
||||
Add description of the bundle
|
||||
|
||||
Open your terminal let composer do the magic for you:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd path/to/your/directory
|
||||
composer require chill-main/icpc2
|
||||
|
||||
As composer ends its task, it could notify you that `Some migration files have been imported.
|
||||
In this case You should run `php app/console doctrine:migrations:status` and/or `php app/console doctrine:migrations:migrate` to apply them to your DB.`
|
||||
|
||||
So just do it:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console doctrine:migrations:migrate
|
||||
|
||||
.. note::
|
||||
The following has to be automated:
|
||||
|
||||
Finally we should modify the AppKernel.php file adding `new Chill\\Icpc2Bundle\\ChillIcpc2Bundle(),` in the $bundle array as described `in the symfony documentation <http://symfony.com/doc/current/cookbook/bundles/installation.html#b-enable-the-bundle>`_.
|
||||
|
@ -1,74 +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".
|
||||
|
||||
.. _install-postgres-server:
|
||||
|
||||
Install PostgresSql server
|
||||
##########################
|
||||
|
||||
On a linux environment, installing Postgresql server is very easy.
|
||||
Here follows the instructions for a debian based distribution (as Ubuntu) using the distribution repositories.
|
||||
To have the latest version follow the instructions of the `Postgresql wiki`_.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install postgresql
|
||||
|
||||
|
||||
Having a look at the install messages, you will guess quickly which is the version installed.
|
||||
Anyway you can check this with the following code:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
psql --version
|
||||
>>> psql (PostgreSQL) 9.4.5
|
||||
|
||||
To be able to add the unaccent extension to your database,
|
||||
you will have to install the following package where x.x are the first 2 parts of the version,
|
||||
9.4 in this example.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install postgresql-contrib-x.x
|
||||
|
||||
You are ready to play with Postgressql.
|
||||
|
||||
.. note::
|
||||
|
||||
To avoid installation and configuration of a postgresql server, you may use `our docker image <https://registry.hub.docker.com/u/chill/database/>`_ to start and configure a database as decribed in the basic installation chapter.
|
||||
This solution can be used also in a production environment.
|
||||
|
||||
|
||||
Install PostresSql database
|
||||
###########################
|
||||
|
||||
Here follows as an example the instructions that has been used on Ubuntu 14.04 distribution to install the Chill database.
|
||||
Feel free to customize it following your preferences, but do not forget to enable the `unaccent` extension on your database.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo su
|
||||
su postgres
|
||||
# At the prompt of the following instruction, I have typed 'my_terrible_secret' as password
|
||||
createuser --pwprompt chill_user
|
||||
createdb -O chill_user chill_db
|
||||
psql -d chill_db -c "CREATE EXTENSION unaccent;"
|
||||
|
||||
When you will use composer to install Chill, you will have to provide some database information.
|
||||
If you follow this tutorial these will be:
|
||||
|
||||
- database_host: localhost
|
||||
- database_port: 5432
|
||||
- database_name: chill_db
|
||||
- database_user: chill_user
|
||||
- database_password: my_terrible_secret
|
||||
- locale: en
|
||||
|
||||
|
||||
.. _Postgresql wiki: https://wiki.postgresql.org/wiki/Apt
|
@ -1,27 +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".
|
||||
|
||||
.. _install-production-webserver:
|
||||
|
||||
Install production webserver
|
||||
############################
|
||||
|
||||
.. todo::
|
||||
|
||||
the section "Install production webserver" must be written. Help appreciated :-)
|
||||
|
||||
.. warning::
|
||||
|
||||
Some sensitive data (like the person data, ...) might be logged in a special channel, called ``chill``.
|
||||
|
||||
This channel will log events like items removed by a user, what where the details of this item, who removed it, ...
|
||||
|
||||
You should take care of encrypting or discarding those data if required.
|
||||
|
||||
For an how-to of how to encrypt those data, you may consult `the appropriate section of the symfony documentation <http://symfony.com/doc/current/cookbook/logging/monolog.html#handlers-and-channels-writing-logs-to-different-locations>`_
|
||||
|
@ -1,80 +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".
|
||||
|
||||
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
|
@ -1,245 +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".
|
||||
|
||||
|
||||
Install chill without docker
|
||||
############################
|
||||
|
||||
|
||||
Basic installation
|
||||
``````````````````
|
||||
|
||||
Chill is written in PHP and use the `symfony framework`_. We take advantages of all the framework's feature, and installation should be as simple as installing symfony.
|
||||
|
||||
We are going to describe a basic installation on Unix systems (Unix, Mac OS). Windows installation has not been tested.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Client requirements
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Chill is accessible through a web browser. Currently, we focus our support on `Firefox`_, because firefox is open source, cross-platform, and very well active. The software should work with other browser (Chromium, Opera, ...) but some functionalities might break.
|
||||
|
||||
Server requirements
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
* a postgresql database, with the `*unaccent* extension`_ enabled. The minimum version is postgresql 9.4. You can use `the docker image provided <https://registry.hub.docker.com/u/chill/database/>`_. Using the docker image is also a solution for production site. Alternatively you can install a PosgresSql server see :ref:`install-postgres-server`.
|
||||
* PHP version >= 5.5. Check that extensions php5-intl and php5-pgsql are installed and that '*date.timezone*' is correctly defined in your php.ini.
|
||||
* Composer.
|
||||
* If you run Chill in production mode, you should also install a web server (apache, ngnix, ...) see :ref:`install-production-webserver`. For this basic installation meant for testing and/or development, we will make it simplier using the php built-in server.
|
||||
|
||||
Let's start by installing composer as it is needed to create and update our Chill project.
|
||||
|
||||
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, according to the instructions here : https://getcomposer.org/download
|
||||
|
||||
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 :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo docker run -P --name=chill_db chill/database
|
||||
|
||||
This will download the chill/database image and start a new docker instance with the name `chill_db` and export the postgresql port `5432` on another random local port.
|
||||
|
||||
The db will start in your terminal. In another terminal, you can check if the docker database is running and showing the exposed port with the following command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo docker ps
|
||||
|
||||
>>>> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
>>>> 08bbb62bd5e8 chill/database "/docker-entrypoint. 6 days ago Up 5 hours 0.0.0.0:32768->5432/tcp chill_db
|
||||
|
||||
You can start the container it via:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo docker start chill_db
|
||||
>>>> chill_db
|
||||
|
||||
.. note:: The commande to stop the docker container is:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo docker stop chill_db
|
||||
>>>> chill_db
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Chill is installed with `composer`_.
|
||||
|
||||
.. _preparation:
|
||||
|
||||
Preparation
|
||||
^^^^^^^^^^^
|
||||
|
||||
Before creating your project, make sure that you know the following information :
|
||||
|
||||
* how to access to your database: host, port, database name, and your credentials (username and password) ;
|
||||
* a random string, which will be used to improve entropy in security. Choose anything you want (random character, your father's birthplace, ...).
|
||||
|
||||
.. note::
|
||||
|
||||
**If you have installed the docker database:**
|
||||
|
||||
Open a terminal and run
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo docker port chill_db 5432
|
||||
|
||||
This command will show on which port the docker container is listening, on your localhost.
|
||||
This is the value to be used to fill the field 'database_port' hereafter.
|
||||
|
||||
Your information should be:
|
||||
|
||||
- database_host: 127.0.0.1
|
||||
- database_port: result of the command hereabove.
|
||||
- database_name: postgres
|
||||
- database_user: postgres
|
||||
- database_password: postgres
|
||||
- locale: fr
|
||||
|
||||
.. _create-your-project:
|
||||
|
||||
Create your project
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Create your Chill project using composer:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
composer create-project chill-project/standard path/to/your/directory ~1.0
|
||||
|
||||
|
||||
Composer will download `the standard architecture`_ and ask you a few question about how to configure your project.
|
||||
|
||||
* `database_host` : your postgresql server's address
|
||||
* `database_port` : the port to reach your postgresql server
|
||||
* `database_name` : the name of your database
|
||||
* `database_user` : the username to reach your database
|
||||
* `database_password` : your username's password
|
||||
* `locale`: the language, as iso code. Until now, only fr is supported
|
||||
* `secret`: the secret string you prepared (see :ref:`preparation`)
|
||||
|
||||
You may accept the default parameters of `debug_toolbar`, `debug_redirects` and `use_assetic_controller` for a demonstration installation.
|
||||
For production, set them all to `false`.
|
||||
|
||||
.. note::
|
||||
|
||||
If composer ask you the following question : ::
|
||||
|
||||
Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]?
|
||||
|
||||
You may answer `Y` (Yes), or simply press the `return` button.
|
||||
|
||||
.. note::
|
||||
|
||||
At the end of the installation, composer will warn you to execute database migration script, with this message : ::
|
||||
|
||||
Some migration files have been imported. You should run
|
||||
`php app/console doctrine:migrations:status` and/or
|
||||
`php app/console doctrine:migrations:migrate` to apply them to your DB.
|
||||
|
||||
We will proceed this step a bit later. See :ref:`create-database-schema`.
|
||||
|
||||
Check your requirements
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Move your cursor to the new directory
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd path/to/your/directory
|
||||
|
||||
You should check your installation by running
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/check.php
|
||||
|
||||
Which will give you information about how your installation fullfill the requirements to running Chill, and give you advices to optimize your installation.
|
||||
|
||||
|
||||
.. _create-database-schema:
|
||||
|
||||
Create your database schema
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This step will create your table and minimum information into your database. Simply run
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console doctrine:migrations:migrate
|
||||
|
||||
SQL queries will be printed into your console.
|
||||
|
||||
|
||||
Populate your database with basic information
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Once your database schema is ready, if you want to test the application you have the opportunity to populate your database with some basic data.
|
||||
Those are provided through a script and might depends from the bundle you choose to install (see :ref:`install-additional-bundles`).
|
||||
**This script has not to be launched for a production server** and will erase any existing data. It is meant only for testing the application.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console doctrine:fixtures:load
|
||||
|
||||
Preparing assets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
You have to dump assets into the web directory. Even if the command should be run by Composer, you may run it manually :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console assetic:dump
|
||||
php app/console assets:install
|
||||
|
||||
|
||||
Launch your server
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
If everything was fine, you are able to launch your built-in server :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
php app/console server:run
|
||||
|
||||
Your server should now be available at `http://localhost:8000`. Type this address on your browser and you should see the homepage.
|
||||
The default login is 'center a_social' with password 'password'.
|
||||
|
||||
Have fun exploring Chill.
|
||||
|
||||
|
||||
.. _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
|
@ -1,71 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +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".
|
||||
|
||||
.. _uninstall-chill:
|
||||
|
||||
Uninstall Chill
|
||||
```````````````
|
||||
|
||||
.. todo::
|
||||
|
||||
the section "Uninstall Chill" must be written. Help appreciated :-)
|
||||
|
||||
.. _uninstall-docker-database:
|
||||
|
||||
Uninstall the docker database
|
||||
-----------------------------
|
||||
|
||||
.. todo::
|
||||
|
||||
the section "Uninstall the docker database" must be written. Help appreciated :-)
|
||||
|
||||
.. _uninstall-application:
|
||||
|
||||
Uninstall the application
|
||||
-------------------------
|
||||
|
||||
.. todo::
|
||||
|
||||
the section "Uninstall the application" must be written. Help appreciated :-)
|
@ -1,48 +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".
|
||||
|
||||
.. _update-chill:
|
||||
|
||||
Update Chill
|
||||
############
|
||||
|
||||
Updating the application is very simple, thanks to the use of composer.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd path/to/your/directory
|
||||
|
||||
composer update
|
||||
|
||||
Composer allow to control strictly the versions to be used in the application.
|
||||
This allow to manage a production server, a staging one and a developpement one.
|
||||
|
||||
For the production one, define very precisely the versions of each component in the `composer.json` file at the root of the application and require only `stable` versions.
|
||||
In this situation even if an update of composer is launched, the sources will not be modified.
|
||||
|
||||
For the staging and development one, let open choices to the versions or accept development versions and using `composer update` will automatically update the selected modules.
|
||||
Once validated at staging level they can be sent in production re-precising the latest accepted versions.
|
||||
|
||||
|
||||
.. note::
|
||||
It is advisable to keep the version of composer up to date. To do that, just launch the following command in a terminal.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
composer self-update
|
||||
|
||||
If this update create troubles (which doesn't happen often) you can always undo this update running:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
composer self-update --rollback
|
||||
|
||||
See the `the composer documentation`_ for all details.
|
||||
|
||||
|
||||
.. _the composer documentation: https://getcomposer.org/doc/
|
Loading…
x
Reference in New Issue
Block a user