Skip to content
Snippets Groups Projects
Commit 839bbbca authored by Jan Mach's avatar Jan Mach
Browse files

Better integration of Sendria tool.

(Redmine issue: #7041)
parent eda6fbee
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ CURRENT_DIR = $(shell pwd)
DEV_SERVER = localhost
DEV_PORT = 5000
DEV_MAIL_SERVER = localhost
DEV_MAIL_PORT = 8025
DEV_MAIL_PORT = 1025
#
# Include common makefile configurations.
......@@ -345,13 +345,9 @@ deps-postgresql: FORCE
run-webui-dev:
@echo "\n$(GREEN)*** Running development web server with development configuration on $(DEV_SERVER):$(DEV_PORT) ***$(NC)\n"
FLASK_ENV=development FLASK_CONFIG=development HAWAT_CONFIG_FILE=$(shell realpath ./conf/mentat-hawat-dev.py.conf) hawat-cli run --host "0.0.0.0" --port $(DEV_PORT)
FLASK_ENV=development HAWAT_CONFIG_FILE=$(shell realpath ./conf/mentat-hawat-dev.py.conf) hawat-cli run --host "0.0.0.0" --port $(DEV_PORT)
run-mailserver-sendria:
@echo "\n$(GREEN)*** Running development mail server Sendria on $(DEV_MAIL_SERVER):$(DEV_MAIL_PORT) ***$(NC)\n"
sendria --db /var/mentat/sendria.db --smtp-ip $(DEV_MAIL_SERVER) --smtp-port $(DEV_MAIL_PORT) --http-ip 0.0.0.0 --http-port 1080 --pidfile /var/mentat/run/sendria.pid --log-file /var/mentat/log/sendria.log
run-mailserver-python:
run-mailserver-dev:
@echo "\n$(GREEN)*** Running development mail server on $(DEV_MAIL_SERVER):$(DEV_MAIL_PORT) ***$(NC)\n"
$(PYTHON) -m smtpd -n -c DebuggingServer $(DEV_MAIL_SERVER):$(DEV_MAIL_PORT)
......
......@@ -32,7 +32,7 @@ HAWAT_LIMIT_AODS = 20
HAWAT_SEARCH_QUERY_QUOTA = 7
MAIL_SERVER = 'localhost'
MAIL_PORT = 8025
MAIL_PORT = 1025
MAIL_DEFAULT_SENDER = 'mentat@cesnet.cz'
HAWAT_LOG_DEFAULT_LEVEL = 'debug'
......
......@@ -651,7 +651,7 @@ and ready to work:
.. code-block:: shell
(venv) mentat@mentat-devel /vagrant $
(venv) !DEV! mentat@mentat-devel /vagrant $
Keep in mind following:
......@@ -661,7 +661,7 @@ Keep in mind following:
* Intended workflow is editing code in your favorite editor from outside of the box and running Mentat inside.
* To access web interface from your host machine navigate to `https://localhost:4443 <https://localhost:4443>`__.
* To access Flask`s development web interface from your host machine you must first launch it inside the guest box with ``make run-webui-dev`` and then navigate to `http://localhost:5000 <http://localhost:5000>`__.
* For your convenience during development you may use awesome `Sendria <https://github.com/msztolcman/sendria>`__ service to view emails being send. First launch it from guest box with ``make run-mailserver-sendria`` and then navigate from your host machine to `http://localhost:1080 <http://localhost:1080>`__.
* For your convenience during development you may use awesome `Sendria <https://github.com/msztolcman/sendria>`__ service to view emails being send. It can be controlled via Systemd and running on startup. Just navigate from your host machine to `http://localhost:1080 <http://localhost:1080>`__.
At this point you are all set to develop Mentat locally without cluttering your personal
workstation.
......
......@@ -4,8 +4,10 @@ After=network.target
[Service]
Type=simple
ExecStart=/var/mentat/venv/bin/python -m sendria --db /tmp/mails.sqlite --http-ip 0.0.0.0
ExecStart=/var/mentat/venv/bin/python -m sendria --db /var/mentat/sendria.db --smtp-ip 127.0.0.1 --smtp-port 1025 --http-ip 0.0.0.0 --http-port 1080 --pidfile /var/run/sendria.pid --log-file /var/log/sendria.log
Restart=always
User=mentat
Group=mentat
[Install]
WantedBy=multi-user.target
......@@ -37,7 +37,7 @@ def _config_testapp_hawat(app_config):
app_config['LOG_FILE'] = '/var/tmp/mentat-hawat-utest.log'
app_config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://mentat:mentat@localhost/mentat_utest'
app_config['MAIL_SERVER'] = 'localhost'
app_config['MAIL_PORT'] = 8025
app_config['MAIL_PORT'] = 1025
app_config['MAIL_DEFAULT_SENDER'] = 'root@unittest'
app_config['EMAIL_ADMINS'] = ['admin@unittest']
app_config['MODELS'] = {
......
......@@ -33,7 +33,7 @@ def _config_testapp_vial(app_config):
app_config['LOG_FILE'] = '/var/tmp/vial-utest.log'
app_config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://mentat:mentat@localhost/mentat_utest'
app_config['MAIL_SERVER'] = 'localhost'
app_config['MAIL_PORT'] = 8025
app_config['MAIL_PORT'] = 1025
app_config['MAIL_DEFAULT_SENDER'] = 'root@unittest'
app_config['EMAIL_ADMINS'] = ['admin@unittest']
app_config['MODELS'] = {
......
......@@ -63,14 +63,14 @@ if [ "$color_prompt" = yes ]; then
# export GIT_PS1_SHOWUPSTREAM="auto verbose"
if [[ ${EUID} == 0 ]] ; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
PS1='\[\033[01;34m\]!DEV!\[\033[00m\] ${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;34m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;33m\]$(__git_ps1 " [%s]")\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
PS1='\[\033[01;34m\]!DEV!\[\033[00m\] ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;33m\]$(__git_ps1 " [%s]")\[\033[00m\]\$ '
fi
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h \w \$ '
PS1='!DEV! ${debian_chroot:+($debian_chroot)}\u@\h \w \$ '
fi
unset color_prompt force_color_prompt
......
......@@ -129,7 +129,7 @@ if [ ! -f /etc/mentat/install.pip ] ; then
echo '--editable "/vagrant/"' > /etc/mentat/install.pip
fi
echo "==========> Preparing Python development environment"
echo "==========> Preparing Python virtual environment"
cd /vagrant/ && make venv
source ${MENTAT_VENV}/bin/activate
......@@ -141,8 +141,13 @@ ensure_link /vagrant/vagrantenv/postfix.main.cf /etc/postfix/main.cf
systemctl restart postfix.service
ensure_link /vagrant/etc/systemd/system/sendria.service /etc/systemd/system/sendria.service
mkdir /var/sendria
chown mentat:mentat /var/sendria
touch /var/log/sendria.log
chown -R mentat:mentat /var/log/sendria.log
systemctl daemon-reload
systemctl start sendria.service
systemctl enable sendria.service
echo "==========> Bootstraping runtime environment"
/etc/mentat/scripts/init-runenv.sh
......
......@@ -25,5 +25,4 @@ echo ""
echo " Launching:"
echo " mentat-controller.py --command start # Mentat backend system"
echo " make run-webui-dev # Mentat web interface (5000)"
echo " make run-mailserver-sendria # Sendria mailer service (1080)"
echo ""
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment