Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Questions wrt Listmonk #196

Closed
jackdanielux opened this issue Oct 2, 2020 · 23 comments
Closed

Basic Questions wrt Listmonk #196

jackdanielux opened this issue Oct 2, 2020 · 23 comments
Labels
good first issue Good for newcomers

Comments

@jackdanielux
Copy link

jackdanielux commented Oct 2, 2020

Creating a new issue as was asked for earlier :)
I am trying to send out a test mail from campaign screen, it says email sent but does not land in my mail (SES dashboard also says 0 emails sent). SMTP settings are done for the same region the destination email ID belongs to (Mumbai). listmonk dashboard also says 0 msg sent.

Few call outs:
I have only 1 SMTP setting enabled (single port) - Do I need to add SMTP settings for all 3 ports?
SES account is in sandbox (allows 200 emails to be sent) - can this be the reason?
msg rate x concurrency = email rate of SES

@jackdanielux
Copy link
Author

Sorted. This was because SES was in Sandbox. Now that it's up and running. Absolutely lovely - Just works out of the box. This is what FOSS should be like. Cheers.

@jackdanielux
Copy link
Author

jackdanielux commented Oct 4, 2020

Hi, I am out of Sandbox :)
Following questions:

  1. Only the opted-in members will receive emails if I send out to the entire opt-in list?
  2. Any special things to keep in mind while attempting SSL on server where listmonk is installed? Any suggestions or resources that can help with SSL on Postgres
  3. The alt-text of the image in opt-in confirmation mail comes as listmonk instead of the alt-text specified for logo, the image is correct, only the alt-text is incorrect. Anything that I am doing wrong?
  4. Clicking on unsubscribe twice without actually confirming it is unsubscribing the subscriber - is this intended behavior?

@jackdanielux jackdanielux reopened this Oct 4, 2020
@jackdanielux
Copy link
Author

@knadh @mr-karan I just installed nginx (for installing SSL) and ssl on domain and everything broke. Unable to reinstall listmonk as the error of ---- error connecting to DB: dial tcp x.x.x.x:5432: connect: connection refused

I have checked the postgres service running, it is running
I have disabled the firewall
I have entered verify-full in config file as well.

Can you guys help pls?

@mr-karan
Copy link
Collaborator

mr-karan commented Oct 5, 2020

dial tcp x.x.x.x:5432: connect: connection refused

This looks like x.x.x.x isn't 127.0.0.1 but some other hostname. What's the hostname entered in config.toml and what's the interface Postgres is listening on?

@jackdanielux
Copy link
Author

jackdanielux commented Oct 5, 2020 via email

@jackdanielux
Copy link
Author

[app]
# Interface and port where the app will run its webserver.
address = "x.x.x.x:9000"

# BasicAuth authentication for the admin dashboard. This will eventually
# be replaced with a better multi-user, role-based authentication system.
# IMPORTANT: Leave both values empty to disable authentication on admin
# only where an external authentication is already setup.
admin_username = "adminusername"
admin_password = "adminusernamepass"

Database.

[db]
host = "example.com"
port = 5432
user = "pgsqllmusername"
password = "pgsqllmusernamepass"
database = "pgsqllmdbname"
ssl_mode = "verify-full"

@mr-karan
Copy link
Collaborator

mr-karan commented Oct 5, 2020

Is your DB host at example.com ? It's really hard to debug if you redact error messages or configuration values. Please don't do that and post exact values and only if it's sensitive information you should redact.

@jackdanielux
Copy link
Author

Sorry, thought everyone was masking, so did that.

Here's the snapshot of the config file. With the same config file I was able to install and run listmonk without any problems. Problems started when I installed nginx+ssl, then restarted nginx and postgres. Post which I tried running ./listmonk (considering it was working fine without nginx/ssl) - it did not work. then tried installing, which resulted in the error highlighted below.

I have verified psql is running while installing listmonk.

[app]
# Interface and port where the app will run its webserver.
address = "139.59.57.6:9000"

# BasicAuth authentication for the admin dashboard. This will eventually
# be replaced with a better multi-user, role-based authentication system.
# IMPORTANT: Leave both values empty to disable authentication on admin
# only where an external authentication is already setup.
admin_username = "adminusername"
admin_password = "adminusernamepass"

