An issue with a plugin

@nigel It works! Thanks a lot!
Sorry but there is one more issue with making migrations.

baserow/venv/lib/python3.9/site-packages/django/core/management/commands/makemigrations.py:105: RuntimeWarning: Got an error checking a consistent migration history performed for database connection 'default': connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Hi @dpetrenko,

Could you try these commands to make migrations?

docker-compose -f docker-compose.dev.yml run --rm my-baserow-plugin backend-cmd manage makemigrations
docker-compose -f docker-compose.dev.yml run --rm my-baserow-plugin backend-cmd-with-db manage migrate

I’ve tried them and I’ve got the error from the previous message.

Ah I remember now, I think this is just a warning when you run makemigrations if it can’t find a real running database to check, which you don’t need really to run makemigrations. It should have worked and generated migration files if any were needed.

Alternatively you can run

docker-compose -f docker-compose.dev.yml down # also make sure to stop the service first
docker-compose -f docker-compose.dev.yml run --rm my-baserow-plugin backend-cmd-with-db manage makemigrations

Looks like something wrong with DB connection.

Creating network "baserow-custom-number-field-plugin_default" with the default driver
Creating baserow-custom-number-field-plugin_baserow-custom-number-field-plugin_run ... done
 [STARTUP][2023-02-23 13:50:35] No DATABASE_HOST or DATABASE_URL provided, using embedded postgres.  
 [STARTUP][2023-02-23 13:50:35] Using embedded baserow redis as no REDIS_HOST or REDIS_URL provided.   
 [STARTUP][2023-02-23 13:50:35] Importing REDIS_PASSWORD secret from /baserow/data/.redispass  
 [STARTUP][2023-02-23 13:50:36] Importing SECRET_KEY secret from /baserow/data/.secret  
 [STARTUP][2023-02-23 13:50:36] Importing BASEROW_JWT_SIGNING_KEY secret from /baserow/data/.jwt_signing_key  
 [STARTUP][2023-02-23 13:50:36] Importing DATABASE_PASSWORD secret from /baserow/data/.pgpass  
/baserow.sh: line 259: pgrep: command not found
 [STARTUP][2023-02-23 13:50:36] Didn't find an existing postgres + redis running, starting them up now.  
=========================================================================================

██████╗  █████╗ ███████╗███████╗██████╗  ██████╗ ██╗    ██╗
██╔══██╗██╔══██╗██╔════╝██╔════╝██╔══██╗██╔═══██╗██║    ██║
██████╔╝███████║███████╗█████╗  ██████╔╝██║   ██║██║ █╗ ██║
██╔══██╗██╔══██║╚════██║██╔══╝  ██╔══██╗██║   ██║██║███╗██║
██████╔╝██║  ██║███████║███████╗██║  ██║╚██████╔╝╚███╔███╔╝
╚═════╝ ╚═╝  ╚═╝╚══════╝╚══════╝╚═╝  ╚═╝ ╚═════╝  ╚══╝╚══╝

Version 1.14.0

=========================================================================================
Welcome to Baserow. See https://baserow.io/installation/install-with-docker/ for detailed instructions on 
how to use this Docker image.
 [STARTUP][2023-02-23 13:50:36] Running setup of embedded baserow database.  
 [POSTGRES_INIT][2023-02-23 13:50:36] Becoming postgres superuser to run setup SQL commands:  
 [POSTGRES_INIT][2023-02-23 13:50:36]   
 [POSTGRES_INIT][2023-02-23 13:50:36] PostgreSQL Database directory appears to contain a database; Skipping initialization  
 [POSTGRES_INIT][2023-02-23 13:50:36]   
 [STARTUP][2023-02-23 13:50:36] No BASEROW_PUBLIC_URL environment variable provided. Starting baserow locally at http://localhost without automatic https.  
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  0/5 ...
[PLUGIN][SETUP] Found a plugin in /baserow/data/plugins/baserow_custom_number_field_plugin/, ensuring it is installed...
[PLUGIN][baserow_custom_number_field_plugin] Found a backend app for baserow_custom_number_field_plugin.
[PLUGIN][baserow_custom_number_field_plugin] Skipping install of baserow_custom_number_field_plugin's backend app as it is already installed.
[PLUGIN][baserow_custom_number_field_plugin] Running baserow_custom_number_field_plugin's custom runtime_setup.sh script
[PLUGIN][baserow_custom_number_field_plugin] Found a web-frontend module for baserow_custom_number_field_plugin.
[PLUGIN][baserow_custom_number_field_plugin] Skipping build of baserow_custom_number_field_plugin web-frontend module as it has already been built.
[PLUGIN][baserow_custom_number_field_plugin] Skipping runtime setup of baserow_custom_number_field_plugin's web-frontend module.
[PLUGIN][baserow_custom_number_field_plugin] Fixing ownership of plugins from 0 to baserow_docker_user in /baserow/data/plugins
[PLUGIN][baserow_custom_number_field_plugin] Finished setting up baserow_custom_number_field_plugin successfully.
 [STARTUP][2023-02-23 13:50:37] Starting all Baserow processes:  
2023-02-23 13:50:37,271 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-postgres.conf" during parsing
2023-02-23 13:50:37,271 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-postgres.conf" during parsing
2023-02-23 13:50:37,271 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-redis.conf" during parsing
2023-02-23 13:50:37,271 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-redis.conf" during parsing
2023-02-23 13:50:37,271 INFO Set uid to user 0 succeeded
2023-02-23 13:50:37,271 INFO Set uid to user 0 succeeded
2023-02-23 13:50:37,273 INFO supervisord started with pid 100
2023-02-23 13:50:37,273 INFO supervisord started with pid 100
2023-02-23 13:50:38,277 INFO spawned: 'postgresql' with pid 226
2023-02-23 13:50:38,277 INFO spawned: 'postgresql' with pid 226
2023-02-23 13:50:38,282 INFO spawned: 'redis' with pid 227
2023-02-23 13:50:38,282 INFO spawned: 'redis' with pid 227
 [REDIS][2023-02-23 13:50:38] 227:C 23 Feb 2023 13:50:38.319 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo  
 [REDIS][2023-02-23 13:50:38] 227:C 23 Feb 2023 13:50:38.319 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=227, just started  
 [REDIS][2023-02-23 13:50:38] 227:C 23 Feb 2023 13:50:38.319 # Configuration loaded  
 [REDIS][2023-02-23 13:50:38] 227:M 23 Feb 2023 13:50:38.321 * Running mode=standalone, port=6379.  
 [REDIS][2023-02-23 13:50:38] 227:M 23 Feb 2023 13:50:38.321 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.  
 [REDIS][2023-02-23 13:50:38] 227:M 23 Feb 2023 13:50:38.321 # Server initialized  
 [REDIS][2023-02-23 13:50:38] 227:M 23 Feb 2023 13:50:38.321 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.  
 [REDIS][2023-02-23 13:50:38] 227:M 23 Feb 2023 13:50:38.321 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled (set to 'madvise' or 'never').  
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  1/5 ...
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.363 UTC [226] LOG:  listening on IPv4 address "127.0.0.1", port 5432  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.363 UTC [226] LOG:  could not bind IPv6 address "::1": Cannot assign requested address  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.363 UTC [226] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.371 UTC [226] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.398 UTC [253] LOG:  database system was interrupted; last known up at 2023-02-23 13:46:38 UTC  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.661 UTC [253] LOG:  database system was not properly shut down; automatic recovery in progress  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.664 UTC [253] LOG:  redo starts at 0/3E72048  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.676 UTC [253] LOG:  invalid record length at 0/3F7C820: wanted 24, got 0  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.676 UTC [253] LOG:  redo done at 0/3F7C7E8  
 [POSTGRES][2023-02-23 13:50:38] 2023-02-23 13:50:38.677 UTC [253] LOG:  last completed transaction was at log time 2023-02-23 13:50:09.869483+00  
PostgreSQL is available
 [STARTUP][2023-02-23 13:50:40] ======== RUNNING COMMAND =========  
Loaded backend plugins: baserow_custom_number_field_plugin
WARNING: Baserow is configured to use a BASEROW_PUBLIC_URL of http://localhost. If you attempt to access Baserow on any other hostname requests to the backend will fail as they will be from an unknown host. Please set BASEROW_PUBLIC_URL if you will be accessing Baserow from any other URL then http://localhost.
No changes detected
 [STARTUP][2023-02-23 13:50:43] ==================================  
 [STARTUP][2023-02-23 13:50:43] ======== Cleaning up after Command ==========  
2023-02-23 13:50:45,725 WARN received SIGTERM indicating exit request
2023-02-23 13:50:45,725 WARN received SIGTERM indicating exit request
2023-02-23 13:50:45,725 INFO waiting for postgresql, redis to die
2023-02-23 13:50:45,725 INFO waiting for postgresql, redis to die
 [REDIS][2023-02-23 13:50:45] 227:M 23 Feb 2023 13:50:38.321 * Ready to accept connections  
 [REDIS][2023-02-23 13:50:45] 227:signal-handler (1677160245) Received SIGTERM scheduling shutdown...  
 [REDIS][2023-02-23 13:50:45] 227:M 23 Feb 2023 13:50:45.749 # User requested shutdown...  
 [REDIS][2023-02-23 13:50:45] 227:M 23 Feb 2023 13:50:45.749 # Redis is now ready to exit, bye bye...  
2023-02-23 13:50:45,751 INFO stopped: redis (exit status 0)
2023-02-23 13:50:45,751 INFO stopped: redis (exit status 0)
 [POSTGRES][2023-02-23 13:50:45] 2023-02-23 13:50:38.714 UTC [226] LOG:  database system is ready to accept connections  
 [POSTGRES][2023-02-23 13:50:45] 2023-02-23 13:50:45.751 UTC [226] LOG:  received smart shutdown request  
 [POSTGRES][2023-02-23 13:50:45] 2023-02-23 13:50:45.764 UTC [226] LOG:  background worker "logical replication launcher" (PID 259) exited with exit code 1  
 [POSTGRES][2023-02-23 13:50:45] 2023-02-23 13:50:45.767 UTC [254] LOG:  shutting down  
 [POSTGRES][2023-02-23 13:50:45] 2023-02-23 13:50:45.787 UTC [226] LOG:  database system is shut down  
2023-02-23 13:50:45,790 INFO stopped: postgresql (exit status 0)
2023-02-23 13:50:45,790 INFO stopped: postgresql (exit status 0)

This is a bug with the baserow/baserow:1.14.0 and below images and has been fixed in baserow/baserow:develop-latest, see this thread. Base docker image needs "procps" apt package, otherwise "pgrep" is missing

It will be in baserow/baserow:1.15.0 and onwards once released, for now you can switch your docker images to build from baserow/baserow:develop-latest.

But once again the warning you are seeing is just a warning, the makemigrations command

docker-compose -f docker-compose.dev.yml run --rm my-baserow-plugin backend-cmd manage makemigrations

