amazon-ecss3fs

s3fs not receiving s3 updates on ECS container


I have an ECS container running that is not receiving updates from new files written to the s3 bucket it is mounting.

Meaning, when a new file is written to the S3 bucket, I am unable to see it in the container I am mounting in.

Image:

FROM cubejs/cube:v0.29.17

RUN apt-get update
RUN apt-get -y install s3fs

COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

CMD ["cubejs", "server"]

entrypoint.sh:

#!/bin/bash
set -e

bucket=muhbucket
[ ! -d /cube/conf/schema ] && mkdir /cube/conf/schema
s3fs ${bucket} /cube/conf/schema -o ecs
echo "Mounted ${bucket} to /cube/conf/schema"

exec "$@"

Solution

  • s3fs 1.87 and later have a stat_cache_expire value of 900 seconds (15 minutes) which can delay updates. You can reduce this value although it will make operations like readdir slower. s3fs 1.86 and older cached files forever which made multi-client updates impossible. Some older Linux distributions like Ubuntu 20.04 continue to ship these older s3fs versions so you might accidentally be using these.