From 0d164486b45b194de81905089b37a4557a828a8f Mon Sep 17 00:00:00 2001
From: Ionut Filip
Date: Tue, 16 Oct 2018 12:34:55 +0300
Subject: [PATCH] docker-compose variables and setup
---
setup/Dockerfile | 4 +++-
setup/docker-compose.yml | 1 +
setup/flavors/compose/docker-compose.yml | 2 +-
setup/flavors/compose/mailu.env | 8 ++++----
setup/flavors/compose/setup.html | 6 +++---
setup/server.py | 6 ++++--
setup/templates/steps/expose.html | 4 ++--
setup/templates/steps/root.html | 8 ++++++++
setup/templates/wizard.html | 1 +
9 files changed, 27 insertions(+), 13 deletions(-)
create mode 100644 setup/templates/steps/root.html
diff --git a/setup/Dockerfile b/setup/Dockerfile
index 1fc808f1..c970e57d 100644
--- a/setup/Dockerfile
+++ b/setup/Dockerfile
@@ -10,8 +10,10 @@ RUN apk add --no-cache git \
COPY server.py ./server.py
COPY setup.py ./setup.py
COPY main.py ./main.py
+COPY flavors /data/master/flavors
+COPY templates /data/master/templates
-RUN python setup.py https://github.com/mailu/mailu /data
+#RUN python setup.py https://github.com/mailu/mailu /data
EXPOSE 80/tcp
diff --git a/setup/docker-compose.yml b/setup/docker-compose.yml
index 9288bb7e..30966167 100644
--- a/setup/docker-compose.yml
+++ b/setup/docker-compose.yml
@@ -10,4 +10,5 @@ services:
image: mailu/setup
ports:
- "80:80"
+ build: .
diff --git a/setup/flavors/compose/docker-compose.yml b/setup/flavors/compose/docker-compose.yml
index a82817af..3dcfa5a2 100644
--- a/setup/flavors/compose/docker-compose.yml
+++ b/setup/flavors/compose/docker-compose.yml
@@ -24,7 +24,7 @@ services:
ports:
{% for port in (80, 443, 25, 465, 587, 110, 995, 143, 993) %}
{% if bind4 %}
- - "{{ bind4}}:{{ port }}:{{ port }}"
+ - "{{ bind4 }}:{{ port }}:{{ port }}"
{% endif %}
{% if bind6 %}
- "{{ bind6 }}:{{ port }}:{{ port }}"
diff --git a/setup/flavors/compose/mailu.env b/setup/flavors/compose/mailu.env
index 2de771f3..1512e75b 100644
--- a/setup/flavors/compose/mailu.env
+++ b/setup/flavors/compose/mailu.env
@@ -10,15 +10,15 @@
# Set this to the path where Mailu data and configuration is stored
# This variable is now set directly in `docker-compose.yml by the setup utility
-# ROOT=/mailu
+# ROOT= {{ root }}
# Set to a randomly generated 16 bytes string
SECRET_KEY={{ secret(16) }}
# Address where listening ports should bind
# This variables are now set directly in `docker-compose.yml by the setup utility
-# PUBLIC_IPV4=127.0.0.1
-# PUBLIC_IPV6=::1
+# PUBLIC_IPV4= {{ bind4 }} (default: 127.0.0.1)
+# PUBLIC_IPV6= {{ bind6 }} (default: ::1)
# Mail address of the postmaster
POSTMASTER={{ postmaster }}
@@ -83,7 +83,7 @@ WEB_ADMIN={{ admin_path }}
WEB_WEBMAIL={{ webmail_path }}
# Website name
-SITENAME={{ site_name }{
+SITENAME={{ site_name }}
# Linked Website URL
WEBSITE={{ website }}
diff --git a/setup/flavors/compose/setup.html b/setup/flavors/compose/setup.html
index e4506e6d..3c190c9c 100644
--- a/setup/flavors/compose/setup.html
+++ b/setup/flavors/compose/setup.html
@@ -4,13 +4,13 @@
Docker Compose expects a project file, named docker-compose.yml
in a project directory. First create your project directory.
-mkdir /mailu
+mkdir {{ root }}
Then download the project file. A side configuration file makes it easier
to read and check the configuration variables generated by the wizard.
-cd /mailu
+cd {{ root }}
wget {{ url_for('.file', uid=uid, filepath='docker-compose.yml', _external=True) }}
wget {{ url_for('.file', uid=uid, filepath='mailu.env', _external=True) }}
@@ -30,7 +30,7 @@ files before going any further.
To start your compose project, simply run the Docker Compose up
command.
-cd /mailu
+cd {{ root }}
docker-compose up -d
{% endcall %}
diff --git a/setup/server.py b/setup/server.py
index 108f5043..ddeafd90 100644
--- a/setup/server.py
+++ b/setup/server.py
@@ -32,9 +32,11 @@ def secret(length=16):
def build_app(path):
+ #Hardcoded master as the only version for test purposes
versions = [
- version for version in os.listdir(path)
- if os.path.isdir(os.path.join(path, version))
+ # version for version in os.listdir(path)
+ # if os.path.isdir(os.path.join(path, version))
+ "master"
]
app.jinja_env.trim_blocks = True
diff --git a/setup/templates/steps/expose.html b/setup/templates/steps/expose.html
index 665b08a2..372ebddc 100644
--- a/setup/templates/steps/expose.html
+++ b/setup/templates/steps/expose.html
@@ -14,12 +14,12 @@ avoid generic all-interfaces addresses like 0.0.0.0
or ::
IPv4 listen address
-
+
IPv6 listen address
-
+
You server will be available under a main hostname but may expose multiple public
diff --git a/setup/templates/steps/root.html b/setup/templates/steps/root.html
new file mode 100644
index 00000000..f32c2250
--- /dev/null
+++ b/setup/templates/steps/root.html
@@ -0,0 +1,8 @@
+{% call macros.panel("info", "Step 0 - Set root path") %}
+
Before starting root path must be set
+
+
+ Root path:
+
+
+{% endcall %}
diff --git a/setup/templates/wizard.html b/setup/templates/wizard.html
index da9d5134..bbebe569 100644
--- a/setup/templates/wizard.html
+++ b/setup/templates/wizard.html
@@ -9,6 +9,7 @@
{% endcall %}