I believe is actually succeeding for you

Thanks for the help. I switched to develop-latest for now.
I see a message that no changes detected but I cannot create a new field with a new custom field type since there is “Invalid code” error. I think I face it since there is no information about a new field type in database.

@dpetrenko are you able to share your plugin code? It does look like you’ve not added the new “Integer” field as a registered field type in the backend, or you’ve added it with quotes/without quotes and it isn’t matching?

@nigel Please take a look Dmitry Petrenko / baserow-custom-number-field-plugin · GitLab

@dpetrenko it looks like you missed the step to register your new field type. I don’t see this in your apps.py

from django.apps import AppConfig

from baserow.core.registries import plugin_registry
from baserow.contrib.database.fields.registries import field_type_registry


class PluginNameConfig(AppConfig):
    name = 'my_baserow_plugin'

    def ready(self):
        from .plugins import PluginNamePlugin


        plugin_registry.register(PluginNamePlugin())

        # These lines missing!
        from .field_types import IntegerFieldType
        field_type_registry.register(IntegerFieldType())

Thank you for the help but I still have some issues.

  1. Looks like there is an issue with documentation since it’s said that config.py should be created.
    Field type // Baserow but actually this is apps.py

  1. I’ve updated apps.py and for now I cannot run the app since there is an exception "Apps aren’t loaded yet. "
2023-02-28 08:50:48,419 INFO success: processes entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-02-28 08:50:48,419 INFO success: processes entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-02-28 08:50:48,420 INFO success: baserow-watcher entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-02-28 08:50:48,420 INFO success: baserow-watcher entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
 [BACKEND][2023-02-28 08:50:48] WARNING: Baserow is configured to use a BASEROW_PUBLIC_URL of http://localhost. If you attempt to access Baserow on any other hostname requests to the backend will fail as they will be from an unknown host. Please set BASEROW_PUBLIC_URL if you will be accessing Baserow from any other URL then http://localhost.  
 [BACKEND][2023-02-28 08:50:48] Traceback (most recent call last):  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/backend/src/baserow/manage.py", line 41, in <module>  
 [BACKEND][2023-02-28 08:50:48]     main()  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/backend/src/baserow/manage.py", line 37, in main  
 [BACKEND][2023-02-28 08:50:48]     execute_from_command_line(sys.argv)  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line  
 [BACKEND][2023-02-28 08:50:48]     utility.execute()  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute  
 [BACKEND][2023-02-28 08:50:48]     django.setup()  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/venv/lib/python3.9/site-packages/django/__init__.py", line 24, in setup  
 [BACKEND][2023-02-28 08:50:48]     apps.populate(settings.INSTALLED_APPS)  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/venv/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate  
 [BACKEND][2023-02-28 08:50:48]     app_config = AppConfig.create(entry)  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/venv/lib/python3.9/site-packages/django/apps/config.py", line 124, in create  
 [BACKEND][2023-02-28 08:50:48]     mod = import_module(mod_path)  
 [BACKEND][2023-02-28 08:50:48]   File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module  
 [BACKEND][2023-02-28 08:50:48]     return _bootstrap._gcd_import(name[level:], package, level)  
 [BACKEND][2023-02-28 08:50:48]   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import  
 [BACKEND][2023-02-28 08:50:48]   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load  
 [BACKEND][2023-02-28 08:50:48]   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked  
 [BACKEND][2023-02-28 08:50:48]   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked  
 [BACKEND][2023-02-28 08:50:48]   File "<frozen importlib._bootstrap_external>", line 790, in exec_module  
 [BACKEND][2023-02-28 08:50:48]   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/data/plugins/baserow_custom_number_field_plugin/backend/src/baserow_custom_number_field_plugin/apps.py", line 4, in <module>  
 [BACKEND][2023-02-28 08:50:48]     from baserow.contrib.database.fields.registries import field_type_registry  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/backend/src/baserow/contrib/database/fields/registries.py", line 26, in <module>  
 [BACKEND][2023-02-28 08:50:48]     from .fields import DurationFieldUsingPostgresFormatting  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/backend/src/baserow/contrib/database/fields/fields.py", line 12, in <module>  
 [BACKEND][2023-02-28 08:50:48]     from baserow.contrib.database.formula import BaserowExpression, FormulaHandler  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/backend/src/baserow/contrib/database/formula/__init__.py", line 36, in <module>  
 [BACKEND][2023-02-28 08:50:48]     from baserow.contrib.database.formula.handler import FormulaHandler  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/backend/src/baserow/contrib/database/formula/handler.py", line 6, in <module>  
 [BACKEND][2023-02-28 08:50:48]     from baserow.contrib.database.fields.dependencies.types import FieldDependencies  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/backend/src/baserow/contrib/database/fields/dependencies/types.py", line 3, in <module>  
 [BACKEND][2023-02-28 08:50:48]     from baserow.contrib.database.fields.dependencies.models import FieldDependency  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/backend/src/baserow/contrib/database/fields/dependencies/models.py", line 4, in <module>  
 [BACKEND][2023-02-28 08:50:48]     class FieldDependency(models.Model):  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/venv/lib/python3.9/site-packages/django/db/models/base.py", line 108, in __new__  
 [BACKEND][2023-02-28 08:50:48]     app_config = apps.get_containing_app_config(module)  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/venv/lib/python3.9/site-packages/django/apps/registry.py", line 253, in get_containing_app_config  
 [BACKEND][2023-02-28 08:50:48]     self.check_apps_ready()  
 [BACKEND][2023-02-28 08:50:48]   File "/baserow/venv/lib/python3.9/site-packages/django/apps/registry.py", line 136, in check_apps_ready  
 [BACKEND][2023-02-28 08:50:48]     raise AppRegistryNotReady("Apps aren't loaded yet.")  
 [BACKEND][2023-02-28 08:50:48] django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.  
