docker-compose up mysql
Download the backup file from your S3 bucket:
sh backup/download.sh
Copy the backup file to the MySQL container:
docker cp ./backup/monica.sql mysql:/
Access the container, create the database and the user, and,restore data:
docker exec -it mysql bash
mysql -u root -p"<password>"
CREATE DATABASE monica;
CREATE USER 'monica'@'%' IDENTIFIED BY 'monicapassword';
GRANT ALL PRIVILEGES ON monica.* TO 'monica'@'%';
FLUSH PRIVILEGES;
EXIT
mysql -u monica -p"monicapassword" monica < monica.sql
Add the following lines to the .env
file:
MONICA_DB_DATABASE=monica
MONICA_DB_USERNAME=monica
MONICA_DB_PASSWORD=monicapassword
Remove 2FA from old users (reference):
mysql -u monica -p monicapassword
use monica;
SELECT id,first_name,google2fa_secret FROM users;
UPDATE users SET google2fa_secret=NULL WHERE id=USER_ID;
We've followed the instructions on this example to make Monica supervisor works to send automatic notifications and reminders.
https://github.com/monicahq/monica/blob/main/.env.example
We've also created a fallback for Monica container to help us debug eventual issues. For example, if HTTPS Gateway Timeout occurs and Monica fallback is working, we can assume that the issue should be on Traefik.
Add MONICA_FALLBACK_PORT
to the .env
file. This way you can access Monica over HTTP on http://$MONICA_URL:$MONICA_FALLBACK_PORT
. You'll see the website without styles because Monica environment is production and it redirects to HTTPS the network requests.
Don't forget to allow the fallback port on EC2 security group.
Configure Traefik dashboard secure adding the following commands to the .env
file:
TRAEFIK_URL
: The URL of the Traefik dashboard. You should configure it on your DNS provider.TRAEFIK_BASIC_AUTH
: Execute the commandhtpasswd -nb USER PASSWORD
to generate the basic auth credentials (reference).
Create acme.json
file to store the ACME credentials:
touch acme.json
chmod 600 acme.json
Once you've configured the environment variables, you can start the containers:
./start.sh
Check if docker-compose replace all environment variables running the command docker-compose config
.