One key thing I have yet to determine before we fully move our business over is how to backup our data. Admittedly I’m new to docker/portainer/containers and I have this running on a windows box, WSL2 (Ubuntu) with docker desktop and portainer. I’m not really sure if I needed portainer but it seems highly recommended by a lot of the research and videos I’ve seen.
So as a basic attempt I’ve tried to use the built-in backup function but I never receive an email (can confirm email is working for other tasks like sending invoices). Should this function be working? What are the best practices for backing this data up? As far as I understand and can see, the important files (env, flat mysql files, etc) all reside in a directory that I built the containers from following the video guide. I am not a linux pro and unsure if I should be looking for something that can simply backup those files or if I need to be setting up a task on the containers?
Looking for guidance. Super excited to start using this product just need be at a point I know I can restore should the inevitable happen.
We recommend using mysqldump to backup the database. You’ll also want to keep a copy of the .env file and the storage folder if you’re using the documents feature.
Invoiceninja is a LAMP stack app so you are free to backup however you prefer, here are a few pointers:
backup the database by mysqldump command.
you also need to backup the .env file as it contains the APP_KEY which is the decryption key for the application. If you lose this then you cannot login or use the previous InvoiceNinja data as it will be encrypted by the key (many things are encrypted- passwords/secrets, credit card tokens etc). If you’re on docker environment, then backup the docker-compose yml file as that contains the env variables.
backup the storage directory if you uploaded a logo file or used the documents feature because those files are stored here.
If you are hosting on cloud such as Azure and if you want to pay the price, can use the cloud provider’s full VM backup feature like Azure VM Backup job that replicates the entire VM every night, so you can go in and do a full 1-click restore of the full system if something happens later (but this restores the entire system, not only invoiceninja).
The most popular way is a backup script:
A cron (or powreshell if on windows) script can be created to automate all of the backup and send notifications over email/SMS or anything else such as push notification API. The backup file can be stored wherever you like, for example AWS bucket or sent somewhere over FTP etc., what ever is setup in the script.
The script can also be programmed to fetch all this from the docker containers if you’re using the docker version. I can program it for your preference/environment if you DM me.
If I uncomment the 4 lines as stated in the docker compose file and and rebuild, would that be all all I need to do get those automated backups rolling?