2023-02-28 08:50:48,806 INFO exited: backend (exit status 1; not expected)
2023-02-28 08:50:48,806 INFO exited: backend (exit status 1; not expected)
2023-02-28 08:50:48,807 INFO reaped unknown pid 268 (exit status 0)
2023-02-28 08:50:48,807 INFO reaped unknown pid 268 (exit status 0)
from django.apps import AppConfig




class PluginNameConfig(AppConfig):
    name = 'my_baserow_plugin'

    def ready(self):
        from baserow.core.registries import plugin_registry
        from baserow.contrib.database.fields.registries import field_type_registry
        from .plugins import PluginNamePlugin


        plugin_registry.register(PluginNamePlugin())

        # These lines missing!
        from .field_types import IntegerFieldType
        field_type_registry.register(IntegerFieldType())

Try move these imports into the function like so to prevent trying to import models prior to django loading them.

Thanks. It works but I still cannot create a new field with custom type.

ProgrammingError at /api/database/fields/table/1/
relation "baserow_custom_number_field_plugin_integerfield" does not exist
LINE 1: INSERT INTO "baserow_custom_number_field_plugin_integerfield...
                    ^

I’ve tried to initiate migration with the next command but I see the message that no changes detected.

docker-compose -f docker-compose.dev.yml run --rm baserow-custom-number-field-plugin backend-cmd-with-db manage makemigrations
Creating baserow-custom-number-field-plugin_baserow-custom-number-field-plugin_run ... done
 [STARTUP][2023-03-01 10:47:09] No DATABASE_HOST or DATABASE_URL provided, using embedded postgres.  
 [STARTUP][2023-03-01 10:47:09] Using embedded baserow redis as no REDIS_HOST or REDIS_URL provided.   
 [STARTUP][2023-03-01 10:47:09] Importing REDIS_PASSWORD secret from /baserow/data/.redispass  
 [STARTUP][2023-03-01 10:47:09] Importing SECRET_KEY secret from /baserow/data/.secret  
 [STARTUP][2023-03-01 10:47:09] Importing BASEROW_JWT_SIGNING_KEY secret from /baserow/data/.jwt_signing_key  
 [STARTUP][2023-03-01 10:47:09] Importing DATABASE_PASSWORD secret from /baserow/data/.pgpass  
 [STARTUP][2023-03-01 10:47:09] Didn't find an existing postgres + redis running, starting them up now.  
=========================================================================================

██████╗  █████╗ ███████╗███████╗██████╗  ██████╗ ██╗    ██╗
██╔══██╗██╔══██╗██╔════╝██╔════╝██╔══██╗██╔═══██╗██║    ██║
██████╔╝███████║███████╗█████╗  ██████╔╝██║   ██║██║ █╗ ██║
██╔══██╗██╔══██║╚════██║██╔══╝  ██╔══██╗██║   ██║██║███╗██║
██████╔╝██║  ██║███████║███████╗██║  ██║╚██████╔╝╚███╔███╔╝
╚═════╝ ╚═╝  ╚═╝╚══════╝╚══════╝╚═╝  ╚═╝ ╚═════╝  ╚══╝╚══╝

Version 1.14.0

=========================================================================================
Welcome to Baserow. See https://baserow.io/installation/install-with-docker/ for detailed instructions on 
how to use this Docker image.
 [STARTUP][2023-03-01 10:47:09] Running setup of embedded baserow database.  
 [POSTGRES_INIT][2023-03-01 10:47:09] Becoming postgres superuser to run setup SQL commands:  
 [POSTGRES_INIT][2023-03-01 10:47:09]   
 [POSTGRES_INIT][2023-03-01 10:47:09] PostgreSQL Database directory appears to contain a database; Skipping initialization  
 [POSTGRES_INIT][2023-03-01 10:47:09]   
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  0/5 ...
 [STARTUP][2023-03-01 10:47:09] No BASEROW_PUBLIC_URL environment variable provided. Starting baserow locally at http://localhost without automatic https.  
[PLUGIN][SETUP] Found a plugin in /baserow/data/plugins/baserow_custom_number_field_plugin/, ensuring it is installed...
[PLUGIN][baserow_custom_number_field_plugin] Found a backend app for baserow_custom_number_field_plugin.
[PLUGIN][baserow_custom_number_field_plugin] Skipping install of baserow_custom_number_field_plugin's backend app as it is already installed.
[PLUGIN][baserow_custom_number_field_plugin] Running baserow_custom_number_field_plugin's custom runtime_setup.sh script
[PLUGIN][baserow_custom_number_field_plugin] Found a web-frontend module for baserow_custom_number_field_plugin.
[PLUGIN][baserow_custom_number_field_plugin] Skipping build of baserow_custom_number_field_plugin web-frontend module as it has already been built.
[PLUGIN][baserow_custom_number_field_plugin] Skipping runtime setup of baserow_custom_number_field_plugin's web-frontend module.
[PLUGIN][baserow_custom_number_field_plugin] Fixing ownership of plugins from 0 to baserow_docker_user in /baserow/data/plugins
[PLUGIN][baserow_custom_number_field_plugin] Finished setting up baserow_custom_number_field_plugin successfully.
 [STARTUP][2023-03-01 10:47:10] Starting all Baserow processes:  
