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

Add create command to prevent external: true warnings #6203

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

codiflow
Copy link

@codiflow codiflow commented Dec 9, 2024

Contribution Guidelines

What does this PR include?

Short Description

This is related to #5970 and https://community.mailcow.email/d/2126-backup-restore/2

It adds docker compose create to the script which gets executed directly after the sync of the mailcow-dockerized directory. This way the Docker daemon on the remote side creates everything (so the volumes are "owned" by the remote side) and we get rid of the warning volume "XYZ" already exists but was not created by Docker Compose. Use 'external: true' to use an existing volume

This is helpful especially if you use the script create-cold-standby.sh to migrate your mailcow installation to another server and don't want to get those warnings after the migration.

Affected Containers

Script: create-cold-standby.sh

Did you run tests?

Sure 😎

What did you test?

I modified the script like in this PR and tested it during a mail server migration.

What were the final results? (Awaited, got)

No more warnings like volume "XYZ" already exists but was not created by Docker Compose. Use 'external: true' to use an existing volume:

Output on local side:

[...]

Preparing remote...
Synchronizing mailcow base directory...
Creating networks, volumes and containers on remote...
 Network mailcowdockerized_mailcow-network  Creating
 Network mailcowdockerized_mailcow-network  Created
 Volume "mailcowdockerized_solr-vol-1"  Creating
 Volume "mailcowdockerized_solr-vol-1"  Created
 Volume "mailcowdockerized_vmail-vol-1"  Creating
 Volume "mailcowdockerized_vmail-vol-1"  Created
 Volume "mailcowdockerized_sogo-userdata-backup-vol-1"  Creating
 Volume "mailcowdockerized_sogo-userdata-backup-vol-1"  Created
 Volume "mailcowdockerized_rspamd-vol-1"  Creating
 Volume "mailcowdockerized_rspamd-vol-1"  Created
 Volume "mailcowdockerized_crypt-vol-1"  Creating
 Volume "mailcowdockerized_crypt-vol-1"  Created
 Volume "mailcowdockerized_clamd-db-vol-1"  Creating
 Volume "mailcowdockerized_clamd-db-vol-1"  Created
 Volume "mailcowdockerized_sogo-web-vol-1"  Creating
 Volume "mailcowdockerized_sogo-web-vol-1"  Created
 Volume "mailcowdockerized_mysql-socket-vol-1"  Creating
 Volume "mailcowdockerized_mysql-socket-vol-1"  Created
 Volume "mailcowdockerized_mysql-vol-1"  Creating
 Volume "mailcowdockerized_mysql-vol-1"  Created
 Volume "mailcowdockerized_postfix-vol-1"  Creating
 Volume "mailcowdockerized_postfix-vol-1"  Created
 Volume "mailcowdockerized_redis-vol-1"  Creating
 Volume "mailcowdockerized_redis-vol-1"  Created
 Volume "mailcowdockerized_vmail-index-vol-1"  Creating
 Volume "mailcowdockerized_vmail-index-vol-1"  Created
 Container mailcowdockerized-memcached-mailcow-1  Creating
 Container mailcowdockerized-netfilter-mailcow-1  Creating
 Container mailcowdockerized-dockerapi-mailcow-1  Creating
 Container mailcowdockerized-unbound-mailcow-1  Creating
 Container mailcowdockerized-sogo-mailcow-1  Creating
 Container mailcowdockerized-olefy-mailcow-1  Creating
 Container mailcowdockerized-dockerapi-mailcow-1  Created
 Container mailcowdockerized-olefy-mailcow-1  Created
 Container mailcowdockerized-netfilter-mailcow-1  Created
 Container mailcowdockerized-redis-mailcow-1  Creating
 Container mailcowdockerized-solr-mailcow-1  Creating
 Container mailcowdockerized-unbound-mailcow-1  Created
 Container mailcowdockerized-mysql-mailcow-1  Creating
 Container mailcowdockerized-clamd-mailcow-1  Creating
 Container mailcowdockerized-memcached-mailcow-1  Created
 Container mailcowdockerized-sogo-mailcow-1  Created
 Container mailcowdockerized-clamd-mailcow-1  Created
 Container mailcowdockerized-solr-mailcow-1  Created
 Container mailcowdockerized-redis-mailcow-1  Created
 Container mailcowdockerized-php-fpm-mailcow-1  Creating
 Container mailcowdockerized-mysql-mailcow-1  Created
 Container mailcowdockerized-dovecot-mailcow-1  Creating
 Container mailcowdockerized-postfix-mailcow-1  Creating
 Container mailcowdockerized-dovecot-mailcow-1  Created
 Container mailcowdockerized-rspamd-mailcow-1  Creating
 Container mailcowdockerized-ofelia-mailcow-1  Creating
 Container mailcowdockerized-postfix-mailcow-1  Created
 Container mailcowdockerized-php-fpm-mailcow-1  Created
 Container mailcowdockerized-nginx-mailcow-1  Creating
 Container mailcowdockerized-ofelia-mailcow-1  Created
 Container mailcowdockerized-rspamd-mailcow-1  Created
 Container mailcowdockerized-nginx-mailcow-1  Created
 Container mailcowdockerized-acme-mailcow-1  Creating
 Container mailcowdockerized-acme-mailcow-1  Created
 Container mailcowdockerized-watchdog-mailcow-1  Creating
 Container mailcowdockerized-watchdog-mailcow-1  Created
Running redis-cli save... OK
Creating remote mountpoint /var/lib/docker/volumes/mailcowdockerized_clamd-db-vol-1/_data for mailcowdockerized_clamd-db-vol-1...
Synchronizing mailcowdockerized_clamd-db-vol-1 from local /var/lib/docker/volumes/mailcowdockerized_clamd-db-vol-1/_data...

[...]

This is also "repeat-proof" so the command does not produce any additional output after everything has been created successfully on initial execution.

Output on remote side after starting the containers:
image

DerLinkman and others added 2 commits November 15, 2024 16:21
This is related to mailcow#5970 and https://community.mailcow.email/d/2126-backup-restore/2

It adds `docker compose create` to the script which gets executed directly after the sync of the mailcow-dockerized directory. This way the Docker daemon on the remote side creates everything and we get rid of the warning "volume "XYZ" already exists but was not created by Docker Compose. Use `external: true` to use an existing volume"

This is helpful if you use the create-cold-standby.sh script to migrate your mailcow installation to another server and don't want to get those warnings after migration.
Copy link
Member

@DerLinkman DerLinkman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!

@DerLinkman DerLinkman merged commit 7c8e5c1 into mailcow:staging Dec 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants