I just installed a different database server (MongoDB) on a Pi yesterday. I was surprised to see that the default installation just bound it to the localhost port of 127.0.0.1 and not to all IP addresses on that machine. So in my case, I had to edit that to 0.0.0.0 which means (all addresses).
You might need to edit your pg_hba.conf so try researching this.
If it were me, I'd check the postgresql log to see if it indicates some sort of error. I'd also consider adjusting the log level for this plugin in the Settings area and then look at the octoprint.log file itself. In fact, it is probably logging any errors there already.
Hi, I have a raspberry to control two printers.
I followed the tutorial until the end, but I can't connect to the database.
Could it be something related to the IP or the localhost? What configuration would be necessary?
Thanks
Sorry to reopen an older thread.
I'm currently trying to setup the database on a fresh Octopi setup. Step 1 thru 14 go smoothly, step 15 not. I get the error that the directory does not exist. What is going wrong?
pi@octopi:~ $ ~/oprint/bin/pip install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pip
Downloading https://www.piwheels.org/simple/pip/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
|████████████████████████████████| 1.5MB 1.1MB/s
Installing collected packages: pip
Found existing installation: pip 19.3.1
Uninstalling pip-19.3.1:
Successfully uninstalled pip-19.3.1
Successfully installed pip-20.1.1
pi@octopi:~ $ sudo reboot now
[sudo] password for pi:
Connection to octopi.local closed by remote host.
Connection to octopi.local closed.
MacBook-Pro-van-Fabian-2:~ Fabian$ ssh pi@octopi.local
pi@octopi.local's password:
Linux octopi 4.19.118-v7+ #1311 SMP Mon Apr 27 14:21:24 BST 2020 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri May 29 15:48:07 2020 from fe80::c9a:baed:7815:6bc6%wlan0
------------------------------------------------------------------------------
Access OctoPrint from a web browser on your network by navigating to any of:
http://octopi.local
http://192.168.0.134
https is also available, with a self-signed certificate.
------------------------------------------------------------------------------
This image comes without a desktop environment installed because it's not
required for running OctoPrint. If you want a desktop environment you can
install it via
sudo /home/pi/scripts/install-desktop
------------------------------------------------------------------------------
OctoPrint version : 1.4.0
OctoPi version : 0.17.0
------------------------------------------------------------------------------
pi@octopi:~ $ sudo apt-get install libpq-dev python-dev
[sudo] password for pi:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-dev is already the newest version (2.7.16-1).
Suggested packages:
postgresql-doc-11
The following NEW packages will be installed:
libpq-dev libpq5
0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.
Need to get 302 kB of archives.
After this operation, 1,286 kB of additional disk space will be used.
Get:1 http://mirror.serverius.net/raspbian/raspbian buster/main armhf libpq5 armhf 11.7-0+deb10u1 [151 kB]
Get:2 http://mirror.serverius.net/raspbian/raspbian buster/main armhf libpq-dev armhf 11.7-0+deb10u1 [151 kB]
Fetched 302 kB in 1s (551 kB/s)
Selecting previously unselected package libpq5:armhf.
(Reading database ... 47379 files and directories currently installed.)
Preparing to unpack .../libpq5_11.7-0+deb10u1_armhf.deb ...
Unpacking libpq5:armhf (11.7-0+deb10u1) ...
Selecting previously unselected package libpq-dev.
Preparing to unpack .../libpq-dev_11.7-0+deb10u1_armhf.deb ...
Unpacking libpq-dev (11.7-0+deb10u1) ...
Setting up libpq5:armhf (11.7-0+deb10u1) ...
Setting up libpq-dev (11.7-0+deb10u1) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
pi@octopi:~ $ ~/oprint/bin/pip install psycopg2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting psycopg2
Downloading psycopg2-2.8.5.tar.gz (380 kB)
|████████████████████████████████| 380 kB 2.1 MB/s
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... done
Created wheel for psycopg2: filename=psycopg2-2.8.5-cp27-cp27mu-linux_armv7l.whl size=422736 sha256=0853de2808990da3bb56eb826f68e083c744f0c5f0037808598689593d96ee30
Stored in directory: /home/pi/.cache/pip/wheels/4a/a6/2c/67b73db8a215e7bc4805efe56b7f354795a490f17bc6547da4
Successfully built psycopg2
Installing collected packages: psycopg2
Successfully installed psycopg2-2.8.5
pi@octopi:~ $ sudo reboot now
Connection to octopi.local closed by remote host.
Connection to octopi.local closed.
MacBook-Pro-van-Fabian-2:~ Fabian$ ssh pi@octopi.local
pi@octopi.local's password:
Linux octopi 4.19.118-v7+ #1311 SMP Mon Apr 27 14:21:24 BST 2020 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri May 29 15:52:43 2020 from fe80::c9a:baed:7815:6bc6%wlan0
------------------------------------------------------------------------------
Access OctoPrint from a web browser on your network by navigating to any of:
http://octopi.local
http://192.168.0.134
https is also available, with a self-signed certificate.
------------------------------------------------------------------------------
This image comes without a desktop environment installed because it's not
required for running OctoPrint. If you want a desktop environment you can
install it via
sudo /home/pi/scripts/install-desktop
------------------------------------------------------------------------------
OctoPrint version : 1.4.0
OctoPi version : 0.17.0
------------------------------------------------------------------------------
pi@octopi:~ $ sudo apt-get install postgresql
[sudo] password for pi:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libllvm7 libxslt1.1 postgresql-11 postgresql-client-11
postgresql-client-common postgresql-common sysstat
Suggested packages:
postgresql-doc postgresql-doc-11 libjson-perl isag
The following NEW packages will be installed:
libllvm7 libxslt1.1 postgresql postgresql-11 postgresql-client-11
postgresql-client-common postgresql-common sysstat
0 upgraded, 8 newly installed, 0 to remove and 7 not upgraded.
Need to get 27.0 MB of archives.
After this operation, 105 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.serverius.net/raspbian/raspbian buster/main armhf libllvm7 armhf 1:7.0.1-8+rpi3 [11.4 MB]
Get:2 http://mirror.serverius.net/raspbian/raspbian buster/main armhf libxslt1.1 armhf 1.1.32-2.2~deb10u1 [215 kB]
Get:3 http://mirror.serverius.net/raspbian/raspbian buster/main armhf postgresql-client-common all 200+deb10u3 [84.9 kB]
Get:4 http://mirror.serverius.net/raspbian/raspbian buster/main armhf postgresql-client-11 armhf 11.7-0+deb10u1 [1,284 kB]
Get:5 http://mirror.serverius.net/raspbian/raspbian buster/main armhf postgresql-common all 200+deb10u3 [225 kB]
Get:6 http://mirror.serverius.net/raspbian/raspbian buster/main armhf postgresql-11 armhf 11.7-0+deb10u1 [13.3 MB]
Get:7 http://mirror.serverius.net/raspbian/raspbian buster/main armhf postgresql all 11+200+deb10u3 [60.9 kB]
Get:8 http://mirror.serverius.net/raspbian/raspbian buster/main armhf sysstat armhf 12.0.3-2 [513 kB]
Fetched 27.0 MB in 10s (2,596 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libllvm7:armhf.
(Reading database ... 47426 files and directories currently installed.)
Preparing to unpack .../0-libllvm7_1%3a7.0.1-8+rpi3_armhf.deb ...
Unpacking libllvm7:armhf (1:7.0.1-8+rpi3) ...
Selecting previously unselected package libxslt1.1:armhf.
Preparing to unpack .../1-libxslt1.1_1.1.32-2.2~deb10u1_armhf.deb ...
Unpacking libxslt1.1:armhf (1.1.32-2.2~deb10u1) ...
Selecting previously unselected package postgresql-client-common.
Preparing to unpack .../2-postgresql-client-common_200+deb10u3_all.deb ...
Unpacking postgresql-client-common (200+deb10u3) ...
Selecting previously unselected package postgresql-client-11.
Preparing to unpack .../3-postgresql-client-11_11.7-0+deb10u1_armhf.deb ...
Unpacking postgresql-client-11 (11.7-0+deb10u1) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack .../4-postgresql-common_200+deb10u3_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (200+deb10u3) ...
Selecting previously unselected package postgresql-11.
Preparing to unpack .../5-postgresql-11_11.7-0+deb10u1_armhf.deb ...
Unpacking postgresql-11 (11.7-0+deb10u1) ...
Selecting previously unselected package postgresql.
Preparing to unpack .../6-postgresql_11+200+deb10u3_all.deb ...
Unpacking postgresql (11+200+deb10u3) ...
Selecting previously unselected package sysstat.
Preparing to unpack .../7-sysstat_12.0.3-2_armhf.deb ...
Unpacking sysstat (12.0.3-2) ...
Setting up postgresql-client-common (200+deb10u3) ...
Setting up postgresql-client-11 (11.7-0+deb10u1) ...
update-alternatives: using /usr/share/postgresql/11/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up postgresql-common (200+deb10u3) ...
supported-versions: WARNING! Unknown distribution: raspbian
debian found in ID_LIKE, treating as Debian
Adding user postgres to group ssl-cert
Creating config file /etc/postgresql-common/createcluster.conf with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /lib/systemd/system/postgresql.service.
Setting up libxslt1.1:armhf (1.1.32-2.2~deb10u1) ...
Setting up libllvm7:armhf (1:7.0.1-8+rpi3) ...
Setting up sysstat (12.0.3-2) ...
Creating config file /etc/default/sysstat with new version
update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/sysstat.service → /lib/systemd/system/sysstat.service.
Setting up postgresql-11 (11.7-0+deb10u1) ...
Creating new PostgreSQL cluster 11/main ...
/usr/lib/postgresql/11/bin/initdb -D /var/lib/postgresql/11/main --auth-local peer --auth-host md5
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_GB.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/11/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Europe/London
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctlcluster 11 main start
Ver Cluster Port Status Owner Data directory Log file
11 main 5432 down postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
update-alternatives: using /usr/share/postgresql/11/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
Setting up postgresql (11+200+deb10u3) ...
Processing triggers for systemd (241-7~deb10u4+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
pi@octopi:~ $ sudo -u postgres -i
postgres@octopi:~$ createuser --interactive -P
Enter name of role to add: octoprint
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
NOTICE: empty string is not a valid password, clearing password
postgres@octopi:~$ createdb -O octoprint octoprint_filamentmanager
postgres@octopi:~$ exit
logout
pi@octopi:~ $ sudo nano /etc/postgresql/9.6/main/postgresql.conf
pi@octopi:~ $
I'm not an expert on postgresql but I'm going to take a wild guess that between July 2019 and now, there was a new version of postgresql (old version 9.6, new version 11.7). Please do some examination of the directory tree starting with ls /etc/postgresql and see if you can't find the postgresql.conf file. Use the same cleverness to modify all the steps that mention 9.6 and you should make progress.
I have green test on the host OctoPrint server and on my 2nd server. How do I get my existing database to show up now? I've rebooted both and I only see the existing database prior to setting up the postgresql database on the host. I see nothing on the 2nd.
I got this working last night and this morning it stopped. I'm giving up. This is more complicated than it needs to be and I can't find any simple updated instructions showing it working. It even appears this plugin has been abandoned. If anyone has other solutions to share a filament spools across 2 octoprint setups, please let me know.
Hi, I have followed all the steps several times and there is no way to connect. It seems that "sudo apt-get install postgresql" installs version 11, in the tutorials version 9.6 is used.
If I try to install version 9.6 with "sudo apt-get install postgresql-9.6" this information comes out:
pi@octopi:~ $ sudo apt-get install postgresql-9.6
Reading package lists ... Done
Building dependency tree
Reading state information ... Done
Note, selecting 'postgresql-9.6-repmgr' for regex 'postgresql-9.6'
But it didn't work for me, it doesn't connect, so I wanted to install version 9.6 to see if this is the problem. But it gives me the mistake I mentioned earlier.
Install postgresql 11 on one raspberry with Raspberry Pi OS 32bits, the other raspberry's with octoprint do not connect to the database.
Just an FYI, I got it working on postgresql v11. I am not sure if this will help, but for me it wasn't working until I disabled ssl in the "/etc/postgresql/11/main/postgresql.conf" file (ssl = off).
Also, I used a different database name, and reviewing the octoprint logs, the clients didn't update the database name until I restarted octoprint.
HTH
A few weeks ago I got it, it's something from the plugin, sometimes it doesn't start the connection with the database well, that's why it didn't connect. A reboot server is required.
I also managed to run postgresql inside a docker and connect with the plugin.
Hello tried to install Filament Manager,
but if I install psycopg2 I get the following error:
~/oprint/bin/pip install psycopg2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting psycopg2
Using cached psycopg2-2.8.5.tar.gz (380 kB)
ERROR: Command errored out with exit status 1:
command: /home/pi/oprint/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uCshxT/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uCshxT/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-yc_uiA
cwd: /tmp/pip-install-uCshxT/psycopg2/
Complete output (23 lines):
running egg_info
creating /tmp/pip-pip-egg-info-yc_uiA/psycopg2.egg-info
writing /tmp/pip-pip-egg-info-yc_uiA/psycopg2.egg-info/PKG-INFO
writing top-level names to /tmp/pip-pip-egg-info-yc_uiA/psycopg2.egg-info/top_level.txt
writing dependency_links to /tmp/pip-pip-egg-info-yc_uiA/psycopg2.egg-info/dependency_links.txt
writing manifest file '/tmp/pip-pip-egg-info-yc_uiA/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Can somebody tell me what is wrong
Have I octopi 4 setup with 1.4.2