2023-03-01 10:47:10,667 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-postgres.conf" during parsing
2023-03-01 10:47:10,667 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-postgres.conf" during parsing
2023-03-01 10:47:10,667 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-redis.conf" during parsing
2023-03-01 10:47:10,667 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-redis.conf" during parsing
2023-03-01 10:47:10,667 INFO Set uid to user 0 succeeded
2023-03-01 10:47:10,667 INFO Set uid to user 0 succeeded
2023-03-01 10:47:10,668 INFO supervisord started with pid 100
2023-03-01 10:47:10,668 INFO supervisord started with pid 100
2023-03-01 10:47:11,671 INFO spawned: 'postgresql' with pid 225
2023-03-01 10:47:11,671 INFO spawned: 'postgresql' with pid 225
2023-03-01 10:47:11,672 INFO spawned: 'redis' with pid 226
2023-03-01 10:47:11,672 INFO spawned: 'redis' with pid 226
 [REDIS][2023-03-01 10:47:11] 226:C 01 Mar 2023 10:47:11.700 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo  
 [REDIS][2023-03-01 10:47:11] 226:C 01 Mar 2023 10:47:11.700 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=226, just started  
 [REDIS][2023-03-01 10:47:11] 226:C 01 Mar 2023 10:47:11.700 # Configuration loaded  
 [REDIS][2023-03-01 10:47:11] 226:M 01 Mar 2023 10:47:11.701 * Running mode=standalone, port=6379.  
 [REDIS][2023-03-01 10:47:11] 226:M 01 Mar 2023 10:47:11.701 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.  
 [REDIS][2023-03-01 10:47:11] 226:M 01 Mar 2023 10:47:11.701 # Server initialized  
 [REDIS][2023-03-01 10:47:11] 226:M 01 Mar 2023 10:47:11.701 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.  
 [REDIS][2023-03-01 10:47:11] 226:M 01 Mar 2023 10:47:11.701 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled (set to 'madvise' or 'never').  
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  1/5 ...
 [POSTGRES][2023-03-01 10:47:11] 2023-03-01 10:47:11.770 UTC [225] LOG:  listening on IPv4 address "127.0.0.1", port 5432  
 [POSTGRES][2023-03-01 10:47:11] 2023-03-01 10:47:11.770 UTC [225] LOG:  could not bind IPv6 address "::1": Cannot assign requested address  
 [POSTGRES][2023-03-01 10:47:11] 2023-03-01 10:47:11.770 UTC [225] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.  
 [POSTGRES][2023-03-01 10:47:11] 2023-03-01 10:47:11.777 UTC [225] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  
 [POSTGRES][2023-03-01 10:47:12] 2023-03-01 10:47:11.792 UTC [253] LOG:  database system was interrupted; last known up at 2023-03-01 10:45:07 UTC  
 [POSTGRES][2023-03-01 10:47:12] 2023-03-01 10:47:12.041 UTC [253] LOG:  database system was not properly shut down; automatic recovery in progress  
 [POSTGRES][2023-03-01 10:47:12] 2023-03-01 10:47:12.044 UTC [253] LOG:  redo starts at 0/6666780  
 [POSTGRES][2023-03-01 10:47:12] 2023-03-01 10:47:12.045 UTC [253] LOG:  invalid record length at 0/66A6938: wanted 24, got 0  
 [POSTGRES][2023-03-01 10:47:12] 2023-03-01 10:47:12.045 UTC [253] LOG:  redo done at 0/66A6900  
 [POSTGRES][2023-03-01 10:47:12] 2023-03-01 10:47:12.045 UTC [253] LOG:  last completed transaction was at log time 2023-03-01 10:46:15.744434+00  
PostgreSQL is available
 [STARTUP][2023-03-01 10:47:13] ======== RUNNING COMMAND =========  
Loaded backend plugins: baserow_custom_number_field_plugin
WARNING: Baserow is configured to use a BASEROW_PUBLIC_URL of http://localhost. If you attempt to access Baserow on any other hostname requests to the backend will fail as they will be from an unknown host. Please set BASEROW_PUBLIC_URL if you will be accessing Baserow from any other URL then http://localhost.
No changes detected
 [STARTUP][2023-03-01 10:47:17] ==================================  
 [STARTUP][2023-03-01 10:47:17] ======== Cleaning up after Command ==========  
2023-03-01 10:47:19,083 WARN received SIGTERM indicating exit request
2023-03-01 10:47:19,083 WARN received SIGTERM indicating exit request
2023-03-01 10:47:19,083 INFO waiting for postgresql, redis to die
2023-03-01 10:47:19,083 INFO waiting for postgresql, redis to die
 [REDIS][2023-03-01 10:47:19] 226:M 01 Mar 2023 10:47:11.701 * Ready to accept connections  
 [REDIS][2023-03-01 10:47:19] 226:signal-handler (1677667639) Received SIGTERM scheduling shutdown...  
 [REDIS][2023-03-01 10:47:19] 226:M 01 Mar 2023 10:47:19.124 # User requested shutdown...  
 [REDIS][2023-03-01 10:47:19] 226:M 01 Mar 2023 10:47:19.125 # Redis is now ready to exit, bye bye...  
2023-03-01 10:47:19,126 INFO stopped: redis (exit status 0)
2023-03-01 10:47:19,126 INFO stopped: redis (exit status 0)
 [POSTGRES][2023-03-01 10:47:19] 2023-03-01 10:47:12.074 UTC [225] LOG:  database system is ready to accept connections  
 [POSTGRES][2023-03-01 10:47:19] 2023-03-01 10:47:19.126 UTC [225] LOG:  received smart shutdown request  
 [POSTGRES][2023-03-01 10:47:19] 2023-03-01 10:47:19.134 UTC [225] LOG:  background worker "logical replication launcher" (PID 259) exited with exit code 1  
 [POSTGRES][2023-03-01 10:47:19] 2023-03-01 10:47:19.135 UTC [254] LOG:  shutting down  
 [POSTGRES][2023-03-01 10:47:19] 2023-03-01 10:47:19.156 UTC [225] LOG:  database system is shut down  
2023-03-01 10:47:19,158 INFO stopped: postgresql (exit status 0)
2023-03-01 10:47:19,158 INFO stopped: postgresql (exit status 0)

Once you’ve made the migrations, you need to actually execute them:

docker-compose -f docker-compose.dev.yml run --rm baserow-custom-number-field-plugin backend-cmd-with-db manage migrate

I’d suggest doing a quick tutorial on Django first perhaps as this will help you with writing a Baserow backend plugin as it’s just a Django app wrapped up and installed into Baserow.

@nigel Thanks for the answer.

I’ve tried some more times to create migrations but here is the problem with makemigrations command since migrations folder wasn’t created and the output for this command is “No changes detected”. It’s expected to see an error message that baserow_custom_number_field_plugin_integerfield table does not exist and running migrate command doesn’t make sense but anyway I’ve run it and nothing happed.

There are some plugins according to documentation but they were created 8 month ago.
Do you have any fresh examples?

In addition I didn’t do any changes/custom logic to code from Baserow documentation to brake something.

I don’t want to bother you with all this stuff but it doesn’t work and it’s important for me to create and use plugins for Baserow. Thanks in advance.

FYI: I’ve created migrations folder with “init.py” inside it manually and it helped me to have my first migration created so makemigrations command works fine but now there is an issue with migrate command. Please take a look on logs below.

docker-compose -f docker-compose.dev.yml run --rm baserow-custom-number-field-plugin backend-cmd-with-db manage migrate
WARNING: The PLUGIN_BUILD_UID variable is not set. Defaulting to a blank string.
WARNING: The PLUGIN_BUILD_GID variable is not set. Defaulting to a blank string.
Creating baserow-custom-number-field-plugin_baserow-custom-number-field-plugin_run ... done
 [STARTUP][2023-03-02 10:38:10] No DATABASE_HOST or DATABASE_URL provided, using embedded postgres.  
 [STARTUP][2023-03-02 10:38:10] Using embedded baserow redis as no REDIS_HOST or REDIS_URL provided.   
 [STARTUP][2023-03-02 10:38:10] Importing REDIS_PASSWORD secret from /baserow/data/.redispass  
 [STARTUP][2023-03-02 10:38:10] Importing SECRET_KEY secret from /baserow/data/.secret  
 [STARTUP][2023-03-02 10:38:10] Importing BASEROW_JWT_SIGNING_KEY secret from /baserow/data/.jwt_signing_key  
 [STARTUP][2023-03-02 10:38:10] Importing DATABASE_PASSWORD secret from /baserow/data/.pgpass  
 [STARTUP][2023-03-02 10:38:10] Didn't find an existing postgres + redis running, starting them up now.  
=========================================================================================

██████╗  █████╗ ███████╗███████╗██████╗  ██████╗ ██╗    ██╗
██╔══██╗██╔══██╗██╔════╝██╔════╝██╔══██╗██╔═══██╗██║    ██║
██████╔╝███████║███████╗█████╗  ██████╔╝██║   ██║██║ █╗ ██║
██╔══██╗██╔══██║╚════██║██╔══╝  ██╔══██╗██║   ██║██║███╗██║
██████╔╝██║  ██║███████║███████╗██║  ██║╚██████╔╝╚███╔███╔╝
╚═════╝ ╚═╝  ╚═╝╚══════╝╚══════╝╚═╝  ╚═╝ ╚═════╝  ╚══╝╚══╝

Version 1.14.0

=========================================================================================
Welcome to Baserow. See https://baserow.io/installation/install-with-docker/ for detailed instructions on 
how to use this Docker image.
 [STARTUP][2023-03-02 10:38:10] Running setup of embedded baserow database.  
 [POSTGRES_INIT][2023-03-02 10:38:10] Becoming postgres superuser to run setup SQL commands:  
 [POSTGRES_INIT][2023-03-02 10:38:10]   
 [POSTGRES_INIT][2023-03-02 10:38:10] PostgreSQL Database directory appears to contain a database; Skipping initialization  
 [POSTGRES_INIT][2023-03-02 10:38:10]   
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

 [STARTUP][2023-03-02 10:38:10] No BASEROW_PUBLIC_URL environment variable provided. Starting baserow locally at http://localhost without automatic https.  
Waiting for PostgreSQL to become available attempt  0/5 ...
[PLUGIN][SETUP] Found a plugin in /baserow/data/plugins/baserow_custom_number_field_plugin/, ensuring it is installed...
[PLUGIN][baserow_custom_number_field_plugin] Found a backend app for baserow_custom_number_field_plugin.
[PLUGIN][baserow_custom_number_field_plugin] Skipping install of baserow_custom_number_field_plugin's backend app as it is already installed.
[PLUGIN][baserow_custom_number_field_plugin] Running baserow_custom_number_field_plugin's custom runtime_setup.sh script
[PLUGIN][baserow_custom_number_field_plugin] Found a web-frontend module for baserow_custom_number_field_plugin.
[PLUGIN][baserow_custom_number_field_plugin] Skipping build of baserow_custom_number_field_plugin web-frontend module as it has already been built.
[PLUGIN][baserow_custom_number_field_plugin] Skipping runtime setup of baserow_custom_number_field_plugin's web-frontend module.
[PLUGIN][baserow_custom_number_field_plugin] Fixing ownership of plugins from 0 to baserow_docker_user in /baserow/data/plugins
[PLUGIN][baserow_custom_number_field_plugin] Finished setting up baserow_custom_number_field_plugin successfully.
 [STARTUP][2023-03-02 10:38:12] Starting all Baserow processes:  