Database.

[db]
host = "bulklane.com"
port = 5432
user = "pgsqllmusername"
password = "pgsqllmusernamepass"
database = "pgsqllmdbname"
ssl_mode = "verify-full"

Here's the error output :

./listmonk
2020/10/05 15:39:00 main.go:64: v0.7.0-alpha (0f055ea 2020-08-09T14:44:45Z)
2020/10/05 15:39:00 init.go:91: reading config: config.toml
2020/10/05 15:39:00 init.go:167: connecting to db: bulklane.com:5432/pgsqllmusername
2020/10/05 15:39:00 init.go:170: error connecting to DB: dial tcp 139.59.57.6:5432: connect: connection refused

If I change domain with 127.0.0.1 or localhost in config file, here's the error:
init.go:170: error connecting to DB: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs

@jackdanielux
Copy link
Author

jackdanielux commented Oct 5, 2020

I restarted everything - now all things are working fine (even SSL) - Listmonk is also working fine. It is just that, whenever (even post rebooting system) listmonk is running at the backend and when I try to do ./listmonk it gives the below error, just want to be sure - if this is really an error or can I ignore this?

@ubuntu-s-1vcpu-1gb-blr1-01:~/listmonk$ ./listmonk
2020/10/05 18:37:36 main.go:64: v0.7.0-alpha (0f055ea 2020-08-09T14:44:45Z)
2020/10/05 18:37:36 init.go:91: reading config: config.toml
2020/10/05 18:37:36 init.go:167: connecting to db: 127.0.0.1:5432/postgresuser
2020/10/05 18:37:36 init.go:360: media upload provider: filesystem
2020/10/05 18:37:37 init.go:318: loaded SMTP: username@smtp.yoursite.com
2020/10/05 18:37:37 init.go:431: error starting HTTP server: listen tcp 139.59.57.6:9000: bind: address already in use

1 more question: listmonk is accessible at the http version and not the https version? any solution to this pls? @mr-karan

@knadh
Copy link
Owner

knadh commented Oct 6, 2020

2020/10/05 18:37:37 init.go:431: error starting HTTP server: listen tcp 139.59.57.6:9000: bind: address already in use

This means listmonk is already running. You can do sudo pkill -9 listmonk to kill the running instance before running it again.

@jackdanielux
Copy link
Author

Thanks, that worked.

@jackdanielux
Copy link
Author

Apologies for re-opening:

All URLs including confirm subscription and unsubscribe are visible to public via port number.
e.g. http://domain.com:9000/subscription/xxx-xxx

How can I move this to only domain and https? e.g. https://domain.com/subscription/xxx-xxx

I feel this is getting done through nginx server blocks - but listmonk does not seem to create the requisite server block since it does not have a dependency on nginx. I was hogging stackoverflow for the same, but all the mechanisms mentioned there seem to break the functionality of URL. Any suggestions here pls @knadh @mr-karan ?

@jackdanielux jackdanielux reopened this Oct 7, 2020
@knadh
Copy link
Owner

knadh commented Oct 8, 2020

If you have Nginx running, you can just do:

server {
    listen 80;

    location / {
        proxy_pass http://localhost:9000;
    }
}

Note that this is just an example with port 80 that gives you http://. For https://, you'll have to listen to 443 and also have SSL certificates loaded in that block. Plenty of example of setting up Nginx with HTTPS (Lets Encrypt) out there. The only change would be proxying the public endpoing to localhost:9000 like in the above example.

@knadh knadh added the good first issue Good for newcomers label Oct 10, 2020
@knadh knadh closed this as completed Oct 10, 2020
@jackdanielux
Copy link
Author

Apologies for re-opening:

Problem:

  1. my opt-in confirmation and unsubscribe url are now going as http://bulklane.com/subscription/optin/xxx but they result in 404 (they open in browser with https://bulklane.com/subscription/optin/xxx)

Here's what I did with my nginx server block file

