Back

SelfHosted - Bad Gateway

  • 0
  • Self Hosted
Daniel (Skullbone22)
19 Mar, 2024, 20:14

Hey,

So I am trying to get Appwrite running on my Ubuntu Server using the below command

TypeScript
docker run -it --rm \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
    --entrypoint="install" \
    appwrite/appwrite:1.5.3

I am planning on adding a domain name, but for now I am running it localhost and proxying the ports to my local machine. During the setup I set the ports to 8000 and 8443 and changed the secret, the rest I have left default. This worked locally on my Windows PC but not my server (no idea why)

When I run docker-compose logs I see a large number of errors regarding connecting to redis and mariadb. I've attached a snippet for the SQL connection error and the picture is redis connection issues.

I found https://discord.com/channels/564160730845151244/1111268781734514750/1111268781734514750 although I tried running as sudo but no luck.

When I run docker ps I see that appwrite-maintenance, appwrite-scheduler-messages and appwrite-scheduler-functions keep crashing and restarting.

Any ideas?

TypeScript
...
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
appwrite-realtime               | [Error] Line: 193
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Line: 193
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Line: 193
appwrite-realtime               | [Error] Type: Exception
appwrite-realtime               | [Error] Type: Exception
appwrite-realtime               | [Error] Message: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Message: Failed to create connection: Operation timed out
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Type: Exception
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Message: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Line: 193
appwrite-realtime               | [Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
appwrite-realtime               | [Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
appwrite-realtime               | [Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Line: 193
appwrite-realtime               | [Error] Message: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Line: 193
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
appwrite-realtime               | [Error] Type: Exception
appwrite-realtime               | [Error] Type: Exception
appwrite-realtime               | [Error] File: /usr/src/code/vendor/utopia-php/pools/src/Pools/Pool.php
appwrite-realtime               | [Error] Line: 193
appwrite-realtime               | [Error] Type: Exception
appwrite-realtime               | [Error] Line: 193
appwrite-realtime               | Pub/sub error: Failed to create connection: Operation timed out
...
TL;DR
Developers are experiencing Bad Gateway issues with SelfHosted when Redis and SQL connection errors persist. They tried modifying the compose file and can connect using root and user. Running `compose down` and `compose up` could help, and checking if it's possible to connect to the MariaDB database using the environment variables set in the .env file. Appwrite-mariadb needs to be running, and checking the logs for any errors is recommended. Solution: Try running `docker run -it --rm` command with specified volumes and entrypoint to install Appwrite. Numerous errors connecting to Redis and MariaDB are reported when running `docker
Daniel (Skullbone22)
19 Mar, 2024, 20:17

Also now when I run docker logs appwrite I get the snippet below, it did this before infinitly.

TypeScript
Worker 92 started successfully
Worker 93 started successfully
Worker 94 started successfully
Worker 95 started successfully
Worker 96 started successfully
Database not ready. Retrying connection (1)...
Database not ready. Retrying connection (2)...
ideclon
19 Mar, 2024, 20:23

Is appwrite-mariadb running? What do you see in the logs for that one?

Daniel (Skullbone22)
19 Mar, 2024, 20:24

mariadb doesnt seem to have restarted or thrown any unusual errors that I can see

Evdog
19 Mar, 2024, 20:37

Try a compose down and compose up to bounce if you haven't, just to rule out its not transient. Are you able to connect to the MariaDB database using the environment vars set in the .env file?

Daniel (Skullbone22)
19 Mar, 2024, 20:47

When I down and back up it, the Redis and SQL connection errors persist.

And after modifying the compose file for exposing 3306 and connecting, I can connect as both users, root and user

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more