Use generate-config command in install doc

Also follow the new working defaults of templates for socket and db path.
This commit is contained in:
Jocelyn Delalande 2017-10-23 10:00:46 +02:00
parent e4074ccadd
commit 27fc0dcb92
2 changed files with 48 additions and 22 deletions

View file

@ -17,6 +17,7 @@ Changed
======= =======
- Logged admin can see any project (#262) - Logged admin can see any project (#262)
- Better install doc (#275)
Added Added
===== =====

View file

@ -57,28 +57,56 @@ Now, if you want to deploy it on your own server, you have many options.
Two of them are documented at the moment. Two of them are documented at the moment.
*Of course, if you want to contribute another configuration, feel free to open a *Of course, if you want to contribute another configuration, feel free to open a
pull-request against this repository!*. pull-request against this repository!*
Whatever your installation option is…
--------------------------------------
1. Initialize the ihatemoney directories::
mkdir /etc/ihatemoney /var/lib/ihatemoney
2. Generate settings::
ihatemoney generate-config ihatemoney.cfg > /etc/ihatemoney/ihatemoney.cfg
chmod 740 /etc/ihatemoney/ihatemoney.cfg
You probably want to adjust `/etc/ihatemoney/ihatemoney.cfg` contents, you may
do it later, see `Configuration`_.
With Apache and mod_wsgi With Apache and mod_wsgi
------------------------ ------------------------
1. Install Apache and mod_wsgi - libapache2-mod-wsgi(-py3) for Debian based and mod_wsgi for RedHat based distributions - 1. Fix permissions (considering `www-data` is the user running apache)::
2. Create an Apache virtual host based on the sample configuration file in `conf/apache-vhost.conf`
3. Adapt it to your paths and specify your virtualenv path if you use one chgrp www-data /etc/ihatemoney/ihatemoney.cfg
chown www-data /var/lib/ihatemoney
2. Install Apache and mod_wsgi - libapache2-mod-wsgi(-py3) for Debian based and mod_wsgi for RedHat based distributions -
3. Create an Apache virtual host, the command ``ihatemoney generate-config apache-vhost.conf`` will output a good starting point (read and adapt it)
4. Activate the virtual host if needed and restart Apache 4. Activate the virtual host if needed and restart Apache
With Nginx, Gunicorn and Supervisord With Nginx, Gunicorn and Supervisord
------------------------------------ ------------------------------------
.. note:: For the 3 configuration files mentioned below, you will need to fix 1. Create a dedicated unix user (here called `ihatemoney`), required dirs, and fix permissions::
the paths to reflect yours.
1. Copy *conf/gunicorn.conf.py* to */etc/ihatemoney/gunicorn.conf.py* useradd ihatemoney
2. Copy *conf/supervisord.conf* to */etc/supervisor/conf.d/ihatemoney.conf* chown ihatemoney /var/lib/ihatemoney/
3. Copy *conf/nginx.conf* with your nginx vhosts [#nginx-vhosts]_ chgrp ihatemoney /etc/ihatemoney/ihatemoney.cfg
4. Reload both nginx and supervisord. It should be working ;)
Don't forget to set the right permission for your files ! 2. Create gunicorn config file ::
ihatemoney generate-config gunicorn.conf.py > /etc/ihatemoney/gunicorn.conf.py
3. Create supervisor config file ::
ihatemoney generate-config supervisord.conf > /etc/supervisor/conf.d/ihatemoney.conf
4. Copy (and adapt) output of ``ihatemoney generate-config conf/nginx.conf`` with your nginx vhosts [#nginx-vhosts]_
5. Reload both nginx and supervisord. It should be working ;)
.. [#nginx-vhosts] typically, */etc/nginx/conf.d/* or .. [#nginx-vhosts] typically, */etc/nginx/conf.d/* or
*/etc/nginx/sites-available*, depending on your distribution. */etc/nginx/sites-available*, depending on your distribution.
@ -90,7 +118,8 @@ ihatemoney relies on a configuration file. If you run the application for the
first time, you will need to take a few moments to configure the application first time, you will need to take a few moments to configure the application
properly. properly.
.. warning:: You **must** customize the ``SECRET_KEY`` on a production installation. Defaults given here, are those for development mode. To know defaults on your
deployed instance, simply look at your *ihatemoney.cfg*.
+-------------------------------+---------------------------------+----------------------------------------------------------------------------------+ +-------------------------------+---------------------------------+----------------------------------------------------------------------------------+
| Setting name | Default | What does it do? | | Setting name | Default | What does it do? |
@ -99,7 +128,8 @@ properly.
| | | on the format used can be found on `the SQLAlchemy documentation | | | | on the format used can be found on `the SQLAlchemy documentation |
| | | <http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls>`_. | | | | <http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls>`_. |
+-------------------------------+---------------------------+----------------------------------------------------------------------------------------+ +-------------------------------+---------------------------+----------------------------------------------------------------------------------------+
| SECRET_KEY | ``tralala`` | The secret key used to encrypt the cookies. **This needs to be changed**. | | SECRET_KEY | ``tralala`` | The secret key used to encrypt the cookies. `ihatemoney conf-example ihatemoney.cfg` |
| | | sets it to something random, which is good. |
+-------------------------------+---------------------------+----------------------------------------------------------------------------------------+ +-------------------------------+---------------------------+----------------------------------------------------------------------------------------+
| MAIL_DEFAULT_SENDER | ``("Budget manager", | A python tuple describing the name and email adress to use when sending | | MAIL_DEFAULT_SENDER | ``("Budget manager", | A python tuple describing the name and email adress to use when sending |
| | "budget@notmyidea.org")`` | emails. | | | "budget@notmyidea.org")`` | emails. |
@ -122,16 +152,11 @@ properly.
| | | to ``"foo"``, it will be served from a "folder" (e.g: *http://domain.tld/foo*) | | | | to ``"foo"``, it will be served from a "folder" (e.g: *http://domain.tld/foo*) |
+-------------------------------+---------------------------+----------------------------------------------------------------------------------------+ +-------------------------------+---------------------------+----------------------------------------------------------------------------------------+
In a production environment Using an alternate settings path
--------------------------- --------------------------------
Make a copy of ``ihatemoney/default_settings.py`` and name it ``ihatemoney.cfg``. You can put your settings file where you want, and pass its path to the
Then adjust the settings to your needs and move this file to application using the ``IHATEMONEY_SETTINGS_FILE_PATH`` environment variable.
``/etc/ihatemoney/ihatemoney.cfg``.
This is the default path of the settings but you can also place it
elsewhere and pass the configuration file path to the application using
the IHATEMONEY_SETTINGS_FILE_PATH environment variable.
e.g.:: e.g.::