I’ve followed every step to get this docker-compose setup going, yet for some reason stdout gets flooded with connection errors regarding redis:
streaming_1 | info Starting worker 5
streaming_1 | info Worker 5 now listening on 0.0.0.0:4000
streaming_1 | ERR! Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
streaming_1 | info Worker 5 exiting, bye bye
I don’t understand why this can’t connect: the redis container is starting just fine. However, after i run docker-compose run redis, the container runs fine but I am not able to see port 6379 exposed on 127.0.0.1, from a different terminal.
What am I missing here? I did have a systemd redis service running on the host, which I stopped cuz I was worried it might cause port conflicts (the host service isn’t doing anything anyway, it’s for an old program i don’t run anymore). The only change I made to docker-compose.yml is to change web to use port 3333 instead of 3000 (i have something running on that already).
Also, I’m getting db errors as well? it’s confusing since the docker instructions (edit: I guess docs.joinmastodon.com doesn’t have official docker instructions? looking around the internet it seems like they used to exist, but https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Docker-Guide.md gives a 404 and doesn’t seem to exist on the document site) don’t give any indication of having to initialize the db? i thought that was handled by the Dockerfile. (note: all the passwords and variables are defined in .env.production, as indicated above)
db_1 | Error: Database is uninitialized and superuser password is not specified.
db_1 | You must specify POSTGRES_PASSWORD to a non-empty value for the
db_1 | superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
db_1 | You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
db_1 | connections without a password. This is *not* recommended.
db_1 | See PostgreSQL documentation about "trust":
db_1 | https://www.postgresql.org/docs/current/auth-trust.html
You’ll note the ‘env_file’ option that I added to the ‘db’ service. This is required because the postgres db doesn’t properly initialize the way it is, the proper variables don’t get passed. You’ll find the .env.db file listed after the docker-compose.yml file (it’s short). Also, ElasticSearch is disabled.
EDIT: Also, I didn’t write up a complete how-to, so I don’t have the steps to generate the secrets required. There are plenty of tutorials online on how to do that which are easy enough to find.
# This identifies your server and cannot be changed safely later
# ElasticSearch (optional)
# Make sure to use `rake secret` to generate secrets
# Web Push
# Generate with `rake mastodon:webpush:generate_vapid_key`
# Sending mail
# Removed because I'm creating and approving all users manually via cli,
# cuz i don't have an smtp server
# File storage (optional)
And then just run docker-compose run --rm web rails db:migrate to populate the database.