Octoprint Filament Manager Plugin: How to setup postgresql database

Download and install Putty terminal application to SSL into your Pi. You may use other tools, but I am most comfortable with this one, and it works great.
sudo apt-get update Lets make sure we have all the latest updates!
sudo apt-get upgrade Install them!
sudo reboot now Reboot the Pi.
~/oprint/bin/pip install –upgrade pip Let’s just upgrade pip while we’re at it.
sudo reboot now Not sure if it’s necessary, but can’t hurt!
sudo apt-get install libpq-dev python-dev Install these dependencies first!
~/oprint/bin/pip install psycopg2 Now install psycopg2 (required as well)
sudo reboot now yeah, yea….again…just to be safe.
sudo apt-get install postgresql Install postgresql
sudo -u postgres -i become postgres user so we can create the octoprint user and database!
Now…your prompt will have changed, so next lets create the user via the interactive feature:
createuser –interactive -P
Enter the username: “octoprint”, and answer “n” to all the next questions about this user.
Now we create the database itself: createdb -O octoprint octoprint_filamentmanager
Now exit the user and back to the main prompt by typing: exit
Now we have to edit two files, the first one is here
sudo nano /etc/postgresql/9.6/main/postgresql.conf
In this file, find the line “listen_addresses = ” and change it to
listen_address = ‘*’
save your changes, then onto the next using:
sudo nano /etc/postgresql/9.6/main/pg_hba.conf
The Wiki says it best here, so you do this:
Then append the following line to /var/lib/postgres/data/pg_hba.conf
host octoprint_filamentmanager octoprint 192.168.178.0/24 md5
Adapt the IP address to your network, e.g. if your server has the IP 192.168.0.25 use 192.168.0.0/24 instead. This allows all clients in your network to access the database.
Last step…is to restart the service using: sudo systemctl restart postgresql.service
Now just enter the information into the database settings in Filament manager plugin, just like you set it up, and like the Wiki explains:
Picture shown at the bottom of this wiki page. Of course, enter in the IP address of YOUR Raspberry Pi that’s running the database (it can be the same one you’re running your octoprint on)
Once you click Test Connection button…if everything has gone correctly, the button will turn green, and you’ll need to restart Octoprint to save the settings.


Posted

in

by

Tags:

WordPress Appliance - Powered by TurnKey Linux