katefike / sage

A personal finance app that's like Mint, but better. It uses a dockerized postfix/dovecot email server. Parses transaction data from alert emails.
MIT License
5 stars 0 forks source link

Add DO Droplet volumes #129

Closed katefike closed 5 months ago

katefike commented 7 months ago

https://docs.digitalocean.com/products/volumes/getting-started/quickstart/

katefike commented 7 months ago

Related Create a docker volume for the mx container: https://github.com/katefike/sage/issues/28

katefike commented 6 months ago

DB ERRORS

sage-db          | initdb: error: directory "/var/lib/postgresql/data" exists but is not empty
sage-db          | It contains a lost+found directory, perhaps due to it being a mount point.
sage-db          | Using a mount point directly as the data directory is not recommended.
sage-db          | Create a subdirectory under the mount point.

Resolved by mounting a subdir of the mount dir.

/mnt/sage_db/data:/var/lib/postgresql/data
katefike commented 6 months ago

MX ERRORS

sage-mailserver  | /postfix_dovecot_config.sh: line 8: ![[: command not found
sage-mailserver  | find: '/etc/opendkim/domainkeys': No such file or directory
sage-mailserver  | useradd: user 'kfike' already exists
sage-mailserver  | New password: Retype new password: passwd: password updated successfully
sage-mailserver  |  * Reloading Postfix configuration...
sage-mailserver  |    ...fail!
sage-mailserver  |  * Restarting IMAP/POP3 mail server dovecot
sage-mailserver  |    ...done.
sage-mailserver  | mkdir: cannot create directory '/home/kfike/Maildir': File exists
sage-mailserver  | /usr/lib/python3/dist-packages/supervisor/options.py:470: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
sage-mailserver  |   self.warnings.warn(
sage-mailserver  | Error: The directory named as part of the path /var/log/supervisor/supervisord.log does not exist
sage-mailserver  | For help, use /usr/bin/supervisord -h
sage-mailserver exited with code 2
sage-mailserver  | /postfix_dovecot_config.sh: line 8: ![[: command not found
sage-mailserver  | find: '/etc/opendkim/domainkeys': No such file or directory
sage-mailserver  | useradd: user 'kfike' already exists
sage-mailserver  | New password: Retype new password: passwd: password updated successfully
sage-mailserver  |  * Reloading Postfix configuration...
sage-mailserver  |    ...fail!
sage-mailserver  |  * Restarting IMAP/POP3 mail server dovecot
sage-mailserver  |    ...done.
sage-mailserver  | mkdir: cannot create directory '/home/kfike/Maildir': File exists
sage-mailserver  | /usr/lib/python3/dist-packages/supervisor/options.py:470: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
sage-mailserver  |   self.warnings.warn(
sage-mailserver  | Error: The directory named as part of the path /var/log/supervisor/supervisord.log does not exist
sage-mailserver  | For help, use /usr/bin/supervisord -h
sage-mailserver exited with code 2

- The problem is that the container mounts /mnt/sage_mailserver/var/log/, which lacks a supervisord.log file. Then the container crashes when this file isn't found.
  - is mail.log created on startup and supervisord.log isn't? -> yes
  - create a supervisord.log file at the same time as mail.log file in the entrypoint.sh script
  - what is supervisord.log even used for?
katefike commented 6 months ago

MX/TLS ERRORS

katefike commented 6 months ago

Old firewall image

katefike commented 6 months ago

Instructions from DO about mounting the volume

Create a mount point for your volume mkdir -p /mnt/sage_db mkdir -p /mnt/sage_mailserver

Mount your volume at the newly-created mount point: sudo mount -o discard,defaults,noatime /dev/disk/by-id/scsi-0DO_Volume_sage-db /mnt/sage_db mount -o discard,defaults,noatime /dev/disk/by-id/scsi-0DO_Volume_sage-mailserver /mnt/sage_mailserver

Change fstab so the volume will be mounted after a reboot echo '/dev/disk/by-id/scsi-0DO_Volume_sage-db /mnt/sage_db ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab echo '/dev/disk/by-id/scsi-0DO_Volume_sage-mailserver /mnt/sage_mailserver ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab

katefike commented 6 months ago

Sanity Check: is the volume mounted?