Skip to content

Instantly share code, notes, and snippets.

@byawitz
Last active August 15, 2023 17:11
Show Gist options
  • Save byawitz/885510a4d9789e97424337e9472276d7 to your computer and use it in GitHub Desktop.
Save byawitz/885510a4d9789e97424337e9472276d7 to your computer and use it in GitHub Desktop.

1.Get your MariaDB IP.

Your Appwrite self-hosted platform uses the Docker network to isolate your container from the outside world.

As that, we first need to obtain the MariaDB internal IP. To find it run the following command on your server

Linux

$: docker network inspect appwrite_appwrite --format '{{range .Containers}}{{println .Name .IPv4Address println }}{{end}}' | grep mariadb

Windows

docker network inspect appwrite_appwrite --format "{{range .Containers}}{{println .Name .IPv4Address println }}{{end}}" | findstr /c:"maria"

You will get something like that:

appwrite-mariadb 172.21.0.2/16

So, in this case the MariaDB internal IP is 172.21.0.2.

2. Database tool

Download any one of the following Database management tools

3. SSH Tunneling

As the MariaDB container is not accessible from the outside world, you'll need to create a tunnel between the database management tool and your MariaDB container.

graph LR
    subgraph H[Your local computer]
    A[SSH Key]
    B[Database Management tool] 
    A-.->B
    end
    
    subgraph R[Your Appwrite server]

    D[Local User] --> G[MariaDB Container]
    end
    H <-..SSH tunnel..-> R
Loading

To create this tunnel you'll need

  • Appwrite server IP.
  • SSH key.
  • MariaDB internal IP
  • MariaDB username and password.
  • The username and password are located in the .env file. This file is usually located in /root/appwrite/.env file. If you've installed Appwrite in some manual way, then the .env file will be in the same folder as your docker-compose.yml file.

From that file, grab the following values for the MariaDB.

_APP_DB_USER=user
_APP_DB_PASS=password

Now you can set your SSH tunneling for any of your chosen management tools.

Below you'll have example how to do it in selected tools For the sake of the examples we'll assume the following details:

Field Value
Appwrite Server 127.0.0.1
Appwrite Server Username root
Appwrite Server Password toor
MariaDB Internal IP 172.19.0.6
MariaDB user user
MariaDB database appwrite
MariaDB password secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment