The user Jagster encountered an error when trying to run a backup command via launcher run app, which failed due to Redis not being available in the new container context. supermathie clarified that the command should be run inside the existing container using docker exec app, and suggested using discourse backup --sql-only for database-only backups. Jagster expressed difficulty with scheduling backups due to the complexity of Docker containers, but after learning about docker exec, found a simple solution using cron on the host system 6. The original error, Couldn't connect to Redis, was due to Redis not running in the isolated container environment 7.
/var/discourse/launcher run app "echo 'BackupRestore::Backuper.new(Discourse.system_user.id, with_uploads: false).run' | rails c"
If I take rails c route backuping works. But that oneliner should work too — or it is worked back 2020 (or was it -22…)
And what I really try to do is get just database dump, packed, in such place I can move it to S3. And no, I don’t want to do it manually, backuping must be automated. And no, once a day is not enough, because I don’t want miss worth of 24 hours stuff if something goes badly south.
Because Docker and containers are horrible places, where nothing works, like crontab and nano I know, kind of, what I do when I see /var/discourse but after ./launcher enter app I am totally lost. That’s why my Mastodon-server backups itself, but Discourse not (well, once a day yes, but still).
Yes, I know discourse backup do what I want, it even sends the dump to S3, but I don`t how to time it — because that horrible and terryfying container thingy, that is an OS inside an OS.
Couldn't connect to Redis
bundler: failed to load command: pry (/var/www/discourse/vendor/bundle/ruby/3.3.0/bin/pry)
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/redis-4.8.1/lib/redis/client.rb:398:in `rescue in establish_connection': Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) (Redis::CannotConnectError)
Amd after that was a mile long list where every line started from and there was zillion different ruby things, gems etc. It didn’t look very interesting.