Filament Manager, external database. Can't configure

Hi,

I've been fighting to get external database to work but no success. Wiki page has instructions for Arch Linux, but it is not working to Jessie. I have tried to do same steps, but can't make it work.

Goal is to run database on one of Octoprint Raspberries and others to connect to this database.

Has anyone managed to get this working? Is there better instructions somewhere, tried to search..
All help is welcome. Thank You,

-juha

What's your issue? In general the guide for Arch Linux should be also applicable for Debian based distributions.

Ok,

most of steps does not match with Jessie, commands does not exist or things are in different folders. I managedto install everything, I guess without errors, but I'm not too confident.

Not sure if virtual environment point went ok, but managed to install psyopg2.

On "host octoprint_filamentmanager octoprint 192.168.178.1/24 md5" instruction says "adapt IP to your network" Not clear which IP is to put here. I run Octoprint on 192.168.0.75, but should I use same address here too? I did but could not connect.

On database-tab, I did put Octoprint IP on URI and other points as in instructions, but test connection button stays red while pressing it.

It would be nice, if someone could make step-by-step instructions for latest Octoprint releases. Present instructions are for Linux enthusiast more than for average 3D-printer user.

-juha

All commands should be present if you have the postgresql and postgresql-client package installed (I just took a brief look at the Debian package list).

If your raspberry Pi IP is 192.168.0.75 you need to specify your network in the pg_hba.conf with 192.168.0.1/24.

The information from the log files might be interesting if the connection test fails.

I would make a guide for Raspbian too, but I haven't any unused SD card flying around right now.

Edit: If you are still running Jessie you should upgrade to Stretch or install the package from the backports repository otherwise you can run into issues, because there is at least version 9.5 required.

Hi,

is that IP 19.168.0.1 correct as it is Default Gateway in my network.

Attached piece of log after rebooting and pressing test-button:Log.log (7.9 KB)

This has nothing to do with the default gateway. 192.168.0.1/24 specifies an IP range from 192.168.0.1 to 192.168.0.254.

host octoprint_filamentmanager octoprint 192.168.0.1/24 md5

This means you're allowing each client within that IP range to access the octoprint_filamentmanager database with the user octoprint.

2018-04-27 15:53:11,751 - octoprint.plugins.filamentmanager - ERROR - Failed to initialize database: No module named psycopg2

You also need to install the psycopg2 module to your virtualenv :wink:

I did install psycopg2 as following:

Changed dir to: /Home/Pi/OctoPrint

  1. virtualenv -p /usr/bin/python2 venv

  2. sudo apt-get install libpq-dev this needs be installed, otherwise errors on psycopg2 installation.

  3. ~/OctoPrint/venv/bin/pip install psycopg2

1 Like

Without any experience with the filament manager plugin, if you are running OctoPi (which based on your log you are) this was wrong. OctoPi already has a virtual environment where OctoPrint and plugins are installed, and that's at /home/pi/oprint. So try ~/oprint/bin/pip install psycopg2.

1 Like

Thanks. ~/oprint/bin/pip install psycopg2 did the trick. I was able to get test button green, but only on 192.168.0.75 which is my Octoprint and Filament Manager running.

So, I have two Octoprint's on network: one at 192.168.0.75 and other on 192.168.0.76.

192.168.0.75 is running database, Octoprint at 192.168.0.75 can connect to database (green button) and can add entries on database. Connection to database at settings page is possible only to address 192.168.0.75. On any other address 192.168.0.xxx connection test fails.

Other Octoprint running at 192.168.0.76 cannot connect to database at all. Tried 192.168.0.75 and other addresses 192.168.0.xxx

I have tried to change listen_addresses = '*' to listen_addresses = '0.0.0.0' but no difference.

So, what might be reason that other Octroprint with ilament Manager installed can connect to database?

Have you added

host octoprint_filamentmanager octoprint 192.168.0.1/24 md5

to the pg_hba.conf ?

Yes, I did. Octoprint (192.168.0.75) running database, can only make connection to database when URI ise set to: postgresql://192.168.0.75. If I use different address, no connection.

Other Octoprint at 192.168.0.76, cannot connect to database, no matter which IP is tried on URI.

Attached log, after rebooting.. There is some error on Filament Manager code.log2.log (8.6 KB)

Hmm, selecting spool gives error...

spool.log (726 Bytes)

Can't help if I don't know how your configuration looks like. Did you followed the guide from the wiki?

See my second post.

Hmmm, did I understood somethng wrong here? I thought that:

  1. One Raspberry Pi (Pi3 in my case) can run Octoprint and Filament Manager plugin with external database.

  2. Other Raspberry Pi's running Octoprint and Filament Manager plugin, can connect to database running on 1.

Point 1 is working partially. Can connect to external database, add spool. But when selecting spool comes error, like on spool.log.

Point 2, is not working at all, cannot make connection to database located at another Pi.

Yes, followed guide, as said it works partially. If I can get it into state that connection to external database is ok, can add spool, but selecting gives error.

found out that: sudo apt-get install postgresql does install postgreql version 9.4.15, but instructions it says:

"Support for PostgreSQL (>=9.5) as common database for multiple OctoPrint instances"

Could this be the problem and if yes, how can I upgrade?

Some progress on upgrading.. But is this ok now?

psql

Have you done "sudo apt-get update" and "sudo apt-get upgrade"? The "update" will get the latest package database and the "upgrade" will update all of your installed packages to the latest version(s).

Yes, I have done that. To get postgresql to version >=9.5 is not that simple on Debian 8 Jessie. Trying to upgrade to Stretch. If it doesn't work, then install Stretch and try ti install Octoprint manually.

Isn't the OctoPi 0.15-rc1 a good starting point?

You can either upgrade to stretch or install the package from the backports repository as said before.