2023-03-02 10:38:12,547 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-postgres.conf" during parsing
2023-03-02 10:38:12,547 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-postgres.conf" during parsing
2023-03-02 10:38:12,548 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-redis.conf" during parsing
2023-03-02 10:38:12,548 INFO Included extra file "/baserow/supervisor/includes/enabled/embedded-redis.conf" during parsing
2023-03-02 10:38:12,548 INFO Set uid to user 0 succeeded
2023-03-02 10:38:12,548 INFO Set uid to user 0 succeeded
2023-03-02 10:38:12,551 INFO supervisord started with pid 100
2023-03-02 10:38:12,551 INFO supervisord started with pid 100
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  1/5 ...
2023-03-02 10:38:13,555 INFO spawned: 'postgresql' with pid 227
2023-03-02 10:38:13,555 INFO spawned: 'postgresql' with pid 227
2023-03-02 10:38:13,557 INFO spawned: 'redis' with pid 228
2023-03-02 10:38:13,557 INFO spawned: 'redis' with pid 228
 [REDIS][2023-03-02 10:38:13] 228:C 02 Mar 2023 10:38:13.603 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo  
 [REDIS][2023-03-02 10:38:13] 228:C 02 Mar 2023 10:38:13.603 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=228, just started  
 [REDIS][2023-03-02 10:38:13] 228:C 02 Mar 2023 10:38:13.603 # Configuration loaded  
 [REDIS][2023-03-02 10:38:13] 228:M 02 Mar 2023 10:38:13.604 * Running mode=standalone, port=6379.  
 [REDIS][2023-03-02 10:38:13] 228:M 02 Mar 2023 10:38:13.604 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.  
 [REDIS][2023-03-02 10:38:13] 228:M 02 Mar 2023 10:38:13.604 # Server initialized  
 [REDIS][2023-03-02 10:38:13] 228:M 02 Mar 2023 10:38:13.604 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.  
 [REDIS][2023-03-02 10:38:13] 228:M 02 Mar 2023 10:38:13.604 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled (set to 'madvise' or 'never').  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.629 UTC [227] LOG:  listening on IPv4 address "127.0.0.1", port 5432  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.629 UTC [227] LOG:  could not bind IPv6 address "::1": Cannot assign requested address  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.629 UTC [227] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.634 UTC [227] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.654 UTC [253] LOG:  database system was shut down at 2023-03-02 09:53:01 UTC  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.654 UTC [253] LOG:  invalid resource manager ID 83 at 0/6931A48  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.654 UTC [253] LOG:  invalid primary checkpoint record  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.654 UTC [253] PANIC:  could not locate a valid checkpoint record  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.654 UTC [227] LOG:  startup process (PID 253) was terminated by signal 6: Aborted  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.654 UTC [227] LOG:  aborting startup due to startup process failure  
 [POSTGRES][2023-03-02 10:38:13] 2023-03-02 10:38:13.655 UTC [227] LOG:  database system is shut down  
2023-03-02 10:38:13,657 INFO exited: postgresql (exit status 1; not expected)
2023-03-02 10:38:13,657 INFO exited: postgresql (exit status 1; not expected)
2023-03-02 10:38:14,660 INFO spawned: 'postgresql' with pid 254
2023-03-02 10:38:14,660 INFO spawned: 'postgresql' with pid 254
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.727 UTC [254] LOG:  listening on IPv4 address "127.0.0.1", port 5432  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.727 UTC [254] LOG:  could not bind IPv6 address "::1": Cannot assign requested address  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.727 UTC [254] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.734 UTC [254] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [265] LOG:  database system was shut down at 2023-03-02 09:53:01 UTC  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [265] LOG:  invalid resource manager ID 83 at 0/6931A48  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [265] LOG:  invalid primary checkpoint record  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [265] PANIC:  could not locate a valid checkpoint record  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [254] LOG:  startup process (PID 265) was terminated by signal 6: Aborted  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [254] LOG:  aborting startup due to startup process failure  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.765 UTC [254] LOG:  database system is shut down  
2023-03-02 10:38:14,768 INFO exited: postgresql (exit status 1; not expected)
2023-03-02 10:38:14,768 INFO exited: postgresql (exit status 1; not expected)
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  2/5 ...
2023-03-02 10:38:16,772 INFO spawned: 'postgresql' with pid 268
2023-03-02 10:38:16,772 INFO spawned: 'postgresql' with pid 268
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.822 UTC [268] LOG:  listening on IPv4 address "127.0.0.1", port 5432  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.822 UTC [268] LOG:  could not bind IPv6 address "::1": Cannot assign requested address  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.822 UTC [268] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.827 UTC [268] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.848 UTC [279] LOG:  database system was shut down at 2023-03-02 09:53:01 UTC  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.848 UTC [279] LOG:  invalid resource manager ID 83 at 0/6931A48  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.848 UTC [279] LOG:  invalid primary checkpoint record  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.848 UTC [279] PANIC:  could not locate a valid checkpoint record  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.848 UTC [268] LOG:  startup process (PID 279) was terminated by signal 6: Aborted  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.848 UTC [268] LOG:  aborting startup due to startup process failure  
 [POSTGRES][2023-03-02 10:38:16] 2023-03-02 10:38:16.850 UTC [268] LOG:  database system is shut down  
