You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mailu/setup
bors[bot] d1eab083f5
Merge #1831
1831: Fix roundcube database env configuration r=mergify[bot] a=parisni

## What type of PR?

bug-fix

## What does this PR do?

Both roundcube and mailu admin website can be backed by postgres/mysql. Before this PR, the `DB_FLAVOR` is shared by both services. However, the other roundcube dedicated DB params are prefixed with `ROUNDCUBE_`. (eg: `ROUNDCUBE_DB_NAME`)
There is no reason to share the DB_FLAVOR for both: This PR makes them be considered independently to make things clear and avoid bugs.
Also, the roundcube_db_flavor and db_flavor are made separated in this PR. However for simplicity, the template generator bind them : roundcube_db_flavor = db_flavor. This makes the template generator UI more simple. I considered most of the time people want to have both roundcube and mailu share the same RDBMS.

Also, AFAIK the internal postgresql service is deprecated and will be removed in 1.9. This is why this PR does not integrate roundcube in postgres when the internal DB is choosen: in case of internal postgres, the roundcube is backed with sqlite.

Both documentation and setup website have been updated accordingly.

### Related issue(s)
- Auto close an issue like: closes #1648 #1471

## Prerequistes
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [X] In case of feature or enhancement: documentation updated accordingly
- [X] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.


Co-authored-by: parisni <nicolas.paris@riseup.net>
Co-authored-by: Nicolas Paris <nicolas.paris@riseup.net>
3 years ago
..
flavors Merge #1831 3 years ago
static Update setup website 3 years ago
templates Fix typo 3 years ago
.env Revert accidental setup commits and fix code/pre tags 5 years ago
Dockerfile RPi: fix alpine version for setup, only one layer for pip install 5 years ago
README.md Create/generate file template 6 years ago
docker-compose.yml Revert accidental setup commits and fix code/pre tags 5 years ago
main.py Rename the config dir to setup 6 years ago
requirements.txt Prepare setup for multi-ver deployment on docs server 6 years ago
server.py When selecting a non-stable version, add a message this is version is "only for testing". 4 years ago

README.md

Adding more flavors/steps

(Everything will go under setup/ directory - using Kubernetes flavor as example)

Until this point, the app is working as it follows:

  • when accesing the setup page it will display the flavors selection step (templates/steps/flavor.html)
  • after you choose your desired flavor it will iterare over the files in the flavor directory and building the page (templates/steps/config.html is general for all flavors)
  • when you complete all required fields and press "Setup Mailu" button it will redirect you to the setup page (flavors/choosen-flavor/setup.html)

To add a new flavor you need to create a directory under templates/steps/ in which you are adding actual steps. Eg: Adding a WIP step we'll create templates/steps/kubernetes/wip.html

Note that wizard.html is iterating over files in this directory and building the page. Files are prefixed with a number for sorting purposes.

wip.html will start with

{% call macros.panel("info", "Step X - Work in progress") %}

and end with

{% endcall %}

You store variable from front-page using the name attribute inside tag. In the example below the string entered in the input field is stored in the variable named var_test

<input type="text" name="var_test">

In order to user the variable furter you use it like {{ var_test }}

In the setup page (flavors/kubernetes/setup.html) you cand add steps by importing macros

{% import "macros.html" as macros %}

and start and end every step with

{% call macros.panel("info", "Step X - Title") %}
-------------------
{% endcall %}

Generating a file

Create the file template in flavors/kubernetes/ (eg. file.txt) in which you save your variables

ROOT = {{ root }}
MY_VAR = {{ var_test }}

When you submit to Setup Mailu the file will be generated. In order to get the file add the following command to setup.html

<p>curl {{ url_for('.file', uid=uid, filepath='file.txt', _external=True) }} > file.txt</p>