We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Installation issues when running on mac (silicon)
## Description
I'm facing these issues while trying to install using the latest `install.sh` script from master. I'm running 'macOS Big Sur', on a mac with Apple M1 processor.

1. Error thrown, while the line `sudo docker compose --profile prod up -d --wait` runs in the install script. Any command with `sudo docker` throws an error.

   ```
    2023/02/25 23:34:45 must use ASL logging (which requires CGO) if running as root
    2023/02/25 23:34:45 must use ASL logging (which requires CGO) if running as root
    2023/02/25 23:34:45 must use ASL logging (which requires CGO) if running as root
    2023/02/25 23:34:45 must use ASL logging (which requires CGO) if running as root
    [+] Running 0/0
    ⠋ watchtower Pulling                                                                                                                   0.1s
    ⠋ db Pulling                                                                                                                           0.1s
    ⠋ caddy-reverse-proxy Pulling                                                                                                          0.1s
    ⠋ service Pulling                                                                                                                      0.1s
    error getting credentials - err: exit status 1, out: ``
   ``` 
    This is because docker cannot run as root (or with sudo privileges) in mac.
    If possible, we should avoid `sudo` generally, while running on a mac.

2. The images don't run after downloading because the platforms do not match.
    ```
    ⠙ caddy-reverse-proxy The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested  0.0s
    ⠿ Container mathesar_service                                                                                                                                         Waiting 19.1s
    ⠏ service The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested              0.0s
    container for service "service" exited (3)
    ```
    We should be publishing an arm image along with the existing amd image. I sent a mail regarding this.

3. Installation fails because wget is not installed by default. We need to check if it is present during installation.