2023-03-02 10:38:16,852 INFO exited: postgresql (exit status 1; not expected)
2023-03-02 10:38:16,852 INFO exited: postgresql (exit status 1; not expected)
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  3/5 ...
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  4/5 ...
2023-03-02 10:38:19,859 INFO spawned: 'postgresql' with pid 284
2023-03-02 10:38:19,859 INFO spawned: 'postgresql' with pid 284
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.918 UTC [284] LOG:  listening on IPv4 address "127.0.0.1", port 5432  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.918 UTC [284] LOG:  could not bind IPv6 address "::1": Cannot assign requested address  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.918 UTC [284] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.926 UTC [284] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.951 UTC [295] LOG:  database system was shut down at 2023-03-02 09:53:01 UTC  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.951 UTC [295] LOG:  invalid resource manager ID 83 at 0/6931A48  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.951 UTC [295] LOG:  invalid primary checkpoint record  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.951 UTC [295] PANIC:  could not locate a valid checkpoint record  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.951 UTC [284] LOG:  startup process (PID 295) was terminated by signal 6: Aborted  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.951 UTC [284] LOG:  aborting startup due to startup process failure  
 [POSTGRES][2023-03-02 10:38:19] 2023-03-02 10:38:19.953 UTC [284] LOG:  database system is shut down  
2023-03-02 10:38:19,955 INFO exited: postgresql (exit status 1; not expected)
2023-03-02 10:38:19,955 INFO exited: postgresql (exit status 1; not expected)
2023-03-02 10:38:19,955 INFO gave up: postgresql entered FATAL state, too many start retries too quickly
2023-03-02 10:38:19,955 INFO gave up: postgresql entered FATAL state, too many start retries too quickly
Error: Failed to connect to the postgresql database at localhost
Please see the error below for more details:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
        Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
        Is the server running on that host and accepting TCP/IP connections?

Waiting for PostgreSQL to become available attempt  5/5 ...
PostgreSQL did not become available in time...
 [STARTUP][2023-03-02 10:38:23] ======== Cleaning up after Command ==========  
2023-03-02 10:38:24,961 WARN received SIGTERM indicating exit request
2023-03-02 10:38:24,961 WARN received SIGTERM indicating exit request
2023-03-02 10:38:24,962 INFO waiting for redis to die
2023-03-02 10:38:24,962 INFO waiting for redis to die
 [REDIS][2023-03-02 10:38:24] 228:M 02 Mar 2023 10:38:13.605 * Ready to accept connections  
 [REDIS][2023-03-02 10:38:25] 228:signal-handler (1677753504) Received SIGTERM scheduling shutdown...  
 [REDIS][2023-03-02 10:38:25] 228:M 02 Mar 2023 10:38:25.050 # User requested shutdown...  
 [REDIS][2023-03-02 10:38:25] 228:M 02 Mar 2023 10:38:25.051 # Redis is now ready to exit, bye bye...  
2023-03-02 10:38:25,052 INFO stopped: redis (exit status 0)
2023-03-02 10:38:25,052 INFO stopped: redis (exit status 0)
ERROR: 1

Looks like your postgres database is corrupted:

 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [265] LOG:  database system was shut down at 2023-03-02 09:53:01 UTC  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [265] LOG:  invalid resource manager ID 83 at 0/6931A48  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [265] LOG:  invalid primary checkpoint record  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [265] PANIC:  could not locate a valid checkpoint record  
 [POSTGRES][2023-03-02 10:38:14] 2023-03-02 10:38:14.762 UTC [254] LOG:  startup process (PID 265) was terminated by signal 6: Aborted  

You can completely delete this database and try re-create it by running if you are ok with loosing all of your baserow data in this dev environment:

docker-compose -f docker-compose.dev.yml down -v

After that one alternate and potentially easier method of running these django commands is by execing into your running Baserow backend django container by doing something like (I haven’t had a chance to manually test these work):

PLUGIN_BUILD_UID=$(id -u) PLUGIN_BUILD_GID=$(id -g) docker-compose -f docker-compose.dev.yml up -d --build
# wait for everything to launch
docker-compose -f docker-compose.dev.yml exec my-baserow-plugin /baserow.sh backend-cmd bash -c bash
cd /baserow/data/plugins/my_baserow_plugin/backend/
# now you can run all of the backend commands in this shell whilst the server is running
./baserow makemigrations
./baserow migrate
./baserow shell

And sorry for all the back and forth, we’ll take all of these pain points you’ve hit and fix up the boilerplate so its easier for the next person. Thanks for having the patience to go through them all with me.

And FYI here is the issue tracking the postgres database corruption, it happens when you run multiple Baserow containers at the same time pointing at the exact same postgres data volume, which is very easy to accidentally do using the backend-cmd-with-db command. Investigate, document and prevent or fix postgres database corruption when two all-in-one images run at the same time with same volume (#1524) · Issues · Bram Wiepjes / baserow · GitLab .

There is a command that recovers this database if this happens discussed on that issue.

@nigel It works. Thanks a lot for the help.

I had the same issue with my plugin (which I created on baserow 1.11 I believe, then subsequently upgraded to 1.12, 1.13.2, and now 1.15.2). The fix worked for me.