I have been trying to follow instruction steps for deployment of maas.
MAAS | How to do a fresh install of MAAS
Seemed very simple. But after several attepts… I keep getting what is connection errors. I figured it was at first that the documentation “A$$umed” you had postgres listening and disable firewall etc… so I did those also… but no change.
Below is quick set of setup steps I did / am doing: Then error on maas initialization:
sudo snap install --channel=latest/edge maas
sudo systemctl disable --now systemd-timesyncd
sudo apt update -y
sudo apt install -y postgresql
sudo apt install postgresql-client
Posgres Setup
MAAS_DBUSER=maasdbadmin
MAAS_DBPASS=password!
MAAS_DBNAME=$(hostname)_db
HOSTNAME=$(hostname)
sudo -i -u postgres psql -c "CREATE USER \"$MAAS_DBUSER\" WITH ENCRYPTED PASSWORD '$MAAS_DBPASS'"
sudo -i -u postgres createdb -O "$MAAS_DBUSER" "$MAAS_DBNAME"
echo "host $MAAS_DBNAME $MAAS_DBUSER 0/0 md5" |sudo tee -a /etc/postgresql/14/main/pg_hba.conf
echo "host all all 172.16.0.0/16 trust" |sudo tee -a /etc/postgresql/14/main/pg_hba.conf
echo "host all all 172.16.0.0/16 md5" |sudo tee -a /etc/postgresql/14/main/pg_hba.conf
echo "host all all 172.16.0.0/16 ident" |sudo tee -a /etc/postgresql/14/main/pg_hba.conf
sudo echo "listen_addresses = '*'" >> /etc/postgresql/14/main/postgresql.conf
sudo ufw allow 5432/tcp
sudo systemctl restart postgresql.service
netstat -anpt | grep LISTEN
sudo maas init region+rack --database-uri "postgres://$MAAS_DBUSER:$MAAS_DBPASS@$HOSTNAME/$MAAS_DBNAME"
maasadmin@spc-maas-prod:~$ sudo maas init region+rack --database-uri “postgres://$MAAS_DBUSER:$MAAS_DBPASS@$HOSTNAME/$MAAS_DBNAME”
MAAS URL [default=http://172.16.110.2:5240/MAAS]: http://spc-maas-prod.acme.local:5240/MAAS
Failed to perfom migrations:ations
Traceback (most recent call last):
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/db/backends/base/base.py”, line 219, in ensure_connection
self.connect()
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/utils/asyncio.py”, line 33, in inner
return func(*args, **kwargs)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/db/backends/base/base.py”, line 200, in connect
self.connection = self.get_new_connection(conn_params)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/utils/asyncio.py”, line 33, in inner
return func(*args, **kwargs)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/db/backends/postgresql/base.py”, line 187, in get_new_connection
connection = Database.connect(**conn_params)
File “/snap/maas/30516/usr/lib/python3/dist-packages/psycopg2/init.py”, line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not translate host name “1lab@spc-maas-prod” to address: Name or service not known
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/snap/maas/30516/bin/maas-region”, line 8, in
sys.exit(run())
File “/snap/maas/30516/lib/python3.10/site-packages/maasserver/region_script.py”, line 81, in run
run_django(is_snap, is_devenv)
File “/snap/maas/30516/lib/python3.10/site-packages/maasserver/region_script.py”, line 70, in run_django
management.execute_from_command_line()
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/core/management/init.py”, line 419, in execute_from_command_line
utility.execute()
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/core/management/init.py”, line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/core/management/base.py”, line 354, in run_from_argv
self.execute(*args, **cmd_options)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/core/management/base.py”, line 398, in execute
output = self.handle(*args, **options)
File “/snap/maas/30516/lib/python3.10/site-packages/maasserver/management/commands/dbupgrade.py”, line 210, in handle
conn.ensure_connection()
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/utils/asyncio.py”, line 33, in inner
return func(*args, **kwargs)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/db/backends/base/base.py”, line 218, in ensure_connection
with self.wrap_database_errors:
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/db/utils.py”, line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/db/backends/base/base.py”, line 219, in ensure_connection
self.connect()
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/utils/asyncio.py”, line 33, in inner
return func(*args, **kwargs)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/db/backends/base/base.py”, line 200, in connect
self.connection = self.get_new_connection(conn_params)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/utils/asyncio.py”, line 33, in inner
return func(*args, **kwargs)
File “/snap/maas/30516/usr/lib/python3/dist-packages/django/db/backends/postgresql/base.py”, line 187, in get_new_connection
connection = Database.connect(**conn_params)
File “/snap/maas/30516/usr/lib/python3/dist-packages/psycopg2/init.py”, line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not translate host name “1lab@spc-maas-prod” to address: Name or service not known