CollinKendor opened a new issue #14811:
URL: https://github.com/apache/superset/issues/14811


   Hi, we are having difficulty sending alerts via email in supersets. Every 
time an alert is triggered, the celery worker will return the following error:
   ```
   superset_worker         Taking a PNG screenshot or url 
http://superset:8088/superset/dashboard/2/
   superset_worker         [2021-05-25 11:50:09,259: INFO/ForkPoolWorker-1] 
Taking a PNG screenshot or url http://superset:8088/superset/dashboard/2/
   superset_worker         Report state: [Errno -2] Name or service not known
   superset_worker         [2021-05-25 11:50:10,348: INFO/ForkPoolWorker-1] 
Report state: [Errno -2] Name or service not known
   superset_worker         [2021-05-25 11:50:10,351: INFO/ForkPoolWorker-1] 
Task reports.execute[50cbb39a-4a1c-4dac-83e2-56b7be28cf13] succeeded in 
10.219615060952492s: None
   ```
   
   We have set up supersets in a docker container so we have the celery worker, 
celery beat, redis and postgres instance up. the following is the 
docker-compose.yml:
   ```
   #
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this 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 with
   # the License.  You may obtain a copy of the License at
   #
   #    http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed 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 and
   # limitations under the License.
   #
   x-superset-image: &superset-image apache/superset:latest
   x-superset-depends-on: &superset-depends-on
     - db
     - redis
   x-superset-volumes: &superset-volumes
     # /app/pythonpath_docker will be appended to the PYTHONPATH in the final 
container
     - ./docker:/app/docker
     - superset_home:/app/superset_home
     - /opt/superset/config:/app/pythonpath
   
   version: "3.7"
   services:
     redis:
       image: redis:latest
       container_name: superset_cache
       restart: unless-stopped
       #    ports:
       #  - 6380:6379
       volumes:
         - redis:/data
   
     db:
       env_file: docker/.env
       image: postgres:10
       container_name: superset_db
       restart: unless-stopped
       #    ports: 
       #  - 5433:5432
       volumes:
         - db_home:/var/lib/postgresql/data
   
     superset:
       env_file: docker/.env-non-dev
       #image: *superset-image
       build: .
       container_name: superset_app
       command: ["/app/docker/docker-bootstrap.sh", "app-gunicorn"]
       user: "root"
       restart: unless-stopped
       ports:
         - 8088:8088
       depends_on: *superset-depends-on
       volumes: *superset-volumes
   
     superset-init:
       #image: *superset-image
       build: .
       container_name: superset_init
       command: ["/app/docker/docker-init.sh"]
       env_file: docker/.env-non-dev
       depends_on: *superset-depends-on
       user: "root"
       volumes: *superset-volumes
   
     superset-worker:
       #image: *superset-image
       build: .
       container_name: superset_worker
       command: ["/app/docker/docker-bootstrap.sh", "worker"]
       env_file: docker/.env-non-dev
       restart: unless-stopped
       depends_on: *superset-depends-on
       user: "root"
       volumes: *superset-volumes
   
     superset-worker-beat:
       #image: *superset-image
       build: .
       container_name: superset_worker_beat
       command: ["/app/docker/docker-bootstrap.sh", "beat"]
       env_file: docker/.env-non-dev
       restart: unless-stopped
       depends_on: *superset-depends-on
       user: "root"
       volumes: *superset-volumes
   
   volumes:
     superset_home:
       external: false
     db_home:
       external: false
     redis:
       external: false
   ```
   
   as you can see I use a custom superset docker image build from the following 
docker file. This is the install the Chrome Driver needed for he alerts. The 
following is my Docker file:
   ```
   FROM apache/superset:latest
   
   USER root
   
   RUN 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.deb && \
       apt-get install -y vim
   
   RUN export CHROMEDRIVER_VERSION=$(curl --silent 
https://chromedriver.storage.googleapis.com/LATEST_RELEASE_90) && \
       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.zip
   
   RUN pip install --no-cache gevent psycopg2 redis
   
   EXPOSE 8088
   
   HEALTHCHECK CMD curl -f "http://superset:8088/health";
   
   USER superset
   ```
   
   the configuration are as follows:
   ```
   from celery.schedules import crontab
   
   FEATURE_FLAGS = {
       "ALERT_REPORTS": True
   }
   
   REDIS_HOST = "redis"
   REDIS_PORT = "6379"
   
   class CeleryConfig:
       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_PREFETCH_MULTIPLIER = 10
       CELERY_ACKS_LATE = True
       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 = 100
   SCREENSHOT_LOAD_WAIT = 600
   
   # Slack configuration
   SLACK_API_TOKEN = "xoxb-"
   
   EMAIL_NOTIFICATIONS= True
   
   # Email configuration
   SMTP_HOST = "<email server ip>"
   SMTP_STARTTLS = False
   SMTP_SSL = False
   SMTP_USER = ""
   SMTP_PORT = <email server port> # your port eg. 587
   SMTP_PASSWORD = ""
   SMTP_MAIL_FROM = "<from email>"
   
   # 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
   WEBDRIVER_TYPE = "chrome"
   WEBDRIVER_OPTION_ARGS = [
       "--force-device-scale-factor=2.0",
       "--high-dpi-support=2.0",
       "--headless",
       "--disable-gpu",
       "--disable-dev-shm-usage",
       "--no-sandbox",
       "--disable-setuid-sandbox",
       "--disable-extensions",
   ]
   
   # This is for internal use, you can keep http
   WEBDRIVER_BASEURL="http://superset:8088";
   # This is the link sent to the recipient, change to your domain eg. 
https://superset.mydomain.com
   WEBDRIVER_BASEURL_USER_FRIENDLY="http://<redacted ip>:8088"
   
   SQLALCHEMY_DATABASE_URI = "postgresql://superset:superset@db:5432/superset"
   ```
   I can't figure out what's wrong and google didn't come up with anything 
helpful. I can confirm all container can telnet to the redis container via port 
6379 and can telnet to superset_app container via port 8088.
   
   Hope someone can give me some ideas on where to look as i am at my wits end. 
Thank you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to