Installation on PostgreSQL¶
If you need expert help with this or any other issue, please see our terms and conditions technical support
When operating in production environments with a large number of cameras and motion detection enabled, we recommend using PostgreSQL as a more productive database.
A simple password is used in the examples, it is desirable to change it!
Running PostgreSQL on the host¶
To install, use the official instructions from the developer's website https://www.postgresql.org/download/
Quick installation in Debian or Ubuntu:
sudo apt install postgresql-common
sudo sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
sudo apt install postgresql-13 -y
After installation and launch, you need to create a database and a role to connect.
sudo -u postgres psql -c "CREATE DATABASE yucca;"
sudo -u postgres psql -c "CREATE USER yucca WITH PASSWORD 'yucca';"
sudo -u postgres psql -c 'GRANT ALL PRIVILEGES ON DATABASE yucca TO yucca;'
Running PostgreSQL in docker¶
Launch the official container with the necessary parameters:
docker run -d \
--name yucca-postgres \
--net host \
-e POSTGRES_USER=yucca \
-e POSTGRES_PASSWORD=yucca \
-e POSTGRES_DB=yucca \
postgres:13.4-alpine
Setting up the Yucca connection to the database¶
Stop the server:
sudo systemctl stop yucca
Specify the type postgres
in the parameter database.type, as well as other connection details:
example of the final configuration via a file:
[database]
busy_timeout = 500
ca_cert_path = "/etc/ssl/certs"
cache_mode = "shared"
client_cert_path = ""
client_key_path = ""
conn_max_lifetime = "0s"
host = "127.0.0.1:5432"
log_queries = false
max_idle_conn = 2
max_open_conn = 0
name = "yucca"
password = "yucca"
path = ""
ssl_mode = "disable"
type = "postgres"
user = "yucca"
Start the server:
sudo systemctl start yucca
Upon successful connection, the following messages can be seen in the log:
sudo journalctl -o short --no-pager -n 100 -f -u yucca
{"component":"server","level":"info","msg":"Starting...","time":"2021-11-10T06:27:20Z"}
{"component":"server","level":"info","msg":"Listen address: :9910","time":"2021-11-10T06:27:20Z"}
{"component":"sql","level":"info","msg":"PING DATABASE postgres","time":"2021-11-10T06:27:20Z"}
{"component":"server","level":"info","msg":"ORM engine initialization successful","time":"2021-11-10T06:27:21Z"}
{"component":"server","level":"info","msg":"Server initialization successful","time":"2021-11-10T06:27:21Z"}
PostgreSQL 14 and older¶
Supported since Yucca version 0.6.1, read more here https://gitlab.com/yuccastream/yucca/-/issues/820