Requirements Domain Name VPS/VM

Optional Requirements Password Manager

The first step is locating a VPS, according to Forbes the top 3 VPS services are IONOS, GoDaddy, and DreamHost. I selected to use IONOS for my project. I chose their cheapest tier, as my blog doesn't get a ton of traffic. If you wanted to use technology that is a little more agile, you could look into Azure or Amazon LightSail. Most of these folks can also sell you a domain name as well, if you need to purchase one of those.

Once you have purchased a VPS and a domain name, you will need to connect to it to configure it. DigitalOcean has a good write up on connecting to a machine via SSH. Tools like PuTTy can be used if you are on a Windows machine.

Once you have connected you will need to create a user account, and disable the root login. This Baeldung article goes into reasoning as to why this should be disabled. Additionally, IBM has a great article on how you can set up RSA keys. Once you have tested and confirmed you can login with your key with the following command:

ssh -i /path/to/private/key user@host

To disable password login you can check your /etc/ssh/sshd_config file, there should be a PasswordAuthentication in that file, or one of its dependencies, that is set to yes and it needs to be set to no.

These commands are for Ubuntu:

$ adduser [username] $ usermod -aG sudo [username] $ passwd username

Before running this command, confirm you can login with the new username and run sudo commands, as this command will lock your root account. However, you may want to hold off on this command until after you are finished configuring WriteFreely, as file permissions between root and your user account can create a headache with automation.

$ sudo passwd -l root

Then set up sql db, I largely used this DigitalOcean article.

$ sudo apt install mysql-server $ sudo systemctl start mysql.service

Then you can open mysql, and set a password for the root account. I recommend using a password manager to keep track of passwords, KeePass, Keeper, and 1Password are great options.Additionally, I would create a service user for WriteFreely to use.


To get Write Freely to run on start up you need to create a service file: nano /etc/system/system/writefreely.service

[Unit] Description=Write Freely Instance

[Service] Type=simple StandardOutput=syslog StandardError=syslog WorkingDirectory=/var/www/[your.domain]/writefreely ExecStart=/var/www/[your.domain]/writefreely/writefreely Restart=always


Then run: sudo systemctl enable writefreely.service sudo systemctl start writefreely.service

If you reboot the VPS, WriteFreely should start after a few minutes. If it does not then you need to make sure root owns both the WriteFreely Binary, and config.ini. You can do this by using the chown command. Additionally you may need to use the chmod command on the WriteFreely binary in order to execute it.

At this point, you should have a working WriteFreely instance. Next time, we’ll explore some ways to use Ansible to automate the process, and some backup solutions for the data.

Thanks for reading!

A few months ago I started working on a PythonOCR python version of this. However, it was slow and more importantly, it was a pain to install on other machines. My primary motivation for writing this software is because I am in graduate school, and we often have long PDF files that we need to read. My eyes aren't what they used to be and sometimes it's nice to be able to change or bold the font, along with the usual benefit of making it bigger that you get with zooming in.

The goal was to create a means to scrape the text from PDF's so I could put them into a text editor and adjust the colors, fonts, etc to be easier to read. As mentioned, the python version of this was able to convert a wide variety of PDFs since it used OpenCV and Tesseract to extract the text from an image file that was created from a page in the pdf. As you can imagine this operation is expensive and it would take a few minutes to process a fairly large pdf. More importantly, I use a few different laptops for school depending on which one wants to cooperate on the given day, so this needed to be portable. The python version required installing python, poppler, and tesseract. You also had to set environment variables.

I began looking for a better portable solution. Initially I began to look into C or possibly C++ as options, primarily since Tesseract is mostly in C++, but then I came across Rust and it seemed interesting, so I began learning more. After reading ”The Book”, going through a few rounds of Rustlings, and banging my head on the wall at a Leptos/Actix app attempt, I decided to go back to this project. This seemed like a great candidate for Rust and for me to learn more, but I needed to find a GUI framework to facilitate my build. For this project I ended up using slint. Which was a fairly enjoyable experience for this simple app. I haven't yet had to worry about converting the pdf's to images or integrating Tesseract.

This currently uses the pdf-extract crate to handle extraction, and rusty file dialog to handle cross platform file prompts. It uses the std::fs crate to write to the file system. In my testing across various environments, it is cross platform, though more particular about pdfs that its python incarnation. It seems to like PDFs where text has been particularly defined, I have not had luck with PDFs which have text that is an unselectable, such as within an image (where OCR would provide benefit). I can use this for now, and if OCR is needed, add that later, or bring out the python version. This rust version takes about 10 seconds to process a 500 page pdf. The python version took considerably longer, though I don't remember exactly, and can add benchmarks later if I build it again.

This app is a GUI, so once you download, run cargo run and it should present you with a window with an Open file button. Once you click that, you can select a file, then it will process the file. Once it's done, you'll be prompted again to save the output.

Here's the repo:

Thanks for reading, and happy new year.