A guide to installing Monica on a Synology NAS.
- Go to the Synology DiskStation Manager (DSM). By default it's at
https://<NAS_ip>:5000/
. - Open the Package Center.
- At the top in the search bar type MariaDB.
- Hit install on the MariaDB package. You'll be required to provide a password for the root user of the DB.
- After installation is complete, open the MariaDB package in the Package Center.
- Make sure the
Enable TCP/IP connection
option is enabled. Change the port if you want. Hit apply.
- Open up an SSH session to the NAS.
- Connect to the Database locally using the password you provided earlier:
/usr/local/mariadb10/bin/mysql -u root -p
- Create the DB and user that Monica will use. You'll need DB name, DB user and password later on.
CREATE DATABASE monica_db; GRANT ALL PRIVILEGES ON monica_db.* TO 'monica_user'@'%' IDENTIFIED BY 'newpassword'; FLUSH PRIVILEGES;
- If you want restrict which IP that user can connect from, replace
%
with the desired IP.
🪲 If you need to debug MariaDB issues, the error log is available at
/var/packages/MariaDB10/target/mysql/io.err
Here we'll set up storage so that some of the data from the container can be persisted on the NAS itself. This will allow us to update the image and not have to worry about having to re-create pictures or other files.
- If you already have a user dedicated to allowing containers access to files on the NAS, skip this section. Otherwise, create a folder on your NAS where you'll store the files from Monica.
- Using Synology's Control Panel, create a user and a group. These will be used exclusively so that the container can access files on the NAS so the only permissions they need are read/write on the folder you just created. Go ahead and set up the permissions.
- Log into the NAS using SSH (Do this with your regular user, not the dedicated one). Then type
id docker_user
replacing "docker_user" with the user you just created; make a note of theuid
andgid
(You'll need them later).
- Open the Docker package in Package Center.
- In the Registry tab, search for Monica and download the image
monica
. Use the latest tag for the most up to date image. - Next, you'll either need create the container. You can achieve this by importing the provided JSON file or by adding one from the Image tab in docker.
- Before launching the container, you'll need to edit the values of some of the environmental variables. In the Container tab right click the Monica container and Edit, then head to the Environment tab. Alternatively edit the JSON file before importing.
- Variables starting with
MAIL_
: If you want to receive e-mail reminders, change those values to suit your e-mail provider. HASH_SALT
: Change this to a random string of your choice.APP_ENV
: This value must belocal
, otherwise you won't be able to connect.- Variables starting with
DB_
: Change these to the values you used earlier for the DB setup. APP_DEBUG
: This is set tofalse
in the provided file but might be worth flipping totrue
if you're doing some debugging.PUID
andPGID
: Match these to the corresponding ones of the Synology user you're using to manage storage for the container.
- Variables starting with
- You may also want to modify the port settings, so that the an unused port on the NAS is mapped to the container's port 80.
- Make sure to edit the Volume settings to reflect your own. Select the folder you created to store Monica's files and set
/var/www/monica/storage
as the mount path. - Start the container, then right click on it and go into Details. Go to the terminal tab. You should see the terminal output while Monica sets up the DB. This step will take a while (In my case it took almost 20 mins). The step that took the longest was:
✓ Performing migrations '/usr/bin/php7' 'artisan' migrate --force
- After set up is done, open Monica on your browser, if you used the provided JSON file it should be at
http://<NAS_ip>:4000/
.
🪲 To test your e-mail setup, open up a
sh
terminal on the container and runphp artisan monica:test-email
⚠️ Clearing the container will remove any data in it. While the database should still be intact, you may lose local files such as images unless you've set up storage as suggested above
- Open the Docker package in Package Center.
- In the Registry tab, search for Monica and download the image
monica
. Use the latest tag for the most up to date image, this will replace the existing image. - After the download is complete, stop the container. Then right click on it and under Action select Clear. The container may disappear for a few seconds.
- Start the container again. It should be using the newest image.