-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed taking a screenshot Message: 'geckodriver' executable needs to be in PATH. #23057
Comments
From https://superset.apache.org/docs/installation/alerts-reports/:
Have you tried using the |
Assuming the provided solution resolves the issue, due to lack of response. |
I have the same problem. Here is my Dockerfile `# Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements. See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.###################################################################### PY stage that simply does a pip install on our requirements###################################################################### RUN mkdir /app First, we just wanna install requirements, which will allow us to utilize the cachein order to only build if and only if requirements changeCOPY ./requirements/*.txt /app/requirements/ ###################################################################### Node stage to deal with static asset construction###################################################################### ARG NPM_VER=7 ARG NPM_BUILD_CMD="build" NPM ci first, as to NOT invalidate previous steps except for when package.json changesRUN mkdir -p /app/superset-frontend This seems to be the most expensive stepRUN cd /app/superset-frontend ###################################################################### Final lean image...###################################################################### ENV LANG=C.UTF-8 RUN mkdir -p ${PYTHONPATH} COPY --from=superset-py /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/ Copying site-packages doesn't move the CLIs, so let's copy them one by oneCOPY --from=superset-py /usr/local/bin/gunicorn /usr/local/bin/celery /usr/local/bin/flask /usr/bin/ Lastly, let's install superset itselfCOPY superset /app/superset COPY ./docker/run-server.sh /usr/bin/ RUN chmod a+x /usr/bin/run-server.sh WORKDIR /app USER superset HEALTHCHECK CMD curl -f "http://localhost:$SUPERSET_PORT/health" EXPOSE ${SUPERSET_PORT} CMD /usr/bin/run-server.sh ###################################################################### Dev image...###################################################################### COPY ./requirements/.txt ./docker/requirements-.txt/ /app/requirements/ USER root chromeRUN apt-get update && \wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \apt-get install -y --no-install-recommends ./google-chrome-stable_current_amd64.deb && \rm -f google-chrome-stable_current_amd64.debRUN export CHROMEDRIVER_VERSION=$(curl --silent https://chromedriver.storage.googleapis.com/LATEST_RELEASE) && \wget -q https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip && \unzip chromedriver_linux64.zip -d /usr/bin && \chmod 755 /usr/bin/chromedriver && \rm -f chromedriver_linux64.zipRUN pip install --no-cache gevent psycopg2 redisfirefoxRUN apt-get update -y # Install GeckoDriver WebDriverRUN wget https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz -O /tmp/geckodriver.tar.gz && \tar xvfz /tmp/geckodriver.tar.gz -C /tmp && \mv /tmp/geckodriver /usr/local/bin/geckodriver && \rm /tmp/geckodriver.tar.gz# Install FirefoxRUN wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2 -O /opt/firefox.tar.bz2 && \tar xvf /opt/firefox.tar.bz2 -C /opt && \ln -s /opt/firefox/firefox /usr/local/bin/firefoxfirefox - added by PC from https://superset.apache.org/docs/installation/alerts-reports/RUN apt-get update && ENV GECKODRIVER_VERSION=0.29.0 RUN pip install --no-cache gevent psycopg2 redis Cache everything for dev purposes...RUN cd /app ###################################################################### CI image...###################################################################### COPY --chown=superset ./docker/docker-bootstrap.sh /app/docker/ RUN chmod a+x /app/docker/*.sh CMD /app/docker/docker-ci.sh |
If you are using the non-dev (prod) setup, follow the documentation to make changes to your Dockerfile: Otherwise as an easy alternative here’s what I did to fix the issue: Change the line FROM dev AS ci Then build the image again. |
Hi @anantmulchandani ,I am not able to implement alerts and reports in my local. There is only one change which i made anfd that is in superset_config.py file and my updated superset_config.py file looks like this '''' from celery.schedules import crontab logger = logging.getLogger() DATABASE_DIALECT = os.getenv("DATABASE_DIALECT") EXAMPLES_USER = os.getenv("EXAMPLES_USER") SQLALCHEMY_DATABASE_URI = ( SQLALCHEMY_EXAMPLES_URI = ( REDIS_HOST = os.getenv("REDIS_HOST", "redis") RESULTS_BACKEND = FileSystemCache("/app/superset_home/sqllab") CACHE_CONFIG = { class CeleryConfig: CELERY_CONFIG = CeleryConfig SMTP_HOST = "xxxx" # change to your host FEATURE_FLAGS = {"ALERT_REPORTS": True} try:
except ImportError: '''' but after these changes when i again do How to resolve this? |
Also @anantmulchandani ,can you please create a blog or a youtube video for this.would be great help |
Hi @sudhanshuagariya
Next, you need to check in
Upon successful completion of your build and once the containers are up, you can enter into the running containers using
Ensure that the location of This should help you send image/pdf reports for which geckodriver and firefox are required in headless browser mode. *PS: Also, use a tagged image of superset (like |
import logging
import os
from datetime import timedelta
from typing import Optional
from cachelib.file import FileSystemCache
from celery.schedules import crontab
logger = logging.getLogger()
def get_env_variable(var_name: str, default: Optional[str] = None) -> str:
"""Get the environment variable or raise exception."""
try:
return os.environ[var_name]
except KeyError:
if default is not None:
return default
else:
error_msg = "The environment variable {} was missing, abort...".format(
var_name
)
raise EnvironmentError(error_msg)
DATABASE_DIALECT = get_env_variable("DATABASE_DIALECT")
DATABASE_USER = get_env_variable("DATABASE_USER")
DATABASE_PASSWORD = get_env_variable("DATABASE_PASSWORD")
DATABASE_HOST = get_env_variable("DATABASE_HOST")
DATABASE_PORT = get_env_variable("DATABASE_PORT")
DATABASE_DB = get_env_variable("DATABASE_DB")
The SQLAlchemy connection string.
SQLALCHEMY_DATABASE_URI = "%s://%s:%s@%s:%s/%s" % (
DATABASE_DIALECT,
DATABASE_USER,
DATABASE_PASSWORD,
DATABASE_HOST,
DATABASE_PORT,
DATABASE_DB,
)
REDIS_HOST = get_env_variable("REDIS_HOST")
REDIS_PORT = get_env_variable("REDIS_PORT")
REDIS_CELERY_DB = get_env_variable("REDIS_CELERY_DB", "0")
REDIS_RESULTS_DB = get_env_variable("REDIS_RESULTS_DB", "1")
RESULTS_BACKEND = FileSystemCache("/app/superset_home/sqllab")
CACHE_CONFIG = {
"CACHE_TYPE": "redis",
"CACHE_DEFAULT_TIMEOUT": 300,
"CACHE_KEY_PREFIX": "superset_",
"CACHE_REDIS_HOST": REDIS_HOST,
"CACHE_REDIS_PORT": REDIS_PORT,
"CACHE_REDIS_DB": REDIS_RESULTS_DB,
}
DATA_CACHE_CONFIG = CACHE_CONFIG
class CeleryConfig(object):
BROKER_URL = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
CELERY_IMPORTS = ('superset.sql_lab', "superset.tasks", "superset.tasks.thumbnails", )
CELERY_RESULT_BACKEND = 'redis://%s:%s/0' % (REDIS_HOST, REDIS_PORT)
CELERYD_LOG_LEVEL = "DEBUG"
CELERYD_PREFETCH_MULTIPLIER = 10
CELERY_ACKS_LATE = False
CELERY_ANNOTATIONS = {
'sql_lab.get_sql_results': {
'rate_limit': '100/s',
},
'email_reports.send': {
'rate_limit': '1/s',
'time_limit': 600,
'soft_time_limit': 600,
'ignore_result': True,
},
}
CELERYBEAT_SCHEDULE = {
"reports.scheduler": {
"task": "reports.scheduler",
"schedule": crontab(minute="", hour=""),
},
"reports.prune_log": {
"task": "reports.prune_log",
"schedule": crontab(minute=0, hour=0),
},
}
CELERY_CONFIG = CeleryConfig
SCREENSHOT_LOCATE_WAIT = 1000
SCREENSHOT_LOAD_WAIT = 1200
Slack configuration
SLACK_API_TOKEN = "xoxb-"
Email configuration
SMTP_HOST = "smtp.126.com" # change to your host
SMTP_PORT = 25 # your port, e.g. 587
SMTP_STARTTLS = True
SMTP_SSL_SERVER_AUTH = True # If your using an SMTP server with a valid certificate
SMTP_SSL = False
SMTP_USER = "####" # use the empty string "" if using an unauthenticated SMTP server
SMTP_PASSWORD = "###" # use the empty string "" if using an unauthenticated SMTP server
SMTP_MAIL_FROM = "###"
EMAIL_REPORTS_SUBJECT_PREFIX = "[Superset] " # optional - overwrites default value in config.py of "[Report] "
FEATURE_FLAGS = {"ALERT_REPORTS": True}
ALERT_REPORTS_NOTIFICATION_DRY_RUN = False
WEBDRIVER_BASEURL = "http://superset:8088/"
The base URL for the email report hyperlinks.
WEBDRIVER_BASEURL_USER_FRIENDLY = "http://####"
WebDriver configuration
If you use Firefox, you can stick with default values
If you use Chrome, then add the following WEBDRIVER_TYPE and WEBDRIVER_OPTION_ARGS
SQLLAB_CTAS_NO_LIMIT = True
Optionally import superset_config_docker.py (which will have been included on
the PYTHONPATH) in order to allow for local settings to be overridden
try:
import superset_config_docker
from superset_config_docker import * # noqa
except ImportError:
logger.info("Using default Docker config...")
I use alert and report functions, and I have installed geckodriver in the container according to the official website. I want to use screenshots, but this problem still occurs. How to solve it? thank you.
I use superset2.0.1, I use
TAG=2.0.1 Docker-compose- f docker-compose-non-dev.yml. Up
command installation
Could you tell me where I made a mistake or missed some operation?
Please let me know. Thank you.
The text was updated successfully, but these errors were encountered: