environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_USER:-admin}
gives an error when updating the YAML definition, stating that e.g. environment variable GRAFANA_USER cannot be empty
Expected behavior
with updating the stack the default values of the environment variable definition should be evaluated
** Error Message**
Failure
failed to deploy a stack: time="2021-11-11T17:32:19Z" level=warning msg="The GRAFANA_USER variable is not set. Defaulting to a blank string." time="2021-11-11T17:32:19Z" level=warning msg="The GRAFANA_PASS variable is not set. Defaulting to a blank
Steps to reproduce the issue:
Go to deploy a stack with one service containing an environment variable and default value
Add a service to the stack and redeploy
Error should
See the error
Technical details:
Portainer version: 2.9.2
Docker version (managed by Portainer): 20.10.10 (API: 1.41)
Platform (windows/linux): raspberry pi arm7
I haven't been able to replicate this behavior locally - defining default values seems to work without issue.
Steps I followed:
Created a new stack via the Web editor in Portainer with the following YAML, without defining any environment variables in Portainer itself:
version: '3'
services:
image: mysql:8.0
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_DATABASE_PASSWORD:-thisisadefaultpassword}
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: ${WORDPRESS_DB_PASSWORD:-wordpress}
volumes:
db_data:
Stack creates successfully, can confirm the MYSQL_ROOT_PASSWORD
and MYSQL_PASSWORD
environment variables have been set with their default values.
Edit the stack via Portainer and add the following service definition to the existing YAML, again not defining any environment variables in Portainer:
wordpress:
image: wordpress:latest
ports:
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD:-wordpress}
Updating the stack proceeds without issue, and the environment variable is set with the default value on the new service container.
Am I misunderstanding the issue here? Can you confirm my process is correct for what you're seeing?
I have to confirm that this is working as intended but only in my local environment
On a directly connected remote environment:
I have created a new stack and just added as you above:
version: '3'
services:
image: mysql:8.0
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_DATABASE_PASSWORD:-thisisadefaultpassword}
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: ${WORDPRESS_DB_PASSWORD:-wordpress}
volumes:
db_data:
When I deploy the stack I get:
my host is:
I'm running into the same issue. I had a typo in my docker-compose.yml, but the app deployed successfully. Now, I have fixed the issue in docker-compose.yml, committed my changes back to the GitHub repo but those changes are not reflected in Portainer. The problem is that I cannot delete the stack, because it has the old version of the docker-compose.yml (with the error in it). How can I force it to pull the latest version from GitHub?
I have the same issue when I redeploy a stack:
level=debug msg="The stack has a git config, try to poll from git repository." stackID=13
level=debug msg="Compose stack redeploy with pull image flag: true" stackID=13
level=error msg="failed to update the stack" error="failed to deploy a docker compose stack 13: failed to pull images of the stack: The ENVIRONMENT variable is not set. Defaulting to a blank string.\nThe ASSET_PATH variable is not set. Defaulting to a blank string.\nThe AUTONLP_CORE_PUBLIC_URL variable is not set. Defaulting to a blank string.\nThe AUTONLP_DEPLOYMENT_PROXY_ENTRYPOINT_URL variable is not set. Defaulting to a blank string.\nThe MONGODB_USER variable is not set. Defaulting to a blank string.\nThe MONGODB_PASSWORD variable is not set. Defaulting to a blank string.\nThe GITHUB_TOKEN variable is not set. Defaulting to a blank string.\nThe AUTONLP_ENV variable is not set. Defaulting to a blank string.\nThe REDIS_USER variable is not set. Defaulting to a blank string.\nThe REDIS_PASSWORD variable is not set. Defaulting to a blank string.\nThe MLFLOW_TRACKING_URI variable is not set. Defaulting to a blank string.\nThe MLFLOW_TRACKING_USERNAME variable is not set. Defaulting to a blank string.\nThe MLFLOW_TRACKING_PASSWORD variable is not set. Defaulting to a blank string.\nThe AWS_ACCESS_KEY_ID variable is not set. Defaulting to a blank string.\nThe AWS_SECRET_ACCESS_KEY variable is not set. Defaulting to a blank string.\nThe AUTONLP_TRAEFIK_ENTRYPOINT_PORT variable is not set. Defaulting to a blank string.\nThe AUTONLP_MINIO_PORT variable is not set. Defaulting to a blank string.\nThe AUTONLP_MINIO_CONSOLE_PORT variable is not set. Defaulting to a blank string.\nThe BUCKET_URI_OR_LOCAL_PATH variable is not set. Defaulting to a blank string.\nThe Compose file '/data/compose/13/docker-compose.yml' is invalid because:\nservices.auto-nlp-traefik.ports contains an invalid type, it should be a number, or an object\nservices.auto-nlp-minio.ports contains an invalid type, it should be a number, or an object\nservices.auto-nlp-minio.ports contains an invalid type, it should be a number, or an object\n: exit status 1"
level=info msg="2022/03/27 12:00:16 http error: Failed to update the stack (err=failed to deploy a docker compose stack 13: failed to pull images of the stack: The ENVIRONMENT variable is not set. Defaulting to a blank string."
level=info msg="The ASSET_PATH variable is not set. Defaulting to a blank string."
level=info msg="The AUTONLP_CORE_PUBLIC_URL variable is not set. Defaulting to a blank string."
level=info msg="The AUTONLP_DEPLOYMENT_PROXY_ENTRYPOINT_URL variable is not set. Defaulting to a blank string."
level=info msg="The MONGODB_USER variable is not set. Defaulting to a blank string."
level=info msg="The MONGODB_PASSWORD variable is not set. Defaulting to a blank string."
level=info msg="The GITHUB_TOKEN variable is not set. Defaulting to a blank string."
level=info msg="The AUTONLP_ENV variable is not set. Defaulting to a blank string."
level=info msg="The REDIS_USER variable is not set. Defaulting to a blank string."
level=info msg="The REDIS_PASSWORD variable is not set. Defaulting to a blank string."
level=info msg="The MLFLOW_TRACKING_URI variable is not set. Defaulting to a blank string."
level=info msg="The MLFLOW_TRACKING_USERNAME variable is not set. Defaulting to a blank string."
level=info msg="The MLFLOW_TRACKING_PASSWORD variable is not set. Defaulting to a blank string."
level=info msg="The AWS_ACCESS_KEY_ID variable is not set. Defaulting to a blank string."
level=info msg="The AWS_SECRET_ACCESS_KEY variable is not set. Defaulting to a blank string."
level=info msg="The AUTONLP_TRAEFIK_ENTRYPOINT_PORT variable is not set. Defaulting to a blank string."
level=info msg="The AUTONLP_MINIO_PORT variable is not set. Defaulting to a blank string."
level=info msg="The AUTONLP_MINIO_CONSOLE_PORT variable is not set. Defaulting to a blank string."
level=info msg="The BUCKET_URI_OR_LOCAL_PATH variable is not set. Defaulting to a blank string."
level=info msg="The Compose file '/data/compose/13/docker-compose.yml' is invalid because:"
level=info msg="services.auto-nlp-traefik.ports contains an invalid type, it should be a number, or an object"
level=info msg="services.auto-nlp-minio.ports contains an invalid type, it should be a number, or an object"
level=info msg="services.auto-nlp-minio.ports contains an invalid type, it should be a number, or an object"
level=info msg=": exit status 1) (code=500)"
I'm using Portainer BE 2.12.1.
All these variables are defined in my stack and were correctly applied while deploying the stack.
I need most of these variables to deploy different environments (prod, qa). One of the points I'm using Portainer BE is that I want to be able to do CD triggered by GitHub, so automatic redeployments are crucial for me.
Happens to me too in Portainer BE 2.12.1
When using the Button "Pull and redeploy" and when using the Webhook.
Since it worked for a while I just deleted the container and image and redeployed. Now it seems to work again.
I think it stopped working after editing the docker-compose.yml in the remote repository.