2019-03-06 18:53:14 +01:00
## Automatic update
An update script in your mailcow-dockerized directory will take care of updates.
But use it with caution! If you think you made a lot of changes to the mailcow code, you should use the manual update guide below.
Run the update script:
```
./update.sh
```
If it needs to, it will ask you how you wish to proceed.
Merge errors will be reported.
Some minor conflicts will be auto-corrected (in favour for the mailcow: dockerized repository code).
### Options
```
2020-02-11 11:25:14 +01:00
# Options can be combined
# - Check for updates
2019-03-06 18:53:14 +01:00
./update.sh --check
2020-05-29 19:46:47 +02:00
# Do not try to update docker-compose, **make sure to use the latest docker-compose available**
./update.sh --no-update-compose
2020-02-11 11:25:14 +01:00
# - Do not start mailcow after applying an update
./update.sh --skip-start
2020-05-29 19:46:47 +02:00
# - Force update (unattended, but unsupported, use at own risk)
./update.sh --force
# - Run garbage collector to cleanup old image tags and exit
./update.sh --gc
2020-05-30 22:38:23 +02:00
# - Update with merge strategy option "ours" instead of "theirs"
# This will **solve conflicts** when merging in favor for your local changes and should be avoided. Local changes will always be kept, unless we changed file XY, too.
2019-03-06 18:53:14 +01:00
./update.sh --ours
2019-09-19 07:02:32 +02:00
2020-02-11 11:25:14 +01:00
# - Don't update, but prefetch images and exit
2019-09-19 07:02:32 +02:00
./update.sh --prefetch
2019-03-06 18:53:14 +01:00
```
2020-09-28 20:50:17 +02:00
### I forgot what I changed before running update.sh
See `git log --pretty=oneline | grep -i "before update"` , you will have an output similar to this:
```
22cd00b5e28893ef9ddef3c2b5436453cc5223ab Before update on 2020-09-28_19_25_45
dacd4fb9b51e9e1c8a37d84485b92ffaf6c59353 Before update on 2020-08-07_13_31_31
```
Run `git diff 22cd00b5e28893ef9ddef3c2b5436453cc5223ab` to see what changed.
### Can I role back?
Yes.
2020-09-28 20:51:16 +02:00
See the topic above, instead of a diff, you run checkout:
2020-09-28 20:50:17 +02:00
```
docker-compose down
# Replace commit ID 22cd00b5e28893ef9ddef3c2b5436453cc5223ab by your ID
git checkout 22cd00b5e28893ef9ddef3c2b5436453cc5223ab
2020-09-28 20:50:37 +02:00
docker-compose pull
2020-09-28 20:50:17 +02:00
docker-compose up -d
```
2020-02-08 12:56:48 +01:00
## Manual update (not maintained anymore, please use update.sh)
2019-03-06 18:53:14 +01:00
### Step 1
```
2020-02-08 12:56:48 +01:00
docker-compose down
2019-03-06 18:53:14 +01:00
```
Fetch new data from GitHub, commit changes and merge remote repository:
```
# 1. Get updates/changes
git fetch origin master
# 2. Add all changed files to local clone
git add -A
# 3. Commit changes, ignore git complaining about username and mail address
git commit -m "Local config at $(date)"
# 4. Merge changes, prefer mailcow repository, replace "theirs" by "ours" to change merge strategy
git merge -Xtheirs -Xpatience
# If it conflicts with files that were deleted from the mailcow repository, just run...
git status --porcelain | grep -E "UD|DU" | awk '{print $2}' | xargs rm -v
# ...and repeat step 2 and 3
```
### Step 2
Pull new images (if any) and recreate changed containers:
```
docker-compose pull
docker-compose up -d --remove-orphans
```
### Step 3
Clean-up dangling (unused) images and volumes:
It is **very important** to _not_ run these commands when your containers are deleted.
Running `docker-compose down` - for example - will delete your containers. Your volumes are now in a dangling state! Running the commands shown below, _will_ remove your volumes and therefore your data.
```
docker rmi -f $(docker images -f "dangling=true" -q)
docker volume rm $(docker volume ls -qf dangling=true)
```
## Footnotes
- There is no release cycle regarding updates.