1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-12 10:45:38 +02:00
Mailu/setup
bors[bot] 4d58b322bc Merge #888 #889
888: Correct the URL users are directed to after using setup without exposing /admin r=mergify[bot] a=Nebukadneza

In setup, users who didn’t expose `/admin` were directed to `http://127.0.0.1:8080/`, which was missing `/ui` to work.

Also, let’s help out the less apt admins by providing a copy-paste template for ssh-tunnelling.

## What type of PR?
documentation

### Related issue(s)
closes #885

## Prerequistes
- [x] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: place entry in the [changelog](CHANGELOG.md), under the latest un-released version.


889: Catch webmail-url empty but webmail configured and force to default r=mergify[bot] a=Nebukadneza

## What type of PR?
bug-fix

## What does this PR do?
Quite some users managed to delete the contents of the webmail-url field in
setup, which forces front into a restart loop. Catch the case where a webmail
service is configured, but url is empty — and force to default /webmail.

### Related issue(s)
closes #856

## Prerequistes
- [x] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: place entry in the [changelog](CHANGELOG.md), under the latest un-released version.


Co-authored-by: Dario Ernst <dario@kanojo.de>
2019-01-29 13:57:14 +00:00
..
flavors Merge #888 #889 2019-01-29 13:57:14 +00:00
static Update setup utility with mysql db flavor 2019-01-10 15:44:02 +02:00
templates Merge pull request #843 from usrpro/fix-unbound-swarm 2019-01-18 12:31:09 +02:00
.env Revert accidental setup commits and fix code/pre tags 2019-01-28 20:23:41 +01:00
docker-compose.yml Revert accidental setup commits and fix code/pre tags 2019-01-28 20:23:41 +01:00
Dockerfile Disable healthcheck, doen't work in versioned env 2018-12-16 23:14:36 +02:00
main.py Rename the config dir to setup 2018-04-22 16:10:25 +02:00
README.md Create/generate file template 2018-10-22 12:53:25 +03:00
requirements.txt Prepare setup for multi-ver deployment on docs server 2018-12-16 16:26:45 +02:00
server.py Make docker-compose.yml for setup and docs development friendly 2019-01-16 20:50:52 +02:00

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>