fix: replace docker-compose with docker compose (#1490)

Fixes https://github.com/knadh/listmonk/issues/1431
This commit is contained in:
Karan Sharma 2023-08-28 20:13:03 +05:30 committed by GitHub
parent 83c88d73d7
commit 5664e5cc9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 35 deletions

View file

@ -89,13 +89,13 @@ release:
.PHONY: build-dev-docker
build-dev-docker: build ## Build docker containers for the entire suite (Front/Core/PG).
cd dev; \
docker-compose build ; \
docker compose build ; \
# Spin a local docker suite for local development.
.PHONY: dev-docker
dev-docker: build-dev-docker ## Build and spawns docker containers for the entire suite (Front/Core/PG).
cd dev; \
docker-compose up
docker compose up
# Run the backend in docker-dev mode. The frontend assets in dev mode are loaded from disk from frontend/dist.
.PHONY: run-backend-docker
@ -106,10 +106,10 @@ run-backend-docker:
.PHONY: rm-dev-docker
rm-dev-docker: build ## Delete the docker containers including DB volumes.
cd dev; \
docker-compose down -v ; \
docker compose down -v ; \
# Setup the db for local dev docker suite.
.PHONY: init-dev-docker
init-dev-docker: build-dev-docker ## Delete the docker containers including DB volumes.
cd dev; \
docker-compose run --rm backend sh -c "make dist && ./listmonk --install --idempotent --yes --config dev/config.toml"
docker compose run --rm backend sh -c "make dist && ./listmonk --install --idempotent --yes --config dev/config.toml"

View file

@ -9,7 +9,7 @@ To generate a new sample configuration file, run `--listmonk --new-config`
Variables in config.toml can also be provided as environment variables prefixed by `LISTMONK_` with periods replaced by `__` (double underscore). Example:
| **Environment variable** | Example value |
|--------------------------------|----------------|
| ------------------------------ | -------------- |
| `LISTMONK_app__address` | "0.0.0.0:9000" |
| `LISTMONK_app__admin_username` | listmonk |
| `LISTMONK_app__admin_password` | listmonk |
@ -31,7 +31,7 @@ When configuring auth proxies and web application firewalls, use this table.
#### Private admin endpoints.
| Methods | Route | Description |
|---------|--------------------|-------------------------|
| ------- | ------------------ | ----------------------- |
| `*` | `/api/*` | Admin APIs |
| `GET` | `/admin/*` | Admin UI and HTML pages |
| `POST` | `/webhooks/bounce` | Admin bounce webhook |
@ -40,7 +40,7 @@ When configuring auth proxies and web application firewalls, use this table.
#### Public endpoints to expose to the internet.
| Methods | Route | Description |
|-------------|-----------------------|-----------------------------------------------|
| ----------- | --------------------- | --------------------------------------------- |
| `GET, POST` | `/subscription/*` | HTML subscription pages |
| `GET, ` | `/link/*` | Tracked link redirection |
| `GET` | `/campaign/*` | Pixel tracking image |
@ -54,7 +54,7 @@ When configuring auth proxies and web application firewalls, use this table.
When configuring `docker` volume mounts for using filesystem media uploads, you can follow either of two approaches. [The second option may be necessary if](https://github.com/knadh/listmonk/issues/1169#issuecomment-1674475945) your setup requires you to use `sudo` for docker commands.
After making any changes you will need to run `sudo docker-compose stop ; sudo docker-compose up`.
After making any changes you will need to run `sudo docker compose stop ; sudo docker compose up`.
And under `https://listmonk.mysite.com/admin/settings` you put `/listmonk/uploads`.

View file

@ -5,7 +5,7 @@ The app has two distinct components, the Go backend and the VueJS frontend. In t
### Pre-requisites
- `go`
- `nodejs` (if you are working on the frontend) and `yarn`
- Postgres database. If there is no local installation, the demo docker DB can be used for development (`docker-compose up demo-db`)
- Postgres database. If there is no local installation, the demo docker DB can be used for development (`docker compose up demo-db`)
### First time setup

View file

@ -15,7 +15,7 @@ See the "[Tutorials](#tutorials)" section at the bottom for detailed guides.
The latest image is available on DockerHub at `listmonk/listmonk:latest`
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:
### Demo
@ -30,7 +30,7 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/inst
```bash
wget -O docker-compose.yml https://raw.githubusercontent.com/knadh/listmonk/master/docker-compose.yml
docker-compose up -d demo-db demo-app
docker compose up -d demo-db demo-app
```
!!! warning
@ -58,14 +58,14 @@ The above shell script performs the following actions:
#### 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` to your needs. The overall setup looks like:
- `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 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).
- Copy `config.toml.sample` to your directory and make the following changes:
- `app.address` => `0.0.0.0:9000` (Port forwarding on Docker will work only if the app is advertising on all interfaces.)
- `db.host` => `listmonk_db` (Container Name of the DB container)
- Run `docker-compose up app` and visit `http://localhost:9000`.
- Run `docker compose up app` and visit `http://localhost:9000`.
##### Mounting a custom config.toml
@ -111,11 +111,11 @@ Mount the local `config.toml` inside the container at `listmonk/config.toml`.
!!! tip
- See [configuring with environment variables](../configuration) for variables like `app.admin_password` and `db.password`
- Ensure that both `app` and `db` containers are in running. If the containers are not running, restart them `docker-compose restart app db`.
- Ensure that both `app` and `db` containers are in running. If the containers are not running, restart them `docker compose restart app db`.
- Refer to [this tutorial](https://yasoob.me/posts/setting-up-listmonk-opensource-newsletter-mailing/) for setting up a production instance with Docker + Nginx + LetsEncrypt SSL.
!!! info
The example `docker-compose.yml` file works with Docker Engine 18.06.0+ and `docker-compose` which supports file format 3.7.
The example `docker-compose.yml` file works with Docker Engine 24.0.5+ and Docker Compose version v2.20.2+.
## Compiling from source

View file

@ -9,9 +9,9 @@ Some versions may require changes to the database. These changes or database "mi
## Docker
- `docker-compose pull` to pull the latest version from DockerHub.
- `docker-compose run --rm app ./listmonk --upgrade` to upgrade an existing DB.
- Run `docker-compose up app db` and visit `http://localhost:9000`.
- `docker compose pull` to pull the latest version from DockerHub.
- `docker compose run --rm app ./listmonk --upgrade` to upgrade an existing DB.
- Run `docker compose up app db` and visit `http://localhost:9000`.
## Railway
- Head to your dashboard, and select your Listmonk project.
@ -28,14 +28,14 @@ To restore a previous version, you have to restore the DB for that particular ve
1. Stop listmonk.
2. Restore your pre-upgrade database.
3. If you're using docker-compose, edit `docker-compose.yml` and change `listmonk:latest` to `listmonk:v2.4.0` _(for example)_.
3. If you're using `docker compose`, edit `docker-compose.yml` and change `listmonk:latest` to `listmonk:v2.4.0` _(for example)_.
4. Restart.
**Example with docker:**
1. Stop listmonk (app):
```
sudo docker container stop listmonk_app
sudo docker stop listmonk_app
```
2. Restore your pre-upgrade db (required) _(be careful, this will wipe your existing DB)_:
```
@ -52,5 +52,5 @@ x-app-defaults: &app-defaults
image: listmonk/listmonk:v2.4.0
```
4. Restart:
`sudo docker-compose up -d app db nginx certbot`
`sudo docker compose up -d app db nginx certbot`

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh
set -eu
# Listmonk demo setup using `docker-compose`.
# Listmonk demo setup using `docker compose`.
# See https://listmonk.app/docs/installation/ for detailed installation steps.
check_dependencies() {
@ -15,15 +15,17 @@ check_dependencies() {
exit 1
fi
if ! command -v docker-compose > /dev/null; then
echo "docker-compose is not installed."
# Check for "docker compose" functionality.
if ! docker compose version > /dev/null 2>&1; then
echo "'docker compose' functionality is not available. Please update to a newer version of Docker. See https://docs.docker.com/engine/install/ for more details."
exit 1
fi
}
setup_containers() {
curl -o docker-compose.yml https://raw.githubusercontent.com/knadh/listmonk/master/docker-compose.yml
docker-compose up -d demo-db demo-app
# Use "docker compose" instead of "docker-compose"
docker compose up -d demo-db demo-app
}
show_output(){

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh
set -eu
# Listmonk production setup using `docker-compose`.
# Listmonk production setup using `docker compose`.
# See https://listmonk.app/docs/installation/ for detailed installation steps.
printf '\n'
@ -39,8 +39,9 @@ check_dependencies() {
exit 1
fi
if ! exists docker-compose; then
error "docker-compose is not installed."
# Check for "docker compose" functionality.
if ! docker compose version > /dev/null 2>&1; then
echo "'docker compose' functionality is not available. Please update to a newer version of Docker. See https://docs.docker.com/engine/install/ for more details."
exit 1
fi
}
@ -48,7 +49,7 @@ check_dependencies() {
check_existing_db_volume() {
info "checking for an existing docker db volume"
if docker volume inspect listmonk_listmonk-data >/dev/null 2>&1; then
error "listmonk-data volume already exists. Please use docker-compose down -v to remove old volumes for a fresh setup of PostgreSQL."
error "listmonk-data volume already exists. Please use docker compose down -v to remove old volumes for a fresh setup of PostgreSQL."
exit 1
fi
}
@ -110,14 +111,14 @@ modify_config(){
run_migrations(){
info "running migrations"
docker-compose up -d db
docker compose up -d db
while ! is_healthy listmonk_db; do sleep 3; done
docker-compose run --rm app ./listmonk --install
docker compose run --rm app ./listmonk --install
}
start_services(){
info "starting app"
docker-compose up -d app db
docker compose up -d app db
}
show_output(){
@ -131,7 +132,6 @@ show_output(){
fi
}
check_dependencies
check_existing_db_volume
get_config