Deploying WriteFreely on a Coolify VPS with MySQL
#coolify #writefreely #vps #mysql
I currently run a Coolify instance on my VPS and recently decided to host a lightweight blogging platform. I managed to deploy WriteFreely using the open-source algernon/writefreely Docker image. While the initial deployment was straightforward, configuring the storage and database correctly required some specific steps. Here is a walkthrough of how I achieved a stable setup.
1. The Docker Configuration
First, I pulled the Docker image and deployed it via Coolify. The primary challenge was configuring persistent storage. By default, if you restart the container, you lose your configuration, which makes the service unusable in production.
To address this, I configured Coolify to create a persistent volume. I mapped a volume named wf_data to /data inside the container. This step is critical because the config.ini file needs to reside in this directory to persist across restarts.
2. Adding a Standalone MySQL Database
I preferred not to use the default SQLite engine, so I decided to provision a standalone MySQL database service within Coolify. The process is remarkably straightforward: you simply create a new resource, select MySQL, and let Coolify handle the password generation.
The tricky part was establishing the connection between the app and the database. I initially encountered “Access Denied” errors because I was attempting to use the default mysql user. Once I updated the credentials in the configuration file to use the root user (or a dedicated user with proper permissions), the connection worked perfectly.
3. Linking the Components
To ensure WriteFreely correctly reads from the persistent volume, I had to modify the startup command. I couldn't immediately locate the command field in the UI, so I utilized the Docker Compose configuration to override the entry point:
/bin/sh -c "./writefreely -c /data/config.ini"
Additionally, I ran the configuration wizard directly inside the terminal to generate the initial config.ini. I made sure to point the encryption keys and database paths specifically to /data.
Conclusion
I now have a fully functional WriteFreely instance running on my VPS, complete with persistent storage and a robust MySQL backend. It is a highly efficient and self-contained setup.
Thanks for reading! If you found this helpful: