2022-12-29 04:02:51 +01:00
# Updating the Server
2022-10-26 00:18:25 +02:00
2023-03-02 03:47:23 +01:00
Docker doesn't follow a "traditional" method of updates. Rather you remove the old version of the
container and recreate it with a newer version. This document will help walk you through that
process.
<!-- deno - fmt - ignore - start -->
{{#template templates/kani-alert.md
imagepath=images
title=Tip
text=You should have documented and preserved your kanidm container create / run command from the server preparation guide. If not, you'll need to use "docker inspect" to work out how to recreate these parameters.
}}
<!-- deno - fmt - ignore - end -->
2022-12-29 04:02:51 +01:00
## Preserving the Previous Image
2022-10-26 00:18:25 +02:00
2022-12-26 23:52:03 +01:00
You may wish to preserve the previous image before updating. This is useful if an issue is
encountered in upgrades.
2022-10-26 00:18:25 +02:00
2022-12-26 23:52:03 +01:00
```bash
docker tag kanidm/server:latest kanidm/server:< DATE >
docker tag kanidm/server:latest kanidm/server:2022-10-24
```
2022-10-26 00:18:25 +02:00
2022-12-29 04:02:51 +01:00
## Update your Image
2022-10-26 00:18:25 +02:00
2023-03-02 03:47:23 +01:00
Pull the latest version of Kanidm.
2022-10-26 00:18:25 +02:00
2022-12-26 23:52:03 +01:00
```bash
docker pull kanidm/server:latest
2023-03-02 03:47:23 +01:00
docker pull kanidm/radius:latest
docker pull kanidm/tools:latest
2022-12-26 23:52:03 +01:00
```
2022-10-26 00:18:25 +02:00
2022-12-29 04:02:51 +01:00
## Perform a backup
2022-10-26 00:18:25 +02:00
See [backup and restore ](backup_restore.md )
2022-12-29 04:02:51 +01:00
## Update your Instance
2022-10-26 00:18:25 +02:00
2022-12-29 04:02:51 +01:00
<!-- deno - fmt - ignore - start -->
{{#template templates/kani-warning.md
imagepath=images
title=WARNING
2023-03-02 03:47:23 +01:00
text=Downgrades are not possible. It is critical you know how to backup and restore before you proceed with this step.
2022-12-29 04:02:51 +01:00
}}
<!-- deno - fmt - ignore - end -->
2022-10-26 00:18:25 +02:00
2023-12-18 00:10:13 +01:00
Docker updates operate by deleting and recreating the container. All state that needs to be
preserved is within your storage volume.
2022-10-26 00:18:25 +02:00
2022-12-26 23:52:03 +01:00
```bash
docker stop < previous instance name >
```
2022-10-26 00:18:25 +02:00
2023-12-18 00:10:13 +01:00
You can test that your configuration is correct with the new version, and the server should
correctly start.
2022-10-26 00:18:25 +02:00
2022-12-26 23:52:03 +01:00
```bash
docker run --rm -i -t -v kanidmd:/data \
2023-07-24 02:05:10 +02:00
kanidm/server:latest /sbin/kanidmd configtest
2022-12-26 23:52:03 +01:00
```
2022-10-26 00:18:25 +02:00
2023-03-02 03:47:23 +01:00
You can then follow through with the upgrade by running the create / run command with your existing
volume.
2022-10-26 00:18:25 +02:00
2022-12-26 23:52:03 +01:00
```bash
2023-03-02 03:47:23 +01:00
docker run [Your Arguments Here] -v kanidmd:/data \
2022-12-26 23:52:03 +01:00
OTHER_CUSTOM_OPTIONS \
kanidm/server:latest
```
2022-10-26 00:18:25 +02:00
Once you confirm the upgrade is successful you can delete the previous instance
2022-12-26 23:52:03 +01:00
```bash
docker rm < previous instance name >
```
2022-10-26 00:18:25 +02:00
If you encounter an issue you can revert to the previous version.
2022-12-26 23:52:03 +01:00
```bash
docker stop < new instance name >
docker start < previous instance name >
```
2022-10-26 00:18:25 +02:00
If you deleted the previous instance, you can recreate it from your preserved tag instead.
2022-12-26 23:52:03 +01:00
```bash
2023-12-18 00:10:13 +01:00
docker run [Your Arguments Here] -v kanidmd:/data \
OTHER_CUSTOM_OPTIONS \
kanidm/server:< DATE >
2022-12-26 23:52:03 +01:00
```
2022-10-26 00:18:25 +02:00
2023-03-02 03:47:23 +01:00
If the server from your previous version fails to start, you will need to restore from backup.