Remove admin user/password from sample config generation.

This commit is contained in:
Kailash Nadh 2024-07-29 22:47:48 +05:30
parent 1649b3b135
commit 26c6db0a13
4 changed files with 9 additions and 30 deletions

View file

@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"os" "os"
"regexp"
"strings" "strings"
"github.com/gofrs/uuid/v5" "github.com/gofrs/uuid/v5"
@ -306,13 +305,6 @@ func newConfigFile(path string) error {
return fmt.Errorf("error reading sample config (is binary stuffed?): %v", err) return fmt.Errorf("error reading sample config (is binary stuffed?): %v", err)
} }
// Generate a random admin password.
pwd, err := generateRandomString(16)
if err == nil {
b = regexp.MustCompile(`admin_password\s+?=\s+?(.*)`).
ReplaceAll(b, []byte(fmt.Sprintf(`admin_password = "%s"`, pwd)))
}
return os.WriteFile(path, b, 0644) return os.WriteFile(path, b, 0644)
} }

View file

@ -5,18 +5,6 @@
# port, use port 80 (this will require running with elevated permissions). # port, use port 80 (this will require running with elevated permissions).
address = "localhost:9000" address = "localhost:9000"
# ###### IMPORTANT ######
# Username and password are only used during installation (--install)
# for creating the superadmin user in the database.
#
# After installation, login to the admin dashboard, update the superadmin's
# user profile with the necessary details and remove these username and
# password from here.
#
# Username should be min 3 chars and Password should be min 8 chars.
admin_username = "listmonk"
admin_password = "listmonk"
# Database. # Database.
[db] [db]
host = "localhost" host = "localhost"

View file

