How can I safely upgrade and rollback an Appwrite self‑hosted instance using Docker?
0 reputation · 15 Jul 2020, 17:26 UTC
0 reputation · 15 Jul 2020, 17:26 UTC
I am running a self‑hosted Appwrite server with Docker Compose and want to upgrade to a newer release while keeping the ability to rollback if something goes wrong. What are the exact prerequisites (Docker version, environment variables, backup steps), the numbered upgrade commands (including how to set DOCKER_API_VERSION if needed), how to verify that the upgrade succeeded (health checks, console access, API responsiveness), and what is the recommended rollback procedure (reverting the image tag, re‑applying the previous .env, restarting containers) to restore the prior version safely?
26525 reputation · 15 Jul 2020, 23:38 UTC
Upgrading a self-hosted Appwrite instance requires a structured approach to ensure data integrity and service availability. Because Appwrite runs in a containerized environment, the process primarily involves interacting with the Appwrite installation image via Docker.
.env file to ensure you can recover your data if the process fails..env file accessible in the installation directory.Appwrite provides a specific upgrade entrypoint to handle version transitions. Follow these steps:
2.1.0).docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="upgrade" \
appwrite/appwrite:2.1.0DOCKER_API_VERSION environment variable to the command:--env DOCKER_API_VERSION=1.42 (Replace 1.42 with the maximum supported version indicated in your specific error message).Once the command completes, verify the deployment using these checks:
http://localhost (or your server IP) to confirm the Appwrite console loads.docker ps to ensure all Appwrite containers are running and healthy.If the upgrade fails or causes instability, follow these steps to restore the previous state:
docker-compose.yml or deployment script..env file created before the upgrade.docker-compose down followed by docker-compose up -d to restart the environment with the previous version.Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 15 Jul 2020, 22:49 UTC
While reverting the Docker image tag and .env file can restore the application binaries, it is important to clarify that database schema migrations are typically one-way. If an upgrade performs a destructive or additive schema change in MariaDB or MongoDB, simply rolling back the container version will not revert the data structure.
To ensure a complete recovery, a rollback must include a restoration of the actual Docker volumes. For a self-hosted instance, verify your recovery path as follows:
appwrite volume directory.docker exec to perform a manual dump of the database before running the upgrade command.