Hi! I up prefect server in docker locally with ve...
# prefect-server
d
Hi! I up prefect server in docker locally with version "core-0.15.2" it starts normally, but the when i try to up agent , got error : "prefect.exceptions.ClientError: Your Prefect Server instance has no tenants. Create a tenant with `prefect server create-tenant`". Found that, if I use folder with postgres data, that was created with older version of server, agent up as normal. Сan anybody help, what happens?
Agent also version prefect==0.15.2
k
Hi @Denis Rogovskiy, I’m a bit unclear here. Does your server already have a tenant from the old version? Was this an attempt to upgrade?
d
i run server with core14-x with one folder for postgres data, then i change version to newer core-0.15.2 everything works fine. Then i needed to up server/agent on new empty machine and there i faced with problem, that agent cant start . I made some experiments like - change postgres folder on first server, restart server, and again cant start agent. Change back to pg-data folder, made by core14-x, and it works..
k
When you check server, do you see your tenant?
d
no, it is empty
z
It seems likely that you'll need to run the database migrations
For example, here in the Helm chart when the GraphQL service starts up we have an init container that runs the migration command https://github.com/PrefectHQ/server/blob/master/helm/prefect-server/templates/graphql/deployment.yaml#L49
d
looks like it make this command: graphql2: hostname: graphql2 image: "prefecthq/server:${PREFECT_SERVER__TAG:-latest}" ports: - "${PREFECT_SERVER__GRAPHQL_HOST_PORT 4201}4201" command: bash -c "${PREFECT_SERVER__DB_CMD} && python src/prefect_server/services/graphql/server.py" and PREFECT_SERVER__DB_CMD="prefect-server database upgrade -y"
z
prefect-server database upgrade
is the key command here
d
graphql2_1 | graphql2_1 | Running Alembic migrations... postgres2_1 | postgres2_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization postgres2_1 | graphql2_1 | INFO [alembic.runtime.migration] Context impl PostgresqlImpl. towel2_1 | {"severity": "INFO", "name": "prefect-server.Scheduler", "message": "Scheduled 0 flow runs."} postgres2_1 | 2021-10-06 153434.923 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres2_1 | 2021-10-06 153434.923 UTC [1] LOG: listening on IPv6 address "::", port 5432 graphql2_1 | INFO [alembic.runtime.migration] Will assume transactional DDL. graphql2_1 | Applied Hasura metadata from /prefect-server/services/hasura/migrations/metadata.yaml graphql2_1 | graphql2_1 | Database upgraded!
seems i found some errorsgraphql2_1 | INFO [alembic.runtime.migration] Running upgrade 459a61bedc9e -> a666a3f4e422, Add unique index for idempotency key postgres2_1 | CREATE DATABASE ui2_1 | 2021/10/06 153633 [notice] 10#10: start worker processes graphql2_1 | graphql2_1 | Could not upgrade the database! graphql2_1 | Error: HTTPConnectionPool(host='hasura2', port=3000): Max retries exceeded with url: /v1/query (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3c14232610>: Failed to establish a new connection: [Errno 111] Connection refused')) i will play with host names, looks like it will help