@ -1,13 +1,14 @@
# Installation # Installation
listmonk requires Postgres ⩾ 12. listmonk requires Postgres ⩾ 12
See the "[Tutorials](#tutorials)" section at the bottom for detailed guides. !!! Admin
Set environment variables `LISTMONK_ADMIN_USER` and `LISTMONK_ADMIN_PASSWORD` when installing listmonk to create the Super Admin user. If these are not set, listmonk generates a username and temporary password which are printed on the terminal output.
## Binary ## Binary
- Download the [latest release](https://github.com/knadh/listmonk/releases) and extract the listmonk binary. `amd64` is the main one. It works for Intel and x86 CPUs. - Download the [latest release](https://github.com/knadh/listmonk/releases) and extract the listmonk binary. `amd64` is the main one. It works for Intel and x86 CPUs.
- `./listmonk --new-config` to generate config.toml. Then, edit the file. - `./listmonk --new-config` to generate config.toml. Then, edit the file.
- `./listmonk --install` to install the tables in the Postgres DB. - `./listmonk --install` to install the tables in the Postgres DB. Copy the username and password from the terminal output.
- Run `./listmonk` and visit `http://localhost:9000`. - Run `./listmonk` and visit `http://localhost:9000`.
@ -16,7 +17,7 @@ See the "[Tutorials](#tutorials)" section at the bottom for detailed guides.
The latest image is available on DockerHub at `listmonk/listmonk:latest` The latest image is available on DockerHub at `listmonk/listmonk:latest`
!!! note !!! note
Listmonk's docs and scripts use `docker compose`, which is compatible with the latest version of docker. If you installed docker and docker-compose from your Linux distribution, you probably have an older version and will need to use the `docker-compose` command instead, or you'll need to update docker manually. [More info](https://gist.github.com/MaximilianKohler/e5158fcfe6de80a9069926a67afcae11#docker-update). listmonk's docs and scripts use `docker compose`, which is compatible with the latest version of docker. If you installed docker and docker-compose from your Linux distribution, you probably have an older version and will need to use the `docker-compose` command instead, or you'll need to update docker manually. [More info](https://gist.github.com/MaximilianKohler/e5158fcfe6de80a9069926a67afcae11#docker-update).
Use the sample [docker-compose.yml](https://github.com/knadh/listmonk/blob/master/docker-compose.yml) to run listmonk and Postgres DB with `docker compose` as follows: Use the sample [docker-compose.yml](https://github.com/knadh/listmonk/blob/master/docker-compose.yml) to run listmonk and Postgres DB with `docker compose` as follows:
@ -61,7 +62,7 @@ The above shell script performs the following actions:
#### Manual Docker install #### Manual Docker install
The following workflow is recommended to setup `listmonk` manually using `docker compose`. You are encouraged to customise the contents of `docker-compose.yml` to your needs. The overall setup looks like: The following workflow is recommended to setup `listmonk` manually using `docker compose`. You are encouraged to customise the contents of [`docker-compose.yml`](https://github.com/knadh/listmonk/blob/master/docker-compose.yml) to your needs. The overall setup looks like:
- `docker compose up db` to run the Postgres DB. - `docker compose up db` to run the Postgres DB.
- `docker compose run --rm app ./listmonk --install` to setup the DB (or `--upgrade` to upgrade an existing DB). - `docker compose run --rm app ./listmonk --install` to setup the DB (or `--upgrade` to upgrade an existing DB).
@ -94,8 +95,6 @@ Here's a sample `config.toml` you can use:
```toml ```toml
[app] [app]
address = "0.0.0.0:9000" address = "0.0.0.0:9000"
admin_username = "listmonk"
admin_password = "listmonk"
# Database. # Database.
[db] [db]
@ -177,9 +176,9 @@ $ helm upgrade \
## Tutorials ## Tutorials
* [Informal step-by-step on how to get started with Listmonk using *Railway*](https://github.com/knadh/listmonk/issues/120#issuecomment-1421838533) * [Informal step-by-step on how to get started with listmonk using *Railway*](https://github.com/knadh/listmonk/issues/120#issuecomment-1421838533)
* [Step-by-step tutorial for installation and all basic functions. *Amazon EC2, SES, docker & binary*](https://gist.github.com/MaximilianKohler/e5158fcfe6de80a9069926a67afcae11) * [Step-by-step tutorial for installation and all basic functions. *Amazon EC2, SES, docker & binary*](https://gist.github.com/MaximilianKohler/e5158fcfe6de80a9069926a67afcae11)
* [Step-by-step guide on how to install and set up Listmonk on *AWS Lightsail with docker* (rameerez)](https://github.com/knadh/listmonk/issues/1208) * [Step-by-step guide on how to install and set up listmonk on *AWS Lightsail with docker* (rameerez)](https://github.com/knadh/listmonk/issues/1208)
* [Quick setup on any cloud server using *docker and caddy*](https://github.com/samyogdhital/listmonk-caddy-reverse-proxy) * [Quick setup on any cloud server using *docker and caddy*](https://github.com/samyogdhital/listmonk-caddy-reverse-proxy)
* [*Binary* install on Ubuntu 22.04 as a service](https://mumaritc.hashnode.dev/how-to-install-listmonk-using-binary-on-ubuntu-2204) * [*Binary* install on Ubuntu 22.04 as a service](https://mumaritc.hashnode.dev/how-to-install-listmonk-using-binary-on-ubuntu-2204)
* [*Binary* install on Ubuntu 18.04 as a service (Apache & Plesk)](https://devgypsy.com/post/2020-08-18-installing-listmonk-newsletter-manager/) * [*Binary* install on Ubuntu 18.04 as a service (Apache & Plesk)](https://devgypsy.com/post/2020-08-18-installing-listmonk-newsletter-manager/)

View file

@ -44,7 +44,7 @@ nav:
- "Installation": installation.md - "Installation": installation.md
- "Configuration": configuration.md - "Configuration": configuration.md
- "Upgrade": upgrade.md - "Upgrade": upgrade.md
- "Using Listmonk": - "Using listmonk":
- "Concepts": concepts.md - "Concepts": concepts.md
- "Templating": templating.md - "Templating": templating.md
- "Querying and segmenting subscribers": querying-and-segmentation.md - "Querying and segmenting subscribers": querying-and-segmentation.md