1+ ---
2+ title: Patching FMD Instance
3+ author: tom
4+ date: 2024-07-11 13:37:00 +0800
5+ description: Notes on patching an fmd instance.
6+ categories: [Issues, Troubleshooting]
7+ tags: [Issues, Troubleshooting, Patching]
8+ ---
9+
10+
11+ ### Patching FMD Instance
12+ Generally, every release can have breaking changes. Thus, better to check the release notes before updating the
13+ FMD instance. When patching an FMD instance, you need to ensure that existing docker containers and images are
14+ removed before applying the patch. This is because otherwise, you may encounter issues with leftover
15+ containers and images.
16+
17+ To remove all existing containers and images, you can use the following commands to clean the docker environment:
18+ ```bash
19+ cd FirmwareDroid
20+ # Stop all running containers
21+ docker compose stop
22+ # Remove all containers from the system
23+ docker container prune
24+ # Remove all images from the system forcefully
25+ docker rmi -f $(docker images -a -q)
26+ # Remove build cache
27+ docker builder prune
28+ ```
29+ Please note that cleaning the docker builder is necessary as otherwise, the build cache may cause issues when
30+ building the new images. Cleaning the docker environment will not affect the data stored in the database or your
31+ environment files.
32+
33+ After cleaning the docker environment, you can proceed with applying the patch to the FMD instance.
34+ ```bash
35+ # Pull the latest changes from the repository
36+ git pull
37+ # Apply the patch
38+ ./docker/build_docker_images.sh
39+ # Start the FMD instance
40+ docker compose up -d
41+ ```
42+
43+ After applying the patch, you can verify that the FMD instance is running correctly by checking the logs.
44+ ```bash
45+ docker compose logs -f
46+ ```
47+ If there are any issues, you can refer to the logs to identify the problem and take appropriate action. Generally, we
48+ do not apply database migration scripts for patch releases. However, if there are any changes to the database schema,
49+ you may need to apply the migration scripts manually. In such a case, the release notes will provide instructions on
50+ how to apply the migration scripts or you can reach out to the development team for assistance. Alternatively, you can
51+ start with an empty database by removing the existing database and letting the FMD instance create a new one.
0 commit comments