server {
listen 139.59.57.6:9001 ssl;
server_name bulklane.com;

location / {
proxy_pass http://localhost:9000;
proxy_redirect http://localhost:9000 https://bulklane.com:9001;
}

ssl on;
ssl_certificate /etc/letsencrypt/live/bulklane.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bulklane.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
}

server {
listen 139.59.57.6:9000;
server_name bulklane.com;
return 301 https://bulklane.com:9001$request_uri;
return 404;
}

am I doing anything wrong - or do I have to go and update the config file for listmonk? I tried editing that and mentioning verify-full and name of domain instead of localhost - both dont seem to work.

@jackdanielux
Copy link
Author

Hi @knadh @mr-karan : I am reinstalling on the same domain, below is the error I am getting, is this because of the ongoing upgrades?

./listmonk —install
2020/10/14 18:41:19 main.go:64: v0.7.0-alpha (0f055ea 2020-08-09T14:44:45Z)
2020/10/14 18:41:19 init.go:91: reading config: config.toml
2020/10/14 18:41:19 init.go:167: connecting to db: 127.0.0.1:5432/db
2020/10/14 18:41:19 upgrade.go:97: there are 2 pending database upgrade(s): [v0.4.0 v0.7.0]. The last upgrade was v0.0.0. Backup the database and run listmonk --upgrade
dbaa@bulklane:~/listmonk$ ./listmonk --upgrade
2020/10/14 18:42:08 main.go:64: v0.7.0-alpha (0f055ea 2020-08-09T14:44:45Z)
2020/10/14 18:42:08 init.go:91: reading config: config.toml
2020/10/14 18:42:08 init.go:167: connecting to db: 127.0.0.1:5432/db
** IMPORTANT: Take a backup of the database before upgrading.
continue (y/n)? y
2020/10/14 18:42:14 upgrade.go:61: running migration v0.4.0
2020/10/14 18:42:14 upgrade.go:63: error running migration v0.4.0: pq: relation "lists" does not exist

everytime it ends there. Any solution for this?

@mr-karan
Copy link
Collaborator

Ah this looks similar to #124 but running ./listmonk --install fixed it. That was before Migrations were introduced.

./listmonk --install is actually a clean installation which drops the DB. Looks like the schema migrations are called here which sort of ends up in a deadlock for you.

@knadh Why do we need to apply the DB migrations on running --install ?

@knadh
Copy link
Owner

knadh commented Oct 15, 2020

@knadh Why do we need to apply the DB migrations on running --install ?

listmonk doesn't run migrations on --install. They are applied on --upgrade. The example shows --upgrade being run after listmonk prompted there are 2 pending database upgrade(s): [v0.4.0 v0.7.0]. The last upgrade was v0.0.0. v0.0.0 shouldn't happen in a production binary obviously.

@jackdanielux did you get this binary directly from the releases page?

@jackdanielux
Copy link
Author

jackdanielux commented Oct 15, 2020 via email

@jackdanielux
Copy link
Author

jackdanielux commented Oct 15, 2020 via email

@jackdanielux
Copy link
Author

Hi @knadh @mr-karan what settings do we need to change in docker-compose file to ensure listmonk dashboard and public facing URLs run on https out of the box without the port? I tried changing the webserver URLs but it broke the installation, with the current configs it is running fine on http://domain.com:9000 and the subscribe and unsubscribe links are also with http and port number?.

@mr-karan
Copy link
Collaborator

run on https out of the box without the port

listmonk by default doesn't support listening on HTTPS at the app level. It's handled at the Proxy layer (HAProxy/NGINX/Caddy et all). You'll need to configure one of these and setup SSL.

@jackdanielux
Copy link
Author

@mr-karan : Thanks, NGINX resolved the issue.

I was creating a template using the default html code as on https://github.com/knadh/listmonk/blob/master/static/email-templates/default.tpl - but everytime I paste it in raw html box and click on preview - it generates an error msg as below:

2020/10/26 18:52:41 campaigns.go:187: error rendering message: template: content:69:20: executing "content" at <{{template "content" .}}>: exceeded maximum template depth (100000)

and then the moment I close the preview, try to paste again, it stops listmonk at the bankend and gives a 503 bad gateway error. Is this some bug or am I doing something wrong wrt NGINX?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants