Very first version of the configuration wizard

master
kaiyou 7 years ago
parent 31b887807a
commit efaa3058c0

@ -0,0 +1,36 @@
{% import "macros.html" as macros %}
{% call macros.panel("info", "Step 1 - Download your configuration files") %}
<p>Docker Compose expects a project file, named <code>docker-compose.yml</code>
in a project directory. First create your project directory.</p>
<pre><code>mkdir /path/to/project
</pre></code>
<p>Then download the project file. A side configuration file makes it easier
to read and check the configuration variables generated by the wizard.</p>
<pre><code>cd /path/to/project
wget https://...
wget https://...
</pre></code>
{% endcall %}
{% call macros.panel("info", "Step 2 - Review the configuration") %}
<p>We did not insert any malicious code on purpose in the configurations we
distribute, but your download could have been intercepted, or our wizard
website could have been compromised, so make sure you check the configuration
files before going any further.</p>
<p>When you are done checking them, check them one last time.</p>
{% endcall %}
{% call macros.panel("info", "Step 3 - Start the Compose project") %}
<p>To start your compose project, simply run the Docker Compose <code>up</code>
command.</p>
<pre><code>cd /path/to/project
docker-compose up -d
</pre></code>
{% endcall %}

@ -0,0 +1,3 @@
flask
flask-bootstrap
redis

@ -0,0 +1,35 @@
import flask
import flask_bootstrap
import redis
import os
import jinja2
app = flask.Flask(__name__)
flask_bootstrap.Bootstrap(app)
db = redis.StrictRedis(host='localhost', port=6379, db=0)
app.jinja_loader = jinja2.ChoiceLoader([
app.jinja_loader,
jinja2.FileSystemLoader("flavors"),
])
def render_flavor(flavor, template, **context):
path = os.path.join(flavor, template)
return flask.render_template(path, **context)
@app.route("/")
def index():
return flask.render_template('index.html')
@app.route("/setup", methods=["POST"])
def setup():
flavor = flask.request.form.get("flavor", "compose")
rendered = render_flavor(flavor, "setup.html")
return flask.render_template("setup.html", contents=rendered)
if __name__ == "__main__":
app.run(debug=True)

@ -0,0 +1,4 @@
{% extends "bootstrap/base.html" %}
{% import "macros.html" as macros %}
{% block title %}Mailu configuration{% endblock %}

@ -0,0 +1,22 @@
{% extends "base.html" %}
{% block content %}
<div class="container">
<h1>Mailu configuration - {{ branch }}</h1>
{% call macros.panel("warning", "Before starting, read the docs!") %}
Mailu is not perfectly documented, but still has a lot of documentation
available at <a href="https://mailu.io">mailu.io</a>. Make sure you read
the appropriate documentation for your setup and have all the requirements
ready when using this wizard.
{% endcall %}
<form method="post" action="{{ url_for(".setup") }}">
{% include "steps/flavor.html" %}
{% include "steps/expose.html" %}
<input class="btn btn-primary" type="submit" value="Setup Mailu">
</form>
</div>
{% endblock %}

@ -0,0 +1,22 @@
{% macro panel(style, title) %}
<div class="panel panel-{{ style }}">
<div class="panel-heading">
<h3 class="panel-title">{{ title }}</h3>
</div>
<div class="panel-body">
{{ caller() }}
</div>
</div>
{% endmacro %}
{% macro radio(name, value, emph, text) %}
<div class="radio">
<label>
<input type="radio" name="{{ name }}" value="{{ value }}">
{% if emph %}
<strong>{{ emph }}</strong>,
{% endif %}
{{ text }}
</label>
</div>
{% endmacro %}

@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block content %}
<div class="container">
<h1>Mailu configuration - {{ branch }}</h1>
{% call macros.panel("success", "Your configuration was generated") %}
<p>The following steps will guide you towards downloading and using your
configuration files. Keep in mind that you should review every downloaded
file before running anything based on it.</p>
<p>If you encounter issues while setting Mailu up, please review the
documentation first, then check if an issue is open for that specific
problem. If not, you may either use Github to open an issue and detail what
your problem or bug looks like, or join us on Matrix and discuss it
with contributors.</p>
{% endcall %}
{% autoescape false %}
{{ contents }}
{% endautoescape %}
</div>
{% endblock %}

@ -0,0 +1,25 @@
{% call macros.panel("info", "Step 2 - expose Mailu to the world") %}
<p>A mail server must be exposed to the world to receive emails, send emails,
and let users access their mailboxes. Mailu has some flexibility in the way
you expose it to the world.</p>
<p>Among Mailu services, the <em>front</em> server is the one accepting connections,
be it directly from the outside world, through a reverse proxy or in any
complex configuration that you might want to setup. It needs to listen on some
IP addresses in order to expose its public services. You must at least setup
an IPv4 or an IPv6 address if you wish to access Mailu.</p>
<p><span class="label label-warning">Warning</span> You must use specific addresses, please
avoid generic all-interfaces addresses like <em>0.0.0.0</em> or <em>::</em>.</p>
<div class="form-group">
<label>IPv4 listen address</label>
<input class="form-control" type="text" placeholder="1.2.3.4">
</div>
<div class="form-group">
<label>IPv6 listen address</label>
<input class="form-control" type="text" placeholder="1.2.3.4">
</div>
{% endcall %}

@ -0,0 +1,16 @@
{% call macros.panel("info", "Step 1 - pick a flavor") %}
<p>Mailu comes in multiple "flavors". It was originally
designed to run on top of Docker Compose but now offers multiple options
including Docker Stack, Rancher, Kubernetes.</p>
<p>Please note that "official" support, that is provided by the most active
developpers, will mostly cover Compose and Stack, while other flavors are
maintained by specific contributors.</p>
<div class="radio">
{{ macros.radio("flavor", "compose", "Compose", "simply using Docker Compose manager") }}
{{ macros.radio("flavor", "stack", "Stack", "using stack deployments in a Swarm cluster") }}
{{ macros.radio("flavor", "rancher", "Rancher", "on top of the Rancher container manager") }}
{{ macros.radio("flavor", "kubernetes", "Kubernetes", "on top of the Kubernetes container manager") }}
</div>
{% endcall %}
Loading…
Cancel
Save