Postal: Build a new mail server

Created on 5 Nov 2020  ·  13Comments  ·  Source: postalhq/postal

hello, i have an issue when building a mail server, installation went good on Ubuntu 18 server, hosted at Digitalocean, but after creating organization, i can't build a mail server, the green button just keeps showing that it's loading, but nothing happens. Thanks for your time

support

All 13 comments

You can't use DO for postal because their port 25 is closed and they will not open.

I see, thank you for your answer, any company you suggest ?

It may be worth asking digital ocean if they will allow you to send emails before changing providers.

Regarding your initial problem, it sounds like you are encountering a server problem so you should have a look at your logs to see what it is.

It may be worth asking digital ocean if they will allow you to send emails before changing providers.

Regarding your initial problem, it sounds like you are encountering a server problem so you should have a look at your logs to see what it is.

thanks for your answer, can you point me to the logs i should check ?

They are in /opt/postal/log, for your error I think you'll need the rails one but I could be mistaken.

Hi, I am having the same problem and I am locally hosting the server. My port 25 is open and smtp is listening on it, however, I am still unable to build a new mail server. Any assistance will be greatly appreciated as I am new to this.

@Xando235 as per my previous message, you will need to look at your own log files to see what is going wrong

Just thought I'd chime in. I ran into the same issue, in my case the error was in /opt/postal/logs/rails.log

[web.1:32242] [2020-11-26T00:34:02.640] INFO -- : Started POST "/org/example/servers" for 127.0.0.1 at 2020-11-26 00:34:02 -0800
[web.1:32242] [2020-11-26T00:34:02.641] INFO -- : Processing by ServersController#create as JSON
[web.1:32242] [2020-11-26T00:34:02.641] INFO -- :   Parameters: {"utf8"=>"✓", "server"=>{"name"=>"Example Mail", "permalink"=>"", "mode"=>"Live"}, "commit"=>"Build server", "org_permalink"=>"example"}
[web.1:32242] [2020-11-26T00:34:02.659] INFO -- : Completed 500 Internal Server Error in 18ms (ActiveRecord: 8.8ms)
[web.1:32242] [2020-11-26T00:34:02.660] FATAL -- :
[web.1:32242] [2020-11-26T00:34:02.660] FATAL -- : Mysql2::Error::ConnectionError (Access denied for user 'postaluser'@'localhost' to database 'postal-server-3'):
[web.1:32242] [2020-11-26T00:34:02.660] FATAL -- :
[web.1:32242] [2020-11-26T00:34:02.660] FATAL -- : lib/postal/message_db/database.rb:319:in `query_on_connection'

I checked and my passwords in /opt/postal/config/postal.yml are correct, I have access to mysql with
mysql -u postaluser -p

Edit: It also fails when choosing development

lib/postal/message_db/database.rb:311:in `block in query'
lib/postal/message_db/mysql.rb:20:in `client'
lib/postal/message_db/database.rb:342:in `with_mysql'
lib/postal/message_db/database.rb:310:in `query'
lib/postal/message_db/provisioner.rb:46:in `drop'
lib/postal/message_db/provisioner.rb:13:in `provision'
app/models/server.rb:86:in `block in <class:Server>'
app/controllers/servers_controller.rb:36:in `create'
[web.1:32242] [2020-11-26T00:55:44.516] INFO -- : Started GET "/org/example/servers/new" for 127.0.0.1 at 2020-11-26 00:55:44 -0800
[web.1:32242] [2020-11-26T00:55:44.517] INFO -- : Processing by ServersController#new as HTML
[web.1:32242] [2020-11-26T00:55:44.517] INFO -- :   Parameters: {"org_permalink"=>"example"}
[web.1:32242] [2020-11-26T00:55:44.527] INFO -- :   Rendering servers/new.html.haml within layouts/application
[web.1:32242] [2020-11-26T00:55:44.528] INFO -- :   Rendered organizations/_nav.html.haml (0.7ms)
[web.1:32242] [2020-11-26T00:55:44.530] INFO -- :   Rendered servers/_form.html.haml (1.3ms)
[web.1:32242] [2020-11-26T00:55:44.530] INFO -- :   Rendered servers/new.html.haml within layouts/application (2.3ms)
[web.1:32242] [2020-11-26T00:55:44.531] INFO -- : Completed 200 OK in 15ms (Views: 4.0ms | ActiveRecord: 6.6ms)
[web.1:32242] [2020-11-26T00:55:50.410] INFO -- : Started POST "/org/example/servers" for 127.0.0.1 at 2020-11-26 00:55:50 -0800
[web.1:32242] [2020-11-26T00:55:50.411] INFO -- : Processing by ServersController#create as JSON
[web.1:32242] [2020-11-26T00:55:50.411] INFO -- :   Parameters: {"utf8"=>"✓", "server"=>{"name"=>"TEST", "permalink"=>"", "mode"=>"Development"}, "commit"=>"Build server", "org_permalink"=>"example"}
[web.1:32242] [2020-11-26T00:55:50.427] INFO -- : Completed 500 Internal Server Error in 16ms (ActiveRecord: 8.7ms)
[web.1:32242] [2020-11-26T00:55:50.428] FATAL -- :
[web.1:32242] [2020-11-26T00:55:50.428] FATAL -- : Mysql2::Error::ConnectionError (Access denied for user 'postaluser'@'localhost' to database 'postal-server-5'):
[web.1:32242] [2020-11-26T00:55:50.428] FATAL -- :
[web.1:32242] [2020-11-26T00:55:50.428] FATAL -- : lib/postal/message_db/database.rb:319:in `query_on_connection'

Edit2: stupid root error

Nov 26 01:14:58 example-db mysqld[6749]: 2020-11-26  1:14:58 0 [Note] /usr/sbin/mysqld (mysqld 10.3.25-MariaDB-0ubuntu0.20.04.1) starting as process 6749 ...
Nov 26 01:14:58 example-db mysqld[6749]: 2020-11-26  1:14:58 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32194)
Nov 26 01:14:58 example-db systemd[1]: Started MariaDB 10.3.25 database server.
Nov 26 01:14:58 example-db /etc/mysql/debian-start[6791]: Looking for 'mysql' as: /usr/bin/mysql
Nov 26 01:14:58 example-db /etc/mysql/debian-start[6791]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Nov 26 01:14:58 example-db /etc/mysql/debian-start[6791]: Version check failed. Got the following error when calling the 'mysql' command line client
Nov 26 01:14:58 example-db /etc/mysql/debian-start[6791]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Nov 26 01:14:58 example-db /etc/mysql/debian-start[6791]: FATAL ERROR: Upgrade failed
Nov 26 01:14:58 example-db /etc/mysql/debian-start[6801]: Checking for insecure root accounts.
Nov 26 01:14:58 example-db debian-start[6804]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

In the process of trying to fix this, the mysql/mariadb got borked. I'm doing a completely new install ☹️

I fixed the issue. First thing I did was fix the mysql issues.

Next I double-checked my postal config: there was an issue. I was following two tutorials, one had "postaluser" and one had "postal" so I had been using the wrong user for the database! 🤦

Anyways, once that was sorted out, I reinitialized postal and everything works!

Glad you figured it out, which tutorial were you following? The quick install script should make all this easier to get going with rather than following individual steps

The quick install script is for Ubuntu 16.04, I'm running Ubuntu 20.04. I also had modified the tutorial a bit, but from what I can tell it's essentially the one provided here on github that someone modified a bit.

The biggest difference with the way I did it was that I didn't need to add any external repositories for the install. I did have to specify a particular version of something for a ruby package

I'm going to try modifying the current script to make it work on any standard 20.04 install and submitting it with a feature request for 20.04 support.

I'm still working on the script, but I found something interesting:

Both of the following work:

echo 'GRANT ALL ON `'$postaluser'`.* TO `'$postaluser'`@`127.0.0.1` IDENTIFIED BY "'$passgen'";' | sudo mysql -u root
echo 'GRANT ALL ON `'$postaluser'`.* TO `'$postaluser'`@`localhost` IDENTIFIED BY "'$passgen'";' | sudo mysql -u root

but logging in does not when using 127.0.0.1

$ mysql -u postal@localhost -p
Enter password:
ERROR 1698 (28000): Access denied for user 'postal@localhost'@'localhost'
$ mysql -u [email protected] -p
Enter password:
ERROR 1698 (28000): Access denied for user '[email protected]'@'localhost'
$ mysql -u postal -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 112
Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

I adjusted the commands:

$ mysql -u 'postal'@'127.0.0.1' -p
Enter password:
ERROR 1698 (28000): Access denied for user '[email protected]'@'localhost'

This is what caused my troubles! According to one tutorial I was supposed to use 127.0.0.1 while according to another I needed to use localhost which are not the same, and attempts to log in would fail because it adds localhost for some reason to everything.

Continued --> Feature: Ubuntu 20.04 LTS support #1265

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harshweo picture harshweo  ·  6Comments

wassimseif picture wassimseif  ·  7Comments

fschndr picture fschndr  ·  6Comments

BlueHatbRit picture BlueHatbRit  ·  3Comments

ro78 picture ro78  ·  4Comments