Compare commits

..

3 Commits

Author SHA1 Message Date
jorge 1ec9611ebb added external link to HOWTOS in readme 2021-07-14 14:46:34 +02:00
jorge 9fa97c8303 documentation in README: howto postgres, lists manage and user management
added documentation in the readme, howto postgres, lists manage and user management
2021-07-14 13:34:46 +02:00
jorge 51c7b5a30d binary debian run and upgrade instructions 2021-05-31 10:30:17 +02:00
1 changed files with 90 additions and 58 deletions

148
README.md
View File

@ -1,10 +1,7 @@
<a href="https://zerodha.tech"><img src="https://zerodha.tech/static/images/github-badge.svg" align="right" /></a>
![listmonk](https://user-images.githubusercontent.com/547147/89733021-43fbf700-da70-11ea-82e4-e98cb5010257.png)
listmonk is a standalone, self-hosted, newsletter and mailing list manager. It is fast, feature-rich, and packed into a single binary. It uses a PostgreSQL database as its data store. listmonk is a standalone, self-hosted, newsletter and mailing list manager. It is fast, feature-rich, and packed into a single binary. It uses a PostgreSQL database as its data store.
[![listmonk-dashboard](https://user-images.githubusercontent.com/547147/89733057-87566580-da70-11ea-8160-855f6f046a55.png)](https://listmonk.app)
Visit [listmonk.app](https://listmonk.app) Visit [listmonk.app](https://listmonk.app)
## Installation ## Installation
@ -32,57 +29,25 @@ More information on [docs](https://listmonk.app/docs).
__________________ __________________
### Binary ### Binary
#### download an prepare config file
- Download the [latest release](https://github.com/knadh/listmonk/releases) and extract the listmonk binary.
- `./listmonk --new-config` to generate config.toml. Then, edit the file.
#### prerequisites Debian: system user and PostgreSQL #### prerequisites Debian: system user and PostgreSQL
- install `sudo`
- install PostgreSQL `apt install postgresql` - install PostgreSQL `apt install postgresql`
- --create system user with config.toml data for the database: - create system user with config.toml data for the database:
`adduser listmonkuser`-- `adduser listmonk`
- create the postgreSQL database, the user and grant permissions: - create the postgreSQL database, the user and grant permissions:
`su - postgres` and then acces de PostgreSQL console `psql` `su - postgres` and then acces de PostgreSQL console `psql`
``` ```
postgres=# CREATE DATABASE listmonkdatabase; postgres=# CREATE DATABASE listmonk;
postgres=# CREATE USER listmonkuser WITH PASSWORD 'listmonkpassword'; postgres=# CREATE USER listmonk WITH PASSWORD 'listmonk';
postgres=# GRANT ALL PRIVILEGES ON DATABASE listmonkdatabase TO listmonkuser; postgres=# GRANT ALL PRIVILEGES ON DATABASE listmonk TO listmonk;
``` ```
#### download an prepare config file
- `cd /var/www/` and make the directory `mkdir listmonk`
- `cd listmonk`
- Download the [latest release](https://github.com/knadh/listmonk/releases) and extract the listmonk binary.
```
wget https://github.com/knadh/listmonk/releases/download/v1.0.0/listmonk_1.0.0_linux_amd64.tar.gz
wget https://github.com/knadh/listmonk/releases/download/v1.0.0/listmonk_1.0.0_checksums.txt
sha256sum listmonk_1.0.0_linux_amd64.tar.gz
cat listmonk_1.0.0_checksums.txt |grep linux
```
- change ownership of files `chown -R www-data:www-data /var/www/listmonk`
- generate config file `sudo -u www-data ./listmonk --new-config`
- edit the config file with the data we created previously and more options `vim /var/www/listmonk/confif.toml`
#### reverse proxy
- create the apache config to work behind a reverse proxy `/etc/apache2/sites-available/listmonk.doamain.tdl.conf`
```
<VirtualHost *:80>
ServerName listmonk.domain.tdl
ServerSignature Off
ErrorLog /var/log/apache2/listmonk.domain.tdl_error.log
TransferLog /var/log/apache2/listmonk.domain.tdl_access.log
LogLevel warn
ProxyPreserveHost On
ProxyPass "/" "http://127.0.0.1:9000/"
ProxyPassReverse "/" "http://127.0.0.1:9000/"
</VirtualHost>
```
- enable the proxy module `a2enmod proxy_http` enable the site `a2ensite listmonk.domain.tdl` and restart apache `systemctl reload apache2`
#### proceed to install #### proceed to install
- `sudo -u www-data ./listmonk --install` to setup the Postgres DB (or `--upgrade` to upgrade an existing DB. Upgrades are idempotent and running them multiple times have no side effects). - `./listmonk --install` to setup the Postgres DB (or `--upgrade` to upgrade an existing DB. Upgrades are idempotent and running them multiple times have no side effects).
- Run `sudo -u www-data ./listmonk` and visit `http://listmonk.domain.tdl` - Run `./listmonk` and visit `http://localhost:9000`.
#### after install, fine tunning #### after install, fine tunning
oncen checked it works, stop the process. oncen checked it works, stop the process.
@ -91,7 +56,7 @@ oncen checked it works, stop the process.
- run listmonk as a service, create `/etc/systemd/system/listmonk.service` with: - run listmonk as a service, create `/etc/systemd/system/listmonk.service` with:
``` ```
[Unit] [Unit]
Description=Listmonk domain.tdl server Description=Listmonk server
After=syslog.target network.target postgressql.target After=syslog.target network.target postgressql.target
[Service] [Service]
@ -109,24 +74,91 @@ oncen checked it works, stop the process.
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
- enable the service `systemct enable listmonk.service` and restart the daemon `systemctl daemon-restart` or you can start just the service `systemctl start listmonk.service` - enable and run the service `sudo systemctl enable listmonk.service` and then `sudo systemctl start listmonk.service`
#### fixing small dependencies #### upgrade (the binary install)
- uploads fail: `mkdir /var/www/html/listmonk/uploads` and `chown -R www-data:www-data /var/www/html/listmonk` - Download the [latest release](https://github.com/knadh/listmonk/releases) and extract the listmonk binary.
- stop `listmonk` or it's service if run as so `sudo systemctl stop listmonk.service`
- move the binary to executing destination.
- change ownership of the files to `www-data` or whatever user you have assigned the webserver `chown -R www-data:www-data listmonk`
- `./listmonk --upgrade` to upgrade an existing DB. (Upgrades are idempotent and running them multiple times have no side effects).
- start again the binary or the service `sudo systemctl start listmonk.service`
__________________
___________________ ## Postgres
### connect to db
```bash
su postres -
```
as user `postgres` execute
```bash
psql
```
inside postgres use these commands
- `\l` to list databases
- `\c <databasename>` to use a database
- `\dt` to list relations/tables
### See the lists
```postgres
SELECT * from lists;
```
will show something like
```postgres
id | uuid | name | type | optin | tags | created_at | updated_at
----+--------------------------------------+------------------------------------------------------------+---------+--------+--------+-------------------------------+-------------------------------
1 | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | Lista de prueba | private | single | {test} | 2021-05-19 15:33:08.503002+02 | 2021-05-27 12:05:28.201633+02
3 | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | Agendas | public | single | | 2021-06-03 17:18:58.398437+02 | 2021-06-03 17:42:13.446523+02
4 | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | Prensa | public | single | | 2021-06-03 17:19:11.233554+02 | 2021-07-13 18:04:58.078138+02
5 | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | Instituciones, Festivales, etc | public | single | | 2021-06-03 17:19:38.707663+02 | 2021-07-13 18:41:34.764095+02
6 | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | Newsletter | public | single | | 2021-06-03 17:19:51.514315+02 | 2021-07-13 18:44:15.855554+02
7 | xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | Antiguas socias y colaboradoras | public | single | | 2021-06-03 17:20:15.807685+02 | 2021-07-13 18:47:55.651608+02
(6 rows)
```
### Manage subscribers list
once connected to database with `\c <databasename>` and promt changes to `<databasename>=#`
select all users from subscribers lists
```postgres
SELECT * subscriber_lists;
```
will show something like this
```postgres
subscriber_id | list_id | status | created_at | updated_at
---------------+---------+-------------+-------------------------------+-------------------------------
646 | 7 | confirmed | 2021-07-13 18:47:55.616239+02 | 2021-07-13 18:47:55.616239+02
45 | 4 | confirmed | 2021-07-13 18:04:57.974174+02 | 2021-07-13 18:04:57.974174+02
9 | 3 | confirmed | 2021-06-03 17:34:34.714387+02 | 2021-06-03 17:42:13.431435+02
3148 | 7 | confirmed | 2021-07-13 18:47:55.616239+02 | 2021-07-13 18:47:55.616239+02
7 | 7 | unconfirmed | 2021-06-08 17:17:26.372759+02 | 2021-06-08 17:17:26.372759+02
1232 | 7 | confirmed | 2021-07-13 18:47:55.616239+02 | 2021-07-13 18:47:55.616239+02
7 | 5 | confirmed | 2021-06-08 17:17:26.372759+02 | 2021-06-08 17:17:26.372759+02
```
#### confirm users
modify the status from `unconfirmed` to `confirmed`
```postgres
UPDATE subscriber_lists SET status='confirmed' WHERE list_id=<number>;
```
change the `<number>` for the one you see under `list_id`
__________________
### Heroku ### Heroku
Using the [Nginx buildpack](https://github.com/heroku/heroku-buildpack-nginx) can be used to deploy listmonk on Heroku and use Nginx as a proxy to setup basicauth. Using the [Nginx buildpack](https://github.com/heroku/heroku-buildpack-nginx) can be used to deploy listmonk on Heroku and use Nginx as a proxy to setup basicauth. [Heroku deploy button](https://github.com/bumi/listmonk-heroku) provides an automated default deployment.
This one-click [Heroku deploy button](https://github.com/bumi/listmonk-heroku) provides an automated default deployment.
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/bumi/listmonk-heroku)
Please note that [configuration options](https://listmonk.app/docs/configuration) must be set using [environment configuration variables](https://devcenter.heroku.com/articles/config-vars).
### HOWTOS
[HOWTO set up listmonk](https://yasoob.me/posts/setting-up-listmonk-opensource-newsletter-mailing/)
[HOWTO import mailchimp subscribers](https://yasoob.me/posts/setting-up-listmonk-opensource-newsletter-mailing/#importing-old-subscribers)
## Developers ## Developers
listmonk is a free and open source software licensed under AGPLv3. If you are interested in contributing, refer to the [developer setup](https://listmonk.app/docs/developer-setup). The backend is written in Go and the frontend is Vue with Buefy for UI. listmonk is a free and open source software licensed under AGPLv3. If you are interested in contributing, refer to the [developer setup](https://listmonk.app/docs/developer-setup). The backend is written in Go and the frontend is Vue with Buefy for UI.