Cannot enable vector extension for pgvector – Missing vector.control file

flippinarqai
HOBBY

3 months ago

Hi Railway team,

I’m deploying a Chatwoot instance using your managed PostgreSQL service and I encountered an error during db:migrate due to the missing vector extension.

Here’s the log output:

PG::UndefinedFile: ERROR: could not open extension control file "/usr/local/share/postgresql/extension/vector.control": No such file or directory

/app/db/migrate/20250104200055_create_captain_tables.rb:28:in `setup_vector_extension'

The migration fails because enable_extension 'vector' is required to use pgvector. This extension is critical for some semantic features in Chatwoot.

Can you confirm whether it’s possible to enable the pgvector extension (or the vector.control file) in the managed Railway PostgreSQL service?

If not, could you recommend the best approach to integrate it (e.g. using an external PostgreSQL provider like Supabase or Neon)?

Thanks in advance!

$10 Bounty

5 Replies

3 months ago

Hey flippinarqai, have you tried the pgvector template?


flippinarqai
HOBBY

3 months ago

Thanks for the quick reply and for sharing the pgvector template!

However, I have a concern: my current PostgreSQL database (the one connected to Chatwoot) already contains important data that I can’t afford to lose. If I switch to the pgvector template, will I be able to migrate all existing data safely from my current Railway PostgreSQL instance to this new one that includes the pgvector extension?

Could you please guide me on the best way to move data between Railway PostgreSQL instances, ensuring that nothing breaks and Chatwoot can continue working with the existing records?

Looking forward to your guidance — thanks again!


flippinarqai

Thanks for the quick reply and for sharing the pgvector template!However, I have a concern: my current PostgreSQL database (the one connected to Chatwoot) already contains important data that I can’t afford to lose. If I switch to the pgvector template, will I be able to migrate all existing data safely from my current Railway PostgreSQL instance to this new one that includes the pgvector extension?Could you please guide me on the best way to move data between Railway PostgreSQL instances, ensuring that nothing breaks and Chatwoot can continue working with the existing records?Looking forward to your guidance — thanks again!

3 months ago

I would start the migration by first creating a backup of the current Postgres database using pg_dump. Then, I would deploy the pgvector template and perform pg_restore on it with the backup you have created. Once you have done this, verify that the pgvector template has all the data and proceed to swap out the reference variables from your Chatwoot application, so that it is reading and writing to the new Postgres database with pgvector. Keep in mind that with this approach, some data may be lost during the migration process, this is due to the fact that your Chatwoot application may be writing to the database after the backup has been created and we only restore data up until the snapshot of the backup.


flippinarqai
HOBBY

3 months ago

Our current idea is to open a new Chatwoot instance, deploy it, and connect the old PostgreSQL database (the one that’s currently not working) to the new PostgreSQL database included in the new instance. Would this work and allow us to keep all the existing data from the old PostgreSQL, or is any additional modification needed?

As I understand it now — please confirm if I’m right — in our previous Chatwoot setup, we had Chatwoot, PostgreSQL, and Redis. But in the new Chatwoot templates, we now have Chatwoot, PostgreSQL, and Valkey. Can you confirm if switching from the old Chatwoot template to the new one (with Valkey) allows us to do this smoothly without problems, and if the PostgreSQL database change would work correctly without data loss?

Thanks in advance!


3 months ago

Our current idea is to open a new Chatwoot instance, deploy it, and connect the old PostgreSQL database (the one that’s currently not working) to the new PostgreSQL database included in the new instance. Would this work and allow us to keep all the existing data from the old PostgreSQL, or is any additional modification needed?

I don't understand the part where you connect both Postgres databases together.

As I understand it now — please confirm if I’m right — in our previous Chatwoot setup, we had Chatwoot, PostgreSQL, and Redis. But in the new Chatwoot templates, we now have Chatwoot, PostgreSQL, and Valkey. Can you confirm if switching from the old Chatwoot template to the new one (with Valkey) allows us to do this smoothly without problems, and if the PostgreSQL database change would work correctly without data loss?

The current Chatwoot template comes with Chatwoot, Postgres 16 with pgvector and Valkey. You can deploy this template and migrate your data over (by using pg_dump and pg_restore) and verify that everything is working correctly, in this case you don't have to worry about issues during the migration as this is separate from your previous Chatwoot instance connected to different databases. Keep in mind that the previous caveat will still be present, in addition to having to reassign your custom domain.

I can't help with Redis/Valkey as I have never used it before.