Back

[SOLVED] Restoring Appwrite server

  • 1
  • Self Hosted
tsalira
26 Apr, 2023, 14:04

Hello. So I installed appwrite on my server and have been developing on it for about a month now. Been able to test my app from my local machine connecting to the online server (VPS running centos 8) and all was good. So when I decided to put the app online, on a different server, I got some error message about requesting an insecure resource. I have been accessing the appwrite server via its IP address. I then did some digging around and learnt that I need to set a custom domain, which I could not do because I did not set the _APP_DOMAIN and _APP_DOMAIN_TARGET. So I went on to try and set these. Given my minimal experience with docker and basic linux skills, it has been quite a challenge. So I managed to create an .env file and set the _APP_DOMAIN variable only, and then ran the docker compsoe command with the .env file option. The command ran for almost 20 minutes, which I found quite weird. All the while, it was giving all sorts of information, including some fatal errors that I wasn't really able to read. Eventually, I terminated the command (ctrl+c) since it would not stop. I figured I had done something wrong, so I deleted the .env file, and ran the docker compose command again. This time it ran for a few seconds and completed. When I tried to access the appwrite console from my browser, it returned a "bad gateway" error. I restarted the container, and even ran docker compose again. Now am getting a "404 page not found error". I cannot access the console from my browser, and am out of ideas on how to restore it, before I can even think of the custom domains. Can anybody bail me out?

TL;DR
TL;DR: User installed Appwrite on a server and developed on it for a month. When trying to put the app online, encountered an error about requesting an insecure resource. Discovered the need to set custom domain but had difficulty doing so. Tried to set _APP_DOMAIN variable using docker compose command with .env file, but it ran for unusually long and gave fatal errors. Terminated command, deleted .env file, and ran docker compose again. Now getting a "bad gateway" error and then a "404 page not found" error. Requested help to restore app before trying custom domains. Support suggests running some commands to
Binyamin
26 Apr, 2023, 14:05

Can you run

TypeScript
  $#: docker compose ls
  $#: docker ps

And share the results of both of those commands?

Bouahaza
26 Apr, 2023, 14:06
tsalira
26 Apr, 2023, 14:12

docker compose ls

tsalira
26 Apr, 2023, 14:13

docker ps

Binyamin
26 Apr, 2023, 14:14

Good

Binyamin
26 Apr, 2023, 14:14

Now can you run

TypeScript
 cd /root/appwrite
 ls -lah
tsalira
26 Apr, 2023, 14:16
Binyamin
26 Apr, 2023, 14:16

Sorry, I've added it for clearity

tsalira
26 Apr, 2023, 14:16

Cool

Binyamin
26 Apr, 2023, 14:16

I've edited the message try now

tsalira
26 Apr, 2023, 14:17
Binyamin
26 Apr, 2023, 14:20

Okay, that's fine

Go to your main Appwrite folder, and take the compose down Fetch the .env file from Appwrite and edit only these values

TypeScript
 $#: cd /root/appwrite
 $#: docker compose down
 $#: curl -fsSL https://appwrite.io/install/env -o .env
 $#: nano .env
 --- 👇 edit the .env file see below 👇 ---
 $#: docker compose up -d

Then set and edit those values for now with your infromation.

TypeScript
# General 
_APP_DOMAIN=yourdomain.com
_APP_DOMAIN_TARGET=yourdomain.com
_APP_OPENSSL_KEY_V1=Enter_Some_random_Long_key

# Database
_APP_DB_HOST=mariadb
_APP_DB_PORT=3306

_APP_DB_SCHEMA=appwrite
_APP_DB_USER=user
_APP_DB_PASS=password
_APP_DB_ROOT_PASS=rootsecretpassword

For the database details the last 4 values are upto you and you can write whatever suits you

tsalira
26 Apr, 2023, 14:24

for the app domain, should I enter the domain on which the appwrite is sitting on? Or can it be any other domain

Binyamin
26 Apr, 2023, 14:25

You need to enter the domain the is A records points to your Appwrite server

tsalira
26 Apr, 2023, 14:30

finished editing

Binyamin
26 Apr, 2023, 14:31

Now run docker compose up -d

Binyamin
26 Apr, 2023, 14:31

And let me know what happened

tsalira
26 Apr, 2023, 14:33
Binyamin
26 Apr, 2023, 14:33

Give it a couple of minutes and try to access the domain.

tsalira
26 Apr, 2023, 14:33

Ok

tsalira
26 Apr, 2023, 14:34

port number?

Binyamin
26 Apr, 2023, 14:34

No port number Just the domain

tsalira
26 Apr, 2023, 14:34

cool

tsalira
26 Apr, 2023, 14:37

The index page for that website is load as it was before

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