ZettaIO / restic-compose-backup

Automatic restic backup of a docker-compose setup. https://hub.docker.com/r/zettaio/restic-compose-backup
MIT License
29 stars 16 forks source link

TypeError("str expected, not %s" % type(value).__name__) with mysql #25

Open clarity99 opened 4 years ago

clarity99 commented 4 years ago

I'm trying to configure this for the first time, so I might be doing something wrong. I've added the mysql label on a container and when i run rcb status I get this:

2020-05-15 22:11:30,214 - INFO: ------------------------- Detected Config -------------------------
2020-05-15 22:11:30,216 - INFO: service: backup
2020-05-15 22:11:30,216 - INFO:  - volume: /mnt/HC_Volume_2028726/src/restic-compose-backup/restic_cache
2020-05-15 22:11:30,216 - INFO:  - volume: /mnt/HC_Volume_2028726/src/restic-compose-backup/restic_data
2020-05-15 22:11:30,217 - INFO:  - volume: /mnt/HC_Volume_2028726/src/restic-compose-backup/src
2020-05-15 22:11:30,217 - INFO: service: mysql
Traceback (most recent call last):
  File "/usr/bin/rcb", line 11, in <module>
    load_entry_point('restic-compose-backup', 'console_scripts', 'rcb')()
  File "/restic-compose-backup/restic_compose_backup/cli.py", line 30, in main
    status(config, containers)
  File "/restic-compose-backup/restic_compose_backup/cli.py", line 98, in status
    ping = instance.ping()
  File "/restic-compose-backup/restic_compose_backup/containers_db.py", line 74, in ping
    with utils.environment('MYSQL_PWD', creds['password']):
  File "/usr/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/restic-compose-backup/restic_compose_backup/utils.py", line 87, in environment
    os.environ[name] = value
  File "/usr/lib/python3.7/os.py", line 684, in __setitem__
    value = self.encodevalue(value)
  File "/usr/lib/python3.7/os.py", line 754, in encode
    raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not NoneType

the mysql service is in a different docker-compose file, if that matters?

einarf commented 4 years ago

Probably missing enviroment variables in the mysql container: https://restic-compose-backup.readthedocs.io/en/latest/guide/configuration.html#mysql

As long as the backup service and communicate with the mysql host it will work.

Still this should probably produce a better error mesage.