4. Startup (i.e. `docker compose --profile prod up -d --wait`) fails because `SECRET_KEY` in `.env` file is empty.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `db/install.py`
Content:
```
1 from sqlalchemy import text
2 from sqlalchemy.exc import OperationalError
3 
4 from db import engine
5 from db.types import install
6 
7 
8 def install_mathesar(
9         database_name, username, password, hostname, port, skip_confirm
10 ):
11     """Create database and install Mathesar on it."""
12     user_db_engine = engine.create_future_engine(
13         username, password, hostname, database_name, port
14     )
15     try:
16         user_db_engine.connect()
17         print(f"Installing Mathesar on preexisting PostgreSQL database {database_name} at host {hostname}...")
18         install.install_mathesar_on_database(user_db_engine)
19         user_db_engine.dispose()
20     except OperationalError:
21         database_created = _create_database(
22             database_name=database_name,
23             hostname=hostname,
24             username=username,
25             password=password,
26             port=port,
27             skip_confirm=skip_confirm
28         )
29         if database_created:
30             print(f"Installing Mathesar on PostgreSQL database {database_name} at host {hostname}...")
31             install.install_mathesar_on_database(user_db_engine)
32             user_db_engine.dispose()
33         else:
34             print(f"Skipping installing on DB with key {database_name}.")
35 
36 
37 def _create_database(database_name, hostname, username, password, port, skip_confirm=True):
38     if skip_confirm is True:
39         create_database = "y"
40     else:
41         create_database = input(
42             f"Create a new Database called {database_name}? (y/n) > "
43         )
44     if create_database.lower() in ["y", "yes"]:
45         # We need to connect to an existing database inorder to create a new Database.
46         # So we use the default Database `postgres` that comes with postgres.
47         # TODO Throw correct error when the default postgres database does not exists(which is very rare but still possible)
48         root_database = "postgres"
49         root_db_engine = engine.create_future_engine(
50             username, password, hostname, root_database, port,
51         )
52         with root_db_engine.connect() as conn:
53             conn.execution_options(isolation_level="AUTOCOMMIT")
54             conn.execute(text(f"CREATE DATABASE {database_name}"))
55         root_db_engine.dispose()
56         print(f"Created DB is {database_name}.")
57         return True
58     else:
59         print(f"Database {database_name} not created!")
60         return False
61
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/db/install.py b/db/install.py
--- a/db/install.py
+++ b/db/install.py
@@ -10,7 +10,8 @@
 ):
     """Create database and install Mathesar on it."""
     user_db_engine = engine.create_future_engine(
-        username, password, hostname, database_name, port
+        username, password, hostname, database_name, port,
+        connect_args={"connect_timeout": 10}
     )
     try:
         user_db_engine.connect()
@@ -48,6 +49,7 @@
         root_database = "postgres"
         root_db_engine = engine.create_future_engine(
             username, password, hostname, root_database, port,
+            connect_args={"connect_timeout": 10}
         )
         with root_db_engine.connect() as conn:
             conn.execution_options(isolation_level="AUTOCOMMIT")

{"golden_diff": "diff --git a/db/install.py b/db/install.py\n--- a/db/install.py\n+++ b/db/install.py\n@@ -10,7 +10,8 @@\n ):\n     \"\"\"Create database and install Mathesar on it.\"\"\"\n     user_db_engine = engine.create_future_engine(\n-        username, password, hostname, database_name, port\n+        username, password, hostname, database_name, port,\n+        connect_args={\"connect_timeout\": 10}\n     )\n     try:\n         user_db_engine.connect()\n@@ -48,6 +49,7 @@\n         root_database = \"postgres\"\n         root_db_engine = engine.create_future_engine(\n             username, password, hostname, root_database, port,\n+            connect_args={\"connect_timeout\": 10}\n         )\n         with root_db_engine.connect() as conn:\n             conn.execution_options(isolation_level=\"AUTOCOMMIT\")\n", "issue": "Installation issues when running on mac (silicon)\n## Description\r\nI'm facing these issues while trying to install using the latest `install.sh` script from master. I'm running 'macOS Big Sur', on a mac with Apple M1 processor.\r\n\r\n1. Error thrown, while the line `sudo docker compose --profile prod up -d --wait` runs in the install script. Any command with `sudo docker` throws an error.\r\n\r\n   ```\r\n    2023/02/25 23:34:45 must use ASL logging (which requires CGO) if running as root\r\n    2023/02/25 23:34:45 must use ASL logging (which requires CGO) if running as root\r\n    2023/02/25 23:34:45 must use ASL logging (which requires CGO) if running as root\r\n    2023/02/25 23:34:45 must use ASL logging (which requires CGO) if running as root\r\n    [+] Running 0/0\r\n    \u280b watchtower Pulling                                                                                                                   0.1s\r\n    \u280b db Pulling                                                                                                                           0.1s\r\n    \u280b caddy-reverse-proxy Pulling                                                                                                          0.1s\r\n    \u280b service Pulling                                                                                                                      0.1s\r\n    error getting credentials - err: exit status 1, out: ``\r\n   ``` \r\n    This is because docker cannot run as root (or with sudo privileges) in mac.\r\n    If possible, we should avoid `sudo` generally, while running on a mac.\r\n\r\n2. The images don't run after downloading because the platforms do not match.\r\n    ```\r\n    \u2819 caddy-reverse-proxy The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested  0.0s\r\n    \u283f Container mathesar_service                                                                                                                                         Waiting 19.1s\r\n    \u280f service The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested              0.0s\r\n    container for service \"service\" exited (3)\r\n    ```\r\n    We should be publishing an arm image along with the existing amd image. I sent a mail regarding this.\r\n\r\n3. Installation fails because wget is not installed by default. We need to check if it is present during installation.\r\n\r\n4. Startup (i.e. `docker compose --profile prod up -d --wait`) fails because `SECRET_KEY` in `.env` file is empty.\n", "before_files": [{"content": "from sqlalchemy import text\nfrom sqlalchemy.exc import OperationalError\n\nfrom db import engine\nfrom db.types import install\n\n\ndef install_mathesar(\n        database_name, username, password, hostname, port, skip_confirm\n):\n    \"\"\"Create database and install Mathesar on it.\"\"\"\n    user_db_engine = engine.create_future_engine(\n        username, password, hostname, database_name, port\n    )\n    try:\n        user_db_engine.connect()\n        print(f\"Installing Mathesar on preexisting PostgreSQL database {database_name} at host {hostname}...\")\n        install.install_mathesar_on_database(user_db_engine)\n        user_db_engine.dispose()\n    except OperationalError:\n        database_created = _create_database(\n            database_name=database_name,\n            hostname=hostname,\n            username=username,\n            password=password,\n            port=port,\n            skip_confirm=skip_confirm\n        )\n        if database_created:\n            print(f\"Installing Mathesar on PostgreSQL database {database_name} at host {hostname}...\")\n            install.install_mathesar_on_database(user_db_engine)\n            user_db_engine.dispose()\n        else:\n            print(f\"Skipping installing on DB with key {database_name}.\")\n\n\ndef _create_database(database_name, hostname, username, password, port, skip_confirm=True):\n    if skip_confirm is True:\n        create_database = \"y\"\n    else:\n        create_database = input(\n            f\"Create a new Database called {database_name}? (y/n) > \"\n        )\n    if create_database.lower() in [\"y\", \"yes\"]:\n        # We need to connect to an existing database inorder to create a new Database.\n        # So we use the default Database `postgres` that comes with postgres.\n        # TODO Throw correct error when the default postgres database does not exists(which is very rare but still possible)\n        root_database = \"postgres\"\n        root_db_engine = engine.create_future_engine(\n            username, password, hostname, root_database, port,\n        )\n        with root_db_engine.connect() as conn:\n            conn.execution_options(isolation_level=\"AUTOCOMMIT\")\n            conn.execute(text(f\"CREATE DATABASE {database_name}\"))\n        root_db_engine.dispose()\n        print(f\"Created DB is {database_name}.\")\n        return True\n    else:\n        print(f\"Database {database_name} not created!\")\n        return False\n", "path": "db/install.py"}], "after_files": [{"content": "from sqlalchemy import text\nfrom sqlalchemy.exc import OperationalError\n\nfrom db import engine\nfrom db.types import install\n\n\ndef install_mathesar(\n        database_name, username, password, hostname, port, skip_confirm\n):\n    \"\"\"Create database and install Mathesar on it.\"\"\"\n    user_db_engine = engine.create_future_engine(\n        username, password, hostname, database_name, port,\n        connect_args={\"connect_timeout\": 10}\n    )\n    try:\n        user_db_engine.connect()\n        print(f\"Installing Mathesar on preexisting PostgreSQL database {database_name} at host {hostname}...\")\n        install.install_mathesar_on_database(user_db_engine)\n        user_db_engine.dispose()\n    except OperationalError:\n        database_created = _create_database(\n            database_name=database_name,\n            hostname=hostname,\n            username=username,\n            password=password,\n            port=port,\n            skip_confirm=skip_confirm\n        )\n        if database_created:\n            print(f\"Installing Mathesar on PostgreSQL database {database_name} at host {hostname}...\")\n            install.install_mathesar_on_database(user_db_engine)\n            user_db_engine.dispose()\n        else:\n            print(f\"Skipping installing on DB with key {database_name}.\")\n\n\ndef _create_database(database_name, hostname, username, password, port, skip_confirm=True):\n    if skip_confirm is True:\n        create_database = \"y\"\n    else:\n        create_database = input(\n            f\"Create a new Database called {database_name}? (y/n) > \"\n        )\n    if create_database.lower() in [\"y\", \"yes\"]:\n        # We need to connect to an existing database inorder to create a new Database.\n        # So we use the default Database `postgres` that comes with postgres.\n        # TODO Throw correct error when the default postgres database does not exists(which is very rare but still possible)\n        root_database = \"postgres\"\n        root_db_engine = engine.create_future_engine(\n            username, password, hostname, root_database, port,\n            connect_args={\"connect_timeout\": 10}\n        )\n        with root_db_engine.connect() as conn:\n            conn.execution_options(isolation_level=\"AUTOCOMMIT\")\n            conn.execute(text(f\"CREATE DATABASE {database_name}\"))\n        root_db_engine.dispose()\n        print(f\"Created DB is {database_name}.\")\n        return True\n    else:\n        print(f\"Database {database_name} not created!\")\n        return False\n", "path": "db/install.py"}]}