mirror of
				https://github.com/zulip/docker-zulip.git
				synced 2025-11-04 05:53:19 +00:00 
			
		
		
		
	docs: Add upgrade instructions for old postgres container.
Fixes #123 Signed-off-by: Alexander Trost <galexrt@googlemail.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							cc11dee79f
						
					
				
				
					commit
					2cfbee3110
				
			
							
								
								
									
										73
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										73
									
								
								README.md
									
									
									
									
									
								
							@@ -316,6 +316,12 @@ the first time, it will run the necessary database migrations with
 | 
			
		||||
If you ever find you need to downgrade your Zulip server, you'll need
 | 
			
		||||
to use `manage.py migrate` to downgrade the database schema manually.
 | 
			
		||||
 | 
			
		||||
If you are using old `galexrt/docker-zulip` images (from Zulip 1.8.1 or
 | 
			
		||||
older), you need to upgrade the postgres image from
 | 
			
		||||
`quay.io/galexrt/postgres-zulip-tsearchextras:latest`.  Refer to the
 | 
			
		||||
[instructions for upgrading from the old galexrt/docker-zulip](#upgrading-from-the-old-galexrtdocker-zulip)
 | 
			
		||||
section.
 | 
			
		||||
 | 
			
		||||
### Using `docker-compose`
 | 
			
		||||
 | 
			
		||||
0. (Optional) Upgrading does not delete your data, but it's generally
 | 
			
		||||
@@ -379,6 +385,73 @@ and the commit to use as `ZULIP_GIT_URL` and `ZULIP_GIT_REF`
 | 
			
		||||
 | 
			
		||||
Then stop and restart the container as described in the previous section.
 | 
			
		||||
 | 
			
		||||
### Upgrading from the old galexrt/docker-zulip
 | 
			
		||||
 | 
			
		||||
If you are using an earlier version of `galexrt/docker-zulip` which
 | 
			
		||||
used the `quay.io/galexrt/postgres-zulip-tsearchextras:latest`
 | 
			
		||||
Postgres image, you need to run a few manual steps to upgrade to the
 | 
			
		||||
`zulip/zulip-postgresql` Postgres image (because we've significantly
 | 
			
		||||
upgraded the major postgres version).
 | 
			
		||||
 | 
			
		||||
These instructions assume that you have not changed the default
 | 
			
		||||
Postgres data path (`/opt/docker/zulip/postgresql/data`) in your
 | 
			
		||||
`docker-compose.yml`.  If you have changed it, please replace all
 | 
			
		||||
occurences of `/opt/docker/zulip/postgresql/data` with your path.
 | 
			
		||||
 | 
			
		||||
1. Make a backup of your Zulip Postgres data dir.
 | 
			
		||||
 | 
			
		||||
2. Stop all Zulip containers, except the postgres one (e.g. use
 | 
			
		||||
   `docker stop` and not `docker-compose stop`).
 | 
			
		||||
 | 
			
		||||
3. Create a new (upgraded) Postgres container using a different data directory:
 | 
			
		||||
```
 | 
			
		||||
docker run -d \
 | 
			
		||||
      --name postgresnew \
 | 
			
		||||
      -e POSTGRES_DB=zulip \
 | 
			
		||||
      -e POSTGRES_USER=zulip \
 | 
			
		||||
      -e POSTGRES_PASSWORD=zulip \
 | 
			
		||||
      -v /opt/docker/zulip/postgresql/new:/var/lib/postgresql/data:rw \
 | 
			
		||||
      zulip/zulip-postgresql:latest
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
4. Use `pg_dumpall` to dump all data from the existing Postgres container to
 | 
			
		||||
the new Postgres container (replace `ZULIP_DATABASE_CONTAINER_NAME` with the
 | 
			
		||||
name of the old Postgres container):
 | 
			
		||||
```
 | 
			
		||||
docker exec \
 | 
			
		||||
    ZULIP_DATABASE_CONTAINER_NAME pg_dumpall -U postgres | \
 | 
			
		||||
    docker exec -i postgresnew psql -U postgres
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
5. Stop and remove both Postgres containers:
 | 
			
		||||
```
 | 
			
		||||
docker stop ZULIP_DATABASE_CONTAINER_NAME postgresnew
 | 
			
		||||
docker rm ZULIP_DATABASE_CONTAINER_NAME postgresnew
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
6. Edit your `docker-compose.yml` to use the
 | 
			
		||||
`zulip/zulip-postgresql:latest` image for the `database` container
 | 
			
		||||
(this is the default in `zulip/docker-zulip`).
 | 
			
		||||
 | 
			
		||||
7. Replace the old Postgres data directory with upgraded data directory:
 | 
			
		||||
```
 | 
			
		||||
mv /opt/docker/zulip/postgresql/data /opt/docker/zulip/postgresql/old
 | 
			
		||||
mv /opt/docker/zulip/postgresql/new /opt/docker/zulip/postgresql/data
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
8. Delete the old existing containers:
 | 
			
		||||
```
 | 
			
		||||
docker-compose rm
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
9. Start Zulip up again:
 | 
			
		||||
```
 | 
			
		||||
docker-compose up
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
That should be it. Your Postgres data has now been updated to use the
 | 
			
		||||
`zulip/zulip-postgresql` image.
 | 
			
		||||
 | 
			
		||||
## Troubleshooting
 | 
			
		||||
 | 
			
		||||
Common issues include:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user