dokku / dokku-redis

a redis plugin for dokku
MIT License
256 stars 39 forks source link

Empty backups created on AWS #237

Open giovantenne opened 1 year ago

giovantenne commented 1 year ago

I'm running a dockerized instance of dokku 0.29.1 like explained here: https://dokku.com/docs/getting-started/install/docker/ with a couple of rails apps and linked postgres services.

I created a bucket lollipop-pg-bakups and an IAM policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "s3:ListAllMyBuckets",
                "s3:GetBucketLocation"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::lollipop-pg-backups",
                "arn:aws:s3:::lollipop-pg-backups/*"
            ]
        }
    ]
}

I run dokku postgres:backup-auth lollipop-db AKIxxxxxxxxxxxxxx63LH lHixxxxxxxxxxxxxxxxxxxxxxxlnLY an than dokku postgres:backup lollipop-db lollipop-pg-backups and I obtain the following output: 2023-01-03-14-59-01: The backup for postgres-lollipop-db finished successfully.

After this a a file named postgres-lollipop-db-2023-01-03-14-59-01.tgz is correctly created on AWS but the tgz file is 111.0 B and only contains an empty buckup directory.

I actually don't know how to debug this further...

aevenot commented 1 year ago

I have the same issue. Do you use a custom network (like me) in your postgres service ?

josegonzalez commented 1 year ago

Do y'all install dokku via docker?

aevenot commented 1 year ago

Do y'all install dokku via docker?

Yes. I have installed it with docker on my vps and I am using custom network du to others products installed on the same server.

giovantenne commented 1 year ago

I have the same issue. Do you use a custom network (like me) in your postgres service ?

No, no custom network

Do y'all install dokku via docker?

Yes

josegonzalez commented 1 year ago

I wonder if there is some weird interplay here with how mounted volumes work in conjunction with the backup being created due to the place where files are written to not being the same on the host...

aevenot commented 1 year ago

You-re right, some actions are taken inside the dokku container and other on the host. Here is my workaroud:

Add a volume used for backup in my dokku container .docker-compose.yml ` volumes:

Change the backup script to create the tmp folder inside the dokku container /var/lib/dokku/plugins/available/postgres/common-functions line 282

BACKUP_TMPDIR=$(docker exec -u dokku dokku mktemp -d --tmpdir=/backups )
BACKUP_PARAMETERS="$BACKUP_PARAMETERS -v /dokku_folder/backups:/backup"

Now backups are ok in my minio server

josegonzalez commented 1 year ago

Nice! I wonder how we can do that keeping our existing support....

Maybe we can expose an env var that is like "DOKKU_HOST_TMP_DIR` or something?

aevenot commented 1 year ago

Maybe. I have no support in my solution, I have installed it on my vps to allow me to deploy my applications easily.

Installing dokku with docker is really supported ? I have encountered many problems due to this implementation, maybe the vagrant setup is better for starting.

josegonzalez commented 1 year ago

It is supported but its not the thing I test on my end via unit tests, hence why sometimes certain features are broken. Its easy to break something you're not actively testing or aware of :)

That said, I rely on folks to report issues and help debug/resolve them when I don't have time to do so on my own. Hopefully now that we know the issue, I can spend some time soon resolving it :)