Back

[SOLVED] Redis: You can't write against a read only replica

  • 0
  • Self Hosted
Drake
16 Feb, 2023, 23:29

docker compose down -v wipes all your Appwrite instance data so I'm not sure if that's good to do.

Are you using the built in redis from the Appwrite install?

TL;DR
The user encountered a "Redis: You can't write against a read only replica" issue in their Docker environment. They received suggestions to modify the `docker-compose.yml` file and to not port forward the Redis port. The user is unsure how to make these changes. They also provided some system information and mentioned that they made minor changes to the code. The last message indicates that the user's Appwrite instance is running in Docker with the code directly from the Appwrite GitHub repository. Solution: The user should try modifying the `docker-compose.yml` file and remove the port forwarding for Redis. They can refer to the provided links for more
Rafael Hengles
17 Feb, 2023, 00:56

Yes, the redis service is running in docker, but I am using the code directly from the Appwrite github repository, not from an install. I ran docker compose build and then start the containers normally.

Drake
17 Feb, 2023, 00:58

So you followed this? https://github.com/appwrite/appwrite/blob/master/CONTRIBUTING.md#setup-from-source

Are you trying to modify the source code?

Rafael Hengles
17 Feb, 2023, 00:59

Yes exactly, I have a couple of changes, but not anything remotely associated with redis.

Rafael Hengles
17 Feb, 2023, 01:00

I can send the repo so you can see

Drake
17 Feb, 2023, 01:02

Sure

Drake
17 Feb, 2023, 01:02

Odd... If you didn't change the .env file or docker compose file, I don't know what could go wrong...

Rafael Hengles
17 Feb, 2023, 01:05

Hmm, I did change these files, I'll send the link

Rafael Hengles
17 Feb, 2023, 01:09

It will take a while because I didn't push my latest changes yet. I'll do it tomorrow, it's late here, but thanks for the quick reply! <:appwritepeepo:902865250427215882>

Rafael Hengles
17 Feb, 2023, 15:57

Here are the extent of my changes: https://github.com/appwrite/appwrite/compare/master...arijs:appwrite:allow-db-query-without-index Basically I removed the check for indexes on filters and sorting, and added my refine app in a docker container and added it to the traefik proxy It's worth noting that my fork is a little behind from appwrite upstream. My fork begins on this commit from Jan 17, it's after tag 1.2.0 but before tag 1.2.1:

TypeScript
commit e72c5511b6e71959bffb51261f5c3826838f2e6e
Merge: a35cf0b4c 4cc135e8e
Author: Christy Jacob <christyjacob4@gmail.com>
Date:   Tue Jan 17 17:45:10 2023 +0530

    Merge pull request #4654 from appwrite/fix-test-warnings
    
    Fix null warnings
Rafael Hengles
17 Feb, 2023, 16:08

I don't know if it's related, but the docker-compose.yml I'm using is almost equal the one from github, which has a disclaimer that it is a development targeted version and not recommended for production. I was going to ask this separately, but how do I make this compose file ready for production ?

Drake
17 Feb, 2023, 16:29

Is this the only code related change you need to do?

Rafael Hengles
17 Feb, 2023, 16:33

So far, yes

Drake
17 Feb, 2023, 16:35

haha, ok. So, for minor patches, I'd suggest running the normal Appwrite installation, but either:

  1. use sed to modify the file before appwrite runs
  2. mount in a modified version of the file

And as for your custom app, I'd recommend putting a reverse proxy in front and using that to proxy to either appwrite or your app.

All of this is to try and keep the Appwrite stack close to the original as possible to make it easier to upgrade in the future.

Drake
17 Feb, 2023, 16:38

your docker compose and .env seem fine though...let me download the code and try to run it

Drake
17 Feb, 2023, 16:48

hmm wait...what are the specs on your server?

Rafael Hengles
17 Feb, 2023, 16:54

Here:

TypeScript
OS: Ubuntu 20.04 focal
Kernel: x86_64 Linux 5.4.0-136-generic
Uptime: 2d 23h 9m
Packages: 646
Shell: sh
Disk: 33G / 81G (42%)
CPU: Intel Xeon Gold 5218 @ 2x 2.295GHz
RAM: 1442MiB / 3893MiB

System information as of Fri 17 Feb 2023 04:52:59 PM UTC

  System load:                      0.0
  Usage of /:                       40.8% of 78.62GB
  Memory usage:                     30%
  Swap usage:                       0%
  Processes:                        233
  Users logged in:                  0

Before it was 2gb ram, but I upgraded it to 4gb it's a vps server

Rafael Hengles
17 Feb, 2023, 16:59

I can give this a try, but I have no idea how to do either of those changes, and I'm not afraid to search but this I don't know how to even begin Building the server from the code and starting it was the easiest way I could find

Drake
17 Feb, 2023, 20:35

You should probably not port forward the redis port

Drake
17 Feb, 2023, 20:47

I don't have an example of the sed option right now, but here's an example of the 2nd option: https://github.com/appwrite/appwrite/blob/3e3eaaf20913657312a16413e9a5fe0df6ebf9a9/docker-compose.yml#L80

Rafael Hengles
17 Feb, 2023, 22:44

It seems like it is! It is related to the question I made before about the development docker-compose.yml file. I searched the Docker docs and the port assigning in that file is only to the outside world, it is not required for communication between services, I didn't know that, this is the first time I'm using docker. But great deduction, awesome!

Rafael Hengles
17 Feb, 2023, 22:45

I'll explore this

Drake
20 Feb, 2023, 17:56

[SOLVED] Redis: You can't write against a read only replica

Drake
20 Feb, 2023, 18:01

Here's a sample of my docker-compose.override.yml file for the sed option:

TypeScript
version: '3'

services:

  appwrite:
    entrypoint:
      - /bin/sh
      - -c
    command:
      - sed -i -e "s/memory_limit', '512M/memory_limit', '1024M/g" /usr/src/code/app/init.php && php app/http.php -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php

This uses sed to update this line: https://github.com/appwrite/appwrite/blob/5d1ada46523a649f4c057d4c2ec1ad52fae60104/app/init.php#L15 before starting appwrite

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