Skip to content

Commit 9ffbbba

Browse files
committed
Merge remote-tracking branch 'upstream/pull/6810'
2 parents 6a8b135 + f372eb3 commit 9ffbbba

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

.devcontainer/compose.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ services:
88

99
volumes:
1010
- ../..:/workspaces:cached
11-
- mise-cache:/home/vscode/.local/share/mise
1211

1312
# Overrides default command so things don't shut down after the process ends.
1413
command: sleep infinity
@@ -37,7 +36,7 @@ services:
3736
restart: unless-stopped
3837

3938
postgres:
40-
image: postgres:16.1
39+
image: postgres:15
4140
restart: unless-stopped
4241
networks:
4342
- default
@@ -50,4 +49,3 @@ services:
5049

5150
volumes:
5251
postgres-data:
53-
mise-cache:

doc/DEVCONTAINER.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,29 @@ bundle install
148148
```
149149
150150
This has been observed particularly when using RubyMine.
151+
152+
### Issues connecting to the database
153+
154+
For example:
155+
156+
```
157+
ActiveRecord::DatabaseConnectionError: There is an issue connecting with your hostname: postgres. (ActiveRecord::DatabaseConnectionError)
158+
```
159+
160+
This can be caused by incompatible versions of Postgres software and data, such as when the version of Postgres changes but the data is not upgraded to the new version's format.
161+
162+
If this is the case, the simplest fix is to reset the Postgres data volume. Run these commands from the host environment (not within the container environment):
163+
164+
1. The volume will be called `open_street_map_postgres-data` or similar.
165+
2. Find the container associated to it with `docker ps -a --filter volume=open_street_map_postgres-data`
166+
3. Delete the container by id with `docker rm $CONTAINER_ID`.
167+
4. Delete the volume with `docker volume rm open_street_map_postgres-data`.
168+
5. Try now and see if things work.
169+
170+
Or for a one-liner (requires the tool `jq` to be installed):
171+
172+
```
173+
$ docker ps -a --filter volume=open_street_map_postgres-data --format json | jq -r '.ID' | xargs docker rm && docker volume rm open_street_map_postgres-data
174+
```
175+
176+
Note that this will delete all data in the database! If you want to keep it, you will need to use Postgres's own tools to perform the data upgrade. That process is not described in this guide.

0 commit comments

Comments
 (0)