I'm trying to deploy self-hosted retool in GCP Cloud Run.
Previously, we were using 2.103.7, which was working fine.
I've tried to update it to 2.119.3, which resulted in a loop:
"There are 88 pending database migrations, checking for up-to-date schema in 1 second(s)..."
I tried to update the container command for it:
"./retool_backend --migrations-only"
...but this resulted in a pathing issue:
terminated: Application failed to start: kernel init: cannot resolve init executable: error finding executable "./retool_backend/retool_backend --migrations-only" in PATH [/retool_backend/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin]: no such file or directory
I then tried to update the command to:
"retool_backend --migrations-only"
...but, confusingly:
terminated: Application failed to start: kernel init: cannot resolve init executable: error finding executable "retool_backend --migrations-only" in PATH [/retool_backend/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin]: no such file or directory
Does anyone have any idea what to do?
Hey @Vermyndax!
I'm not sure what's going on here
if you run a simple ls
command in that directory what are you seeing?

Would you mind describing the steps you took to upgrade as well? Have you been able to upgrade successfully before?
Hi there, thanks for your response.
I am deploying retool via Terraform only Google Cloud Run, using a Google Terraform module:
module "retool_api" {
source = "GoogleCloudPlatform/cloud-run/google"
version = "0.6.0"
service_name = "retool-api"
project_id = var.account_id
location = var.region
env_vars = [
{
name = "NODE_ENV"
value = var.environment
},
{
name = "SERVICE_TYPE"
value = "MAIN_BACKEND,DB_CONNECTOR"
},
{
name = "POSTGRES_DB"
value = "xx-retool-${var.environment}"
},
{
name = "POSTGRES_HOST"
value = "/cloudsql/${module.retool_database.instance_connection_name}"
},
{
name = "POSTGRES_SSL_ENABLED"
value = "false"
},
{
name = "POSTGRES_PORT"
value = "5432"
},
# TODO: Update with license information from Oles
{
name = "LICENSE_KEY"
value = "<omitted>"
},
{
name = "RETOOL_EXPOSED_OPENAI_KEY"
value = var.prod_project_retool_gpt_api_key
},
{
name = "DATABASE_MIGRATIONS_TIMEOUT_SECONDS"
value = "3600"
}
]
env_secret_vars = [
{
name = "POSTGRES_USER"
value_from = [{
secret_key_ref = {
name = google_secret_manager_secret.retool_database_username.secret_id
key = "latest"
}
}]
},
{
name = "POSTGRES_PASSWORD"
value_from = [{
secret_key_ref = {
name = google_secret_manager_secret.retool_database_password.secret_id
key = "latest"
}
}]
},
{
name = "JWT_SECRET"
value_from = [{
secret_key_ref = {
name = google_secret_manager_secret.retool_jwt_secret.secret_id
key = "latest"
}
}]
},
{
name = "ENCRYPTION_KEY"
value_from = [{
secret_key_ref = {
name = google_secret_manager_secret.retool_encryption_key.secret_id
key = "latest"
}
}]
}
]
/* image = "us-central1-docker.pkg.dev/<omitted>/<omitted>/backend:2.119.3" */
image = "us-central1-docker.pkg.dev/<omitted>/<omitted>/backend:2.103.7"
container_command = [
/* "retool_backend --migrations-only", */
"./docker_scripts/start_api.sh",
]
limits = {
cpu = "2000m"
memory = "4Gi"
}
members = ["allUsers"]
ports = {
"name" : "http1",
"port" : 3000
}
service_account_email = module.retool_service_account.email
template_annotations = {
"autoscaling.knative.dev/minScale" = 1
"generated-by" = "terraform"
"run.googleapis.com/client-name" = "terraform"
"run.googleapis.com/cloudsql-instances" = module.retool_database.instance_connection_name
"run.googleapis.com/cpu-throttling" = "false"
}
depends_on = [time_sleep.wait_60_seconds]
}
As you can see, I tried upgrading it to 2.119.3. Unfortunately, the container would not start. It said that there were 88 pending migrations and it was waiting for them to be performed. Nothing happened, so I started trying to issue commands before the "./docker_scripts/start_api.sh", in container_commands. You can see where I tried to issue a command for the migration, however, this command fails.
What's puzzling is that the container is straight from your site, just posted to our repo with no modifications.
What's the proper way to upgrade the container and database schema in this way?
Hey @Vermyndax!
Do you have a separate container set up to run the JOBS_RUNNER
service? Getting stuck with pending migrations is an indicator that that may not be running. If you can only have one container running it's possible to include it as a service on this container but it's highly recommended to spin it up in its own container.
Also, if you're upgrading, there are some issues that have been fixed for 2.119.3
so you may want to upgrade to a later version of 2.119 (e.g. 2.119.13
) or a more recent version like 2.121.3
.