diff --git a/.gitignore b/.gitignore index a8eba73..ccaf1e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ frontend/node_modules/ frontend/.cache/ frontend/yarn.lock +frontend/build/ .vscode/ config.toml diff --git a/.goreleaser.yml b/.goreleaser.yml index 071cd2b..ff6b179 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -40,3 +40,4 @@ dockers: dockerfile: Dockerfile extra_files: - config.toml.sample + - config-demo.toml diff --git a/Dockerfile b/Dockerfile index 9f37f8e..fd7567b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,4 +3,5 @@ RUN apk --no-cache add ca-certificates WORKDIR /listmonk COPY listmonk . COPY config.toml.sample config.toml +COPY config-demo.toml . CMD ["./listmonk"] diff --git a/INSTALL.md b/INSTALL.md index 0ad24c1..b6aca80 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -8,10 +8,27 @@ You can checkout the [docker-compose.yml](docker-compose.yml) to get an idea of how to run `listmonk` with `PostgreSQL` together using Docker. -- `docker-compose up -d app db` to run all the services together. -- `docker-compose run --rm app ./listmonk --install` to setup the DB. +- **Run the services**: `docker-compose up -d app db` to run all the services together. If this is a first time setup, you will see some errors related to DB which occur because migrations haven't been applied yet. Don't worry, follow the next step. +- **Apply DB migrations**: `docker-compose run --rm app ./listmonk --install`. +- Ensure that both the containers are in running state before proceeding. If the app container is not `up`, you might need to restart the app container once: `docker-compose restart app`. - Visit `http://localhost:9000`. +### Mounting a custom config file + +You are expected to tweak [config.toml.sample](config.toml.sample) for actual use with your custom settings. To mount the `config.toml` file, +you can add the following section to `docker-compose.yml`: + +``` + app: + <<: *app-defaults + depends_on: + - db + volume: + - ./path/on/host/config.toml/:/listmonk/config.toml +``` + +This will `mount` your local `config.toml` inside the container at `listmonk/config.toml`. + _NOTE_: This `docker-compose` file works with Docker Engine 18.06.0+ and `docker-compose` which supports file format 3.7. ### Demo Setup diff --git a/README.md b/README.md index 28c2bac..6c87eb4 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,13 @@ See the [configuration Wiki page](https://github.com/knadh/listmonk/wiki/Configu You can pull the official Docker Image from [Docker Hub](https://hub.docker.com/r/listmonk/listmonk). -You can checkout the [docker-compose.yml](docker-compose.yml) to get an idea of how to run `listmonk` with `PostgreSQL` together using Docker (also see [configuring with environment variables](https://github.com/knadh/listmonk/wiki/Configuration)). +You can checkout the [docker-compose.yml](docker-compose.yml) to get an idea of how to run `listmonk` with `PostgreSQL` together using Docker (also see [configuring with environment variables](https://github.com/knadh/listmonk/wiki/Configuration)). Please visit [INSTALL.md](INSTALL.md) for detailed instructions on how to setup Listmonk with Docker. -- `docker-compose up -d app db` to run all the services together. -- `docker-compose run --rm app ./listmonk --install` to setup the DB. -- Visit `http://localhost:9000`. +**Alternatively**, to run a demo of listmonk, you can quickly spin up a local setup with: -Alternatively, to run a demo of listmonk, you can quickly spin up a container `docker-compose up -d demo-db demo-app`. NOTE: This doesn't persist Postgres data after you stop and remove the container, this setup is intended only for demo. _DO NOT_ use the demo setup in production. +`docker-compose up -d demo-db demo-app`. + +**NOTE:** This doesn't persist Postgres data after you stop and remove the container, this setup is intended only for demo. _DO NOT_ use the demo setup in production. ### Other deployments diff --git a/config-demo.toml b/config-demo.toml new file mode 100644 index 0000000..d5ad4ab --- /dev/null +++ b/config-demo.toml @@ -0,0 +1,199 @@ +[app] +# Interface and port where the app will run its webserver. +address = "0.0.0.0:9000" + +# Public root URL of the listmonk installation that'll be used +# in the messages for linking to images, unsubscribe page etc. +root = "https://listmonk.mysite.com" + +# (Optional) full URL to the static logo to be displayed on +# user facing view such as the unsubscription page. +# eg: https://mysite.com/images/logo.svg +logo_url = "https://listmonk.mysite.com/public/static/logo.png" + +# (Optional) full URL to the static favicon to be displayed on +# user facing view such as the unsubscription page. +# eg: https://mysite.com/images/favicon.png +favicon_url = "https://listmonk.mysite.com/public/static/favicon.png" + +# The default 'from' e-mail for outgoing e-mail campaigns. +from_email = "listmonk " + +# List of e-mail addresses to which admin notifications such as +# import updates, campaign completion, failure etc. should be sent. +# To disable notifications, set an empty list, eg: notify_emails = [] +notify_emails = ["admin1@mysite.com", "admin2@mysite.com"] + +# Maximum concurrent workers that will attempt to send messages +# simultaneously. This should ideally depend on the number of CPUs +# available, and should be based on the maximum number of messages +# a target SMTP server will accept. +concurrency = 5 + +# Maximum number of messages to be sent out per second per worker. +# If concurrency = 10 and message_rate = 10, then up to 10x10=100 messages +# may be pushed out every second. This, along with concurrency, should be +# tweaked to keep the net messages going out per second under the target +# SMTP's rate limits, if any. +message_rate = 5 + +# The number of errors (eg: SMTP timeouts while e-mailing) a running +# campaign should tolerate before it is paused for manual +# investigation or intervention. Set to 0 to never pause. +max_send_errors = 1000 + +# The number of subscribers to pull from the databse in a single iteration. +# Each iteration pulls subscribers from the database, sends messages to them, +# and then moves on to the next iteration to pull the next batch. +# This should ideally be higher than the maximum achievable throughput (concurrency * message_rate) +batch_size = 1000 + +[privacy] +# Allow subscribers to unsubscribe from all mailing lists and mark themselves +# as blacklisted? +allow_blacklist = false + +# Allow subscribers to export data recorded on them? +allow_export = false + +# Items to include in the data export. +# profile Subscriber's profile including custom attributes +# subscriptions Subscriber's subscription lists (private list names are masked) +# campaign_views Campaigns the subscriber has viewed and the view counts +# link_clicks Links that the subscriber has clicked and the click counts +exportable = ["profile", "subscriptions", "campaign_views", "link_clicks"] + +# Allow subscribers to delete themselves from the database? +# This deletes the subscriber and all their subscriptions. +# Their association to campaign views and link clicks are also +# removed while views and click counts remain (with no subscriber +# associated to them) so that stats and analytics aren't affected. +allow_wipe = false + + +# Database. +[db] +host = "demo-db" +port = 5432 +user = "listmonk" +password = "listmonk" +database = "listmonk" +ssl_mode = "disable" + +# Maximum active and idle connections to pool. +max_open = 50 +max_idle = 10 + +# SMTP servers. +[smtp] + [smtp.my0] + enabled = true + host = "my.smtp.server" + port = 25 + + # "cram", "plain", or "login". Empty string for no auth. + auth_protocol = "cram" + username = "xxxxx" + password = "" + + # Format to send e-mails in: html|plain|both. + email_format = "both" + + # Optional. Some SMTP servers require a FQDN in the hostname. + # By default, HELLOs go with "localhost". Set this if a custom + # hostname should be used. + hello_hostname = "" + + # Maximum concurrent connections to the SMTP server. + max_conns = 10 + + # Time to wait for new activity on a connection before closing + # it and removing it from the pool. + idle_timeout = "15s" + + # Message send / wait timeout. + wait_timeout = "5s" + + # The number of times a message should be retried if sending fails. + max_msg_retries = 2 + + # Enable STARTTLS. + tls_enabled = true + tls_skip_verify = false + + # One or more optional custom headers to be attached to all e-mails + # sent from this SMTP server. Uncomment the line to enable. + # email_headers = { "X-Sender" = "listmonk", "X-Custom-Header" = "listmonk" } + + [smtp.postal] + enabled = false + host = "my.smtp.server2" + port = 25 + + # cram or plain. + auth_protocol = "plain" + username = "xxxxx" + password = "" + + # Format to send e-mails in: html|plain|both. + email_format = "both" + + # Optional. Some SMTP servers require a FQDN in the hostname. + # By default, HELLOs go with "localhost". Set this if a custom + # hostname should be used. + hello_hostname = "" + + # Maximum concurrent connections to the SMTP server. + max_conns = 10 + + # Time to wait for new activity on a connection before closing + # it and removing it from the pool. + idle_timeout = "15s" + + # Message send / wait timeout. + wait_timeout = "5s" + + # The number of times a message should be retried if sending fails. + max_msg_retries = 2 + + # Enable STARTTLS. + tls_enabled = true + tls_skip_verify = false + +[upload] +# File storage backend. "filesystem" or "s3". +provider = "filesystem" + + [upload.s3] + # (Optional). AWS Access Key and Secret Key for the user to access the bucket. + # Leaving it empty would default to use instance IAM role. + aws_access_key_id = "" + aws_secret_access_key = "" + + # AWS Region where S3 bucket is hosted. + aws_default_region = "ap-south-1" + + # Bucket name. + bucket = "" + + # Path where the files will be stored inside bucket. Default is "/". + bucket_path = "/" + + # Optional full URL to the bucket. eg: https://files.mycustom.com + bucket_url = "" + + # "private" or "public". + bucket_type = "public" + + # (Optional) Specify TTL (in seconds) for the generated presigned URL. + # Expiry value is used only if the bucket is private. + expiry = 86400 + + [upload.filesystem] + # Path to the uploads directory where media will be uploaded. + upload_path="./uploads" + + # Upload URI that's visible to the outside world. + # The media uploaded to upload_path will be made available publicly + # under this URI, for instance, list.yoursite.com/uploads. + upload_uri = "/uploads" diff --git a/config.toml.sample b/config.toml.sample index d5ad4ab..67eff67 100644 --- a/config.toml.sample +++ b/config.toml.sample @@ -73,7 +73,7 @@ allow_wipe = false # Database. [db] -host = "demo-db" +host = "db" port = 5432 user = "listmonk" password = "listmonk" diff --git a/docker-compose.yml b/docker-compose.yml index cc99b51..4a93e13 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,7 +42,7 @@ services: demo-app: <<: *app-defaults - command: [sh, -c, "yes | ./listmonk --install && ./listmonk"] + command: [sh, -c, "yes | ./listmonk --install --config config-demo.toml && ./listmonk --config config-demo.toml"] depends_on: - demo-db