Describe the bug
After initializing on AWS EC2 and creating an AMI, when starting a new EC2 instance from this AMI, attempting to restart a stopped Docker container using docker start nominatim results in an error.
+ tailpid=0
+ replicationpid=0
+ trap stopServices SIGTERM TERM INT
+ /app/config.sh
+ id nominatim
+ useradd -m -p lifeoverflow_nominatim_password nominatim
+ IMPORT_FINISHED=/var/lib/postgresql/14/main/import-finished
+ '[' '!' -f /var/lib/postgresql/14/main/import-finished ']'
+ chown -R nominatim:nominatim /nominatim
+ service postgresql start
* Starting PostgreSQL 14 database server [ OK ]
+ cd /nominatim
+ sudo -E -u nominatim nominatim refresh --website --functions
2023-10-13 07:47:13: Using project directory: /nominatim
2023-10-13 07:47:13: Create functions
2023-10-13 07:47:20: Setting up website directory at /nominatim/website
+ service apache2 start
* Starting Apache httpd web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
*
+ '[' https://ftp5.gwdg.de/pub/misc/openstreetmap/planet.openstreetmap.org/replication/day '!=' '' ']'
+ '[' '' '!=' true ']'
+ sudo -E -u nominatim nominatim replication --project-dir /nominatim --init
2023-10-13 07:47:21: Using project directory: /nominatim
2023-10-13 07:47:21: Initialising replication updates
2023-10-13 07:47:25: Updates initialised at sequence 4036 (2023-10-01 20:26:06+00:00)
2023-10-13 07:47:25: Create functions
+ '[' '' == continuous ']'
+ '[' '' == once ']'
+ '[' '' == catch-up ']'
+ echo 'skipping replication'
skipping replication
+ tailpid=115
+ '[' '' = true ']'
+ echo 'Warm database caches for search and reverse queries'
Warm database caches for search and reverse queries
+ tail -Fv /var/log/postgresql/postgresql-14-main.log /var/log/apache2/access.log /var/log/apache2/error.log /var/log/replication.log
+ sudo -H -E -u nominatim nominatim admin --warm
==> /var/log/postgresql/postgresql-14-main.log <==
2023-10-13 07:47:08.732 UTC [43] LOG: starting PostgreSQL 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
2023-10-13 07:47:08.733 UTC [43] LOG: listening on IPv4 address "0.0.0.0", port 5432
2023-10-13 07:47:08.733 UTC [43] LOG: listening on IPv6 address "::", port 5432
2023-10-13 07:47:08.735 UTC [43] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-10-13 07:47:09.408 UTC [44] LOG: database system was shut down at 2023-10-13 00:33:29 UTC
2023-10-13 07:47:09.981 UTC [43] LOG: database system is ready to accept connections
==> /var/log/apache2/access.log <==
==> /var/log/apache2/error.log <==
[Fri Oct 13 07:47:20.465473 2023] [mpm_prefork:notice] [pid 97] AH00163: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations
[Fri Oct 13 07:47:20.465515 2023] [core:notice] [pid 97] AH00094: Command line: '/usr/sbin/apache2'
tail: cannot open '/var/log/replication.log' for reading: No such file or directory
2023-10-13 07:47:26: Using project directory: /nominatim
2023-10-13 07:47:26: Warming database caches
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/sqlalchemy/ext/asyncio/engine.py", line 457, in execute
result = await greenlet_spawn(
File "/usr/lib/python3/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 136, in greenlet_spawn
result = context.switch(value)
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1614, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/usr/lib/python3/dist-packages/sqlalchemy/sql/lambdas.py", line 509, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1481, in _execute_clauseelement
ret = self._execute_context(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1845, in _execute_context
self._handle_dbapi_exception(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 2030, in _handle_dbapi_exception
util.raise_(exc_info[1], with_traceback=exc_info[2])
File "/usr/lib/python3/dist-packages/sqlalchemy/util/compat.py", line 207, in raise_
raise exception
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
self.dialect.do_execute(
File "/usr/lib/python3/dist-packages/sqlalchemy/engine/default.py", line 732, in do_execute
cursor.execute(statement, parameters)
File "/usr/lib/python3/dist-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 460, in execute
self._adapt_connection.await_(
File "/usr/lib/python3/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 76, in await_only
return current.driver.switch(awaitable)
File "/usr/lib/python3/dist-packages/sqlalchemy/util/_concurrency_py3k.py", line 129, in greenlet_spawn
value = await result
File "/usr/lib/python3/dist-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 423, in _prepare_and_execute
self._rows = await prepared_stmt.fetch(*parameters)
File "/usr/lib/python3/dist-packages/asyncpg/prepared_stmt.py", line 176, in fetch
data = await self.__bind_execute(args, 0, timeout)
File "/usr/lib/python3/dist-packages/asyncpg/prepared_stmt.py", line 241, in __bind_execute
data, status, _ = await self.__do_execute(
File "/usr/lib/python3/dist-packages/asyncpg/prepared_stmt.py", line 230, in __do_execute
return await executor(protocol)
File "asyncpg/protocol/protocol.pyx", line 201, in bind_execute
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/nominatim", line 12, in <module>
exit(cli.nominatim(module_dir='/usr/local/lib/nominatim/module',
File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 225, in nominatim
return get_set_parser().run(**kwargs)
File "/usr/local/lib/nominatim/lib-python/nominatim/cli.py", line 121, in run
return args.command.run(args)
File "/usr/local/lib/nominatim/lib-python/nominatim/clicmd/admin.py", line 60, in run
return self._warm(args)
File "/usr/local/lib/nominatim/lib-python/nominatim/clicmd/admin.py", line 95, in _warm
api.reverse((random.uniform(-90, 90), random.uniform(-180, 180)),
File "/usr/local/lib/nominatim/lib-python/nominatim/api/core.py", line 610, in reverse
return self._loop.run_until_complete(self._async_api.reverse(coord, **params))
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/local/lib/nominatim/lib-python/nominatim/api/core.py", line 207, in reverse
return await geocoder.lookup(coord)
File "/usr/local/lib/nominatim/lib-python/nominatim/api/reverse.py", line 582, in lookup
row = await self.lookup_area()
File "/usr/local/lib/nominatim/lib-python/nominatim/api/reverse.py", line 470, in lookup_area
address_row = await self._lookup_area_address()
File "/usr/local/lib/nominatim/lib-python/nominatim/api/reverse.py", line 423, in _lookup_area_address
place_address_row = (await self.conn.execute(sql, self.bind_params)).one_or_none()
File "/usr/local/lib/nominatim/lib-python/nominatim/api/connection.py", line 63, in execute
return await asyncio.wait_for(self.connection.execute(sql, params), self.query_timeout)
File "/usr/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
Desktop / Server (please complete the following information):
OS & Version:
Operating System: Amazon Linux 2023
CPE OS Name: cpe:2.3:o:amazon:amazon_linux:2023
Kernel: Linux 6.1.55-75.123.amzn2023.x86_64
Architecture: x86-64
Hardware Vendor: Amazon EC2
Docker Version: [Docker version 24.0.5, build ced0996]
Nominatim Version: [mediagis/nominatim 4.3]
Additional context
Add any other context about the problem here.
Describe the bug After initializing on AWS EC2 and creating an AMI, when starting a new EC2 instance from this AMI, attempting to restart a stopped Docker container using
docker start nominatim
results in an error.To Reproduce Steps to reproduce the behavior:
docker start nominatim
.Expected behavior The EC2 instance launched from the AMI should maintain and run with the persistent container data. https://github.com/mediagis/nominatim-docker/tree/master/4.3#persistent-container-data
Screenshots & Logs
Desktop / Server (please complete the following information):
Additional context Add any other context about the problem here.