chirpstack / chirpstack-v3-to-v4

Utility to migate ChirpStack v3 data into ChirpStack v4.
MIT License
8 stars 6 forks source link

" tenant "does not exist #9

Closed kasen99 closed 9 months ago

kasen99 commented 1 year ago

When executing the "chirpstack v3 to v4" migration command, there was a "relationship" tenant "does not exist" issue. How will I handle this issue?Additionally, if you are just starting to use chirpstack V4, how should PostgreSQL generate the relevant database?Because I found that some parameters set on the web side were not saved in the local database, how can I solve this?

GrayCygnus commented 1 year ago

A screenshot will greatly help to assist you. What I can answer now is that you can see here: https://www.chirpstack.io/docs/getting-started/debian-ubuntu.html and they tell how to create the DB and also the extensions needed.

You can also check the init scripts in the configuration folder on the chirpstack-docker repo: https://github.com/chirpstack/chirpstack-docker/tree/master/configuration/postgresql/initdb

Finally, your parameters are stored on the .toml file also inside the configuration/ folder. There you specify things like your DB connection, regions, ports, bands and sub-bands, etc..

Hope this helps you :)

kasen99 commented 1 year ago

Thank you very much for your reply! One more question, https://www.chirpstack.io/docs/getting-started/docker.html According to the above instructions, I have implemented the function of opening the web and configuring parameters such as application and device through it. It seems to be working normally, but when I tried to view this configuration information through the PostgreSQL tool, I couldn't find it. I don't know where the configuration information is? At this point, I did not create a chirpstack database, all of which are for reference https://www.chirpstack.io/docs/getting-started/docker.html I installed the chirpstack service as a docker and found that $POSTGRESQL_HOST=postgres, the web can access port 8080, and even if the chirpstack database is manually created, there is no information set in it. Next, I will reset $POSTGRESQL_HOST=localhost, port 8080 cannot be accessed through a browser, which is a strange problem. The address of localhost is the local address, but what is the IP address of postgres? I spent several days here without any results, please give me some tips! Thank you!

GrayCygnus commented 1 year ago

Again, no screenshot or image to better understand, I'll try my best to answer.

A chirpstack DB is needed for it to work properly. In fact, you have to create it as I mentioned before. Before, on v3 there were two DBs, the applicaiton and the network one, however on v4 you now only have one db "chirpstack". There are things like apps, devices, gateways, users, etc. saved.

On the dockerized chirpstack, the Postgres Dabase is a volume/service also launched (see the docker-compose file). You also then map certain ports to the docker instance. The universal postgres port is the 5432, but that's perhaps another story.

Of course if you disable the postgres part on the Docker or the compose things will behave unexpectedly. I think that perhaps you may want to read about docker and docker compose (I'm no expert on those, but I feel that you are saying some things that suggest you are just "playing" with the docker-compose file expecting it to work.... with all due respect ;)

On another note, on my installation I completely remove the postgres part and have the other configurations point to "my existing" postgres instance (I have my postgres on another server, I point the config files of chirpstack to there), but that's because of a design choice of mine.

Another caution note. Your telemetry will NOT be saved on that postgres Database unless you specify it on the integrations part, so don't expect to find your telemetry on the "chirpstack" database (it's only for configs and stuff).

Hope this helps you a bit more, Cheers, Miguel

kasen99 commented 1 year ago

Dear Miguel: Thank you for your sincere reply! Through your reply, I have learned more information. I need to delve deeper into Docker and Compose. I am currently using a non docker based service, which does not affect my usage. Additionally, I am aware of the use of telemetry data and need to subscribe to it through the mqtt client, while downlink data needs to be executed through gRPC. I have already implemented both of these functions. Thank you and your team for creating this system and providing it with so much maintenance power, which has given us great convenience! Thank you.

GrayCygnus commented 1 year ago

@caoxiaoqian hehe well I'm not part of the Chirpstack company. I just happen to be a user of Chirpstack LoRa that also happens to like and believe in the power of open source technologies and that has a habit of responding and helping folks on internet forums :o)

I try to help when I can. Regardless of that, you are welcome and hope my comments were of help to you.

Cheers, Miguel

brocaar commented 9 months ago

I'm closing this issue as this is / was related to a configuration issue.

When executing the "chirpstack v3 to v4" migration command, there was a "relationship" tenant "does not exist" issue.

It means that the ChirpStack v4 database was not yet initialized. You need to run ChirpStack v4 at least once to initialize the database schema before you can